You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
usb-device-mouse: send_report() blocks forever if the host never reads the mouse #1178
MouseInterface.send_report() waits for the previous report with no timeout:
whileself.busy():
machine.idle()
If the host never reads the mouse IN endpoint, the first report stays pending and the next move_by() / click_*() never returns. The whole
program freezes, including other interfaces such as a KeyboardInterface on the same device.
HIDInterface.send_report() already has a 100 ms timeout, but it is never reached, because MouseInterface.send_report() waits before calling it.
When does the host not read the mouse?
For example a UEFI firmware with a keyboard driver but no mouse driver. I saw it with EDK2/OVMF (QEMU 11.1.3, edk2-stable202408) and the device passed through with usb-host: EDK2 sends SET_PROTOCOL(boot) to the keyboard and no request at all to the mouse interface.
KeyboardInterface + MouseInterface, a button that sends one key and then 20 mouse.move_by() calls.
In EDK2 the first press sends the key, then the program hangs in the loop above; no later press is seen. With my own 50 ms timeout before each move_by() the program keeps running, and it logs that 19 of 20 moves were skipped on the first press and 20 of 20 on every later press.
Possibly the same symptom as #1131 (closed by its author).
Suggested fix
Give the loop a timeout and return False without touching _buf, the same way HIDInterface.send_report() does.
Activity