Skip to content

Commit 52f6909

Browse files
committed
Additional information prints
1 parent 0c27ba3 commit 52f6909

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

adafruit_usb_host_descriptors.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,10 @@ def _find_endpoint(device, protocol_type: Literal[PROTOCOL_MOUSE, PROTOCOL_KEYBO
191191
interface_class == INTERFACE_HID
192192
and interface_protocol != PROTOCOL_KEYBOARD
193193
and protocol_type == PROTOCOL_MOUSE
194-
and subclass != SUBCLASS_BOOT
194+
and subclass == SUBCLASS_RESERVED
195195
):
196196
candidate_found = True
197+
mouse_interface_index = interface_number
197198

198199
# Found HID Descriptor (Contains Report Length)
199200
elif descriptor_type == DESC_HID and candidate_found:
@@ -209,11 +210,11 @@ def _find_endpoint(device, protocol_type: Literal[PROTOCOL_MOUSE, PROTOCOL_KEYBO
209210
return mouse_interface_index, endpoint_address
210211

211212
elif candidate_found:
212-
print(f"Checking Interface {interface_number}...")
213-
rep_desc = get_report_descriptor(device, interface_number, hid_desc_len)
213+
print(f"Checking Interface {mouse_interface_index}...")
214+
rep_desc = get_report_descriptor(device, mouse_interface_index, hid_desc_len)
214215
if _is_confirmed_mouse(rep_desc):
215-
print(f" -> CONFIRMED: It is a Mouse/Trackpad (Usage 0x09 0x02)")
216-
return interface_number, endpoint_address
216+
print(f" -> CONFIRMED: It is a Mouse/Trackpad (Usage 0x09 0x02) index:{mouse_interface_index}, end:{endpoint_address}")
217+
return mouse_interface_index, endpoint_address
217218

218219
candidate_found = False # Stop looking at this interface
219220

0 commit comments

Comments
 (0)