Skip to content

Commit 7782b66

Browse files
committed
fix references to mice
1 parent 21ab387 commit 7782b66

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

examples/usb_host_descriptors_find_boot_keyboard.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,37 @@
77

88
import adafruit_usb_host_descriptors
99

10-
# lists for mouse interface indexes, endpoint addresses, and USB Device instances
11-
# each of these will end up with length 2 once we find both mice
12-
mouse_interface_indexes = None
13-
mouse_endpoint_addresses = None
10+
keyboard_interface_index = None
11+
keyboard_endpoint_address = None
1412
keyboard = None
1513

1614
# scan for connected USB devices
1715
for device in usb.core.find(find_all=True):
18-
# check for boot mouse endpoints on this device
19-
kbd_interface_index, kbd_endpoint_address = (
16+
# check for boot keyboard endpoints on this device
17+
keyboard_interface_index, keyboard_endpoint_address = (
2018
adafruit_usb_host_descriptors.find_boot_keyboard_endpoint(device)
2119
)
2220
# if a boot mouse interface index and endpoint address were found
23-
if kbd_interface_index is not None and kbd_interface_index is not None:
21+
if keyboard_interface_index is not None and keyboard_endpoint_address is not None:
2422
keyboard = device
2523

2624
# detach device from kernel if needed
2725
if keyboard.is_kernel_driver_active(0):
2826
keyboard.detach_kernel_driver(0)
2927

30-
# set the mouse configuration so it can be used
28+
# set the configuration so the keyboard can be used
3129
keyboard.set_configuration()
3230

3331
buf = array.array("b", [0] * 8)
3432

3533
while True:
36-
# try to read data from the mouse
34+
# try to read data from the keyboard
3735
try:
38-
count = keyboard.read(mouse_endpoint_addresses, buf, timeout=10)
36+
count = keyboard.read(keyboard_endpoint_address, buf, timeout=10)
3937

4038
# if there is no data it will raise USBTimeoutError
4139
except usb.core.USBTimeoutError:
42-
# Nothing to do if there is no data for this mouse
40+
# Nothing to do if there is no data for this keyboard
4341
continue
4442

4543
for b in buf:

0 commit comments

Comments
 (0)