Skip to content

Commit e37e192

Browse files
committed
clean up comments and redudant test in release method
1 parent cf6d286 commit e37e192

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

adafruit_usb_host_mouse/__init__.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,9 @@ def find_and_init_mouse(cursor_image=DEFAULT_CURSOR, subclass=SUBCLASS_BOOT):
5959
a :class:`displayio.TileGrid` object.
6060
:param subclass: Defines whether to search for boot or non-boot mice.
6161
SUBCLASS_BOOT (0X01), a boot mouse will be searched for
62-
SUBCLASS_RESERVED (0x02), a non-boot (report) mouse will be searched for
63-
:return: A tupple cotaining the arguments needed to inialize a :class:`BootMouse`
64-
or `ReportMouse` instance depending on the value of subclass. If no mouse is found
65-
None is returned.
62+
SUBCLASS_RESERVED (0x00), a non-boot (report) mouse will be searched for
63+
:return: A tupple cotaining the arguments needed by the calling find and init helper
64+
function. If no mouse is found None is returned.
6665
"""
6766
mouse_interface_index, mouse_endpoint_address = None, None
6867
mouse_device = None
@@ -261,12 +260,11 @@ def release(self):
261260
Release the mouse cursor and re-attach it to the kernel
262261
if it was attached previously.
263262
"""
264-
# was_attached is an empty list if no interfaces were detached from the kernel
265-
if self.was_attached:
266-
# was_attached is a list of detached interfaces
267-
for intf in self.was_attached:
268-
if not self.device.is_kernel_driver_active(intf):
269-
self.device.attach_kernel_driver(intf)
263+
# was_attached is a list of interfaces detached from the kernel or
264+
# an empty list if no interfaces were detached
265+
for intf in self.was_attached:
266+
if not self.device.is_kernel_driver_active(intf):
267+
self.device.attach_kernel_driver(intf)
270268

271269
def update(self):
272270
"""

0 commit comments

Comments
 (0)