Skip to content

Commit d1a8a81

Browse files
committed
remove print and narrow try/except
1 parent 24bfac4 commit d1a8a81

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

adafruit_usb_host_descriptors.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"""
1212

1313
import struct
14+
import usb
1415

1516
from micropython import const
1617

@@ -121,7 +122,7 @@ def get_report_descriptor(device, interface_num, length):
121122
buf,
122123
)
123124
return buf
124-
except Exception as e:
125+
except usb.core.USBError as e:
125126
print(f"Failed to read Report Descriptor: {e}")
126127
return None
127128

@@ -210,10 +211,8 @@ def _find_endpoint(device, protocol_type: Literal[PROTOCOL_MOUSE, PROTOCOL_KEYBO
210211
return mouse_interface_index, endpoint_address
211212

212213
elif candidate_found:
213-
print(f"Checking Interface {mouse_interface_index}...")
214214
rep_desc = get_report_descriptor(device, mouse_interface_index, hid_desc_len)
215215
if _is_confirmed_mouse(rep_desc):
216-
print(" -> CONFIRMED: It is a Mouse/Trackpad (Usage 0x09 0x02)")
217216
return mouse_interface_index, endpoint_address
218217

219218
candidate_found = False # Stop looking at this interface

0 commit comments

Comments
 (0)