File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Metro/Metro_RP2350_Memory/memory_game Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 1818import supervisor
1919import terminalio
2020import usb .core
21+ import atexit
2122from adafruit_fruitjam .peripherals import request_display_config
2223import adafruit_usb_host_descriptors
2324from adafruit_pathlib import Path
@@ -323,6 +324,18 @@ def update_score_text():
323324 # set configuration on the mouse so we can use it
324325 mouse .set_configuration ()
325326
327+ def atexit_callback ():
328+ """
329+ re-attach USB devices to kernel if needed.
330+ :return:
331+ """
332+ print ("inside atexit callback" )
333+ if mouse_was_attached and not mouse .is_kernel_driver_active (0 ):
334+ mouse .attach_kernel_driver (0 )
335+
336+
337+ atexit .register (atexit_callback )
338+
326339# Buffer to hold data read from the mouse
327340# Boot mice have 4 byte reports
328341buf = array .array ("b" , [0 ] * 4 )
You can’t perform that action at this time.
0 commit comments