Open
Description
CircuitPython version
d73473b647d76516d15c7c483951afb5cfd1af81 (#9901) on Metro RP2350
Code/REPL
import board, digitalio, time, usb, usb_host
pwr = digitalio.DigitalInOut(board.USB_HOST_5V_POWER)
port = usb_host.Port(board.USB_HOST_DATA_PLUS, board.USB_HOST_DATA_MINUS)
pwr.switch_to_output(True)
usb.core.find(find_all=True)
print("Here are the devices", list(usb.core.find(find_all=True)))
print("Sleeping 3s")
time.sleep(3)
print("Here are the devices", list(usb.core.find(find_all=True)))
print()
print("busy-waiting 3s")
t = time.monotonic_ns()
e = t + 3_000_000_000
while (now := time.monotonic_ns()) < e:
devices = list(usb.core.find(find_all=True))
if devices:
print(f"busy-waiting found device after {(now-t)*1e-9}s")
break
pass
print("Here are the devices", list(usb.core.find(find_all=True)))
print()
Behavior
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Here are the devices []
Sleeping 3s
Here are the devices []
busy-waiting 3s
busy-waiting found device after 0.0511474s
Description
Something is failing to happen during time.sleep()
that prevents an attached USB device from enumerating. When a busy-loop is used, my particular keyboard enumerates in about 1/20s. But even a long sleep of 3s doesn't work.
Additional information
No response