This fix relies on a corresponding change in the low-level USBDevice class.
Without the low-level change, HID and CDC devices may not work correctly at
all.
Zero length OUT control requests were being processed on the device but
stalling the endpoint so the host saw a failure (or hang followed by
failure).
Specifically:
- CDC set control line state and send break requests
- HID set idle or set protocol
This commit also simplifies HID set report logic (tested to still work even
when buffer size doesn't match report length).
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Previously even with timeout set to zero, a read could block
for up to 1ms + machine.idle() timeout period.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
These packages build on top of machine.USBDevice() to provide high level
and flexible support for implementing USB devices in Python code.
Additional credits, as per included copyright notices:
- CDC support based on initial implementation by @hoihu with fixes by
@linted.
- MIDI support based on initial implementation by @paulhamsh.
- HID keypad example based on work by @turmoni.
- Everyone who tested and provided feedback on early versions of these
packages.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>