tinyusb
tinyusb copied to clipboard
HID class driver fixes
Addressing some drawbacks of the HID class driver implementation.
- Fixing that the
tud_hid_set_report_cbcallback would always inform about an invalid result state if a dedicated OUT endpoint is used. In the case the optional OUT endpoint is used outgoing transfers are then handled byhidd_xfer_cband not byhidd_control_xfer_cbanymore. Then the HID examples wouldn't work anymore because the result state wouldn't be right. - Only invoke
tud_hid_report_complete_cbandtud_hid_set_report_cbif the result state of the corresponding transfer was successful. While the comment for thetud_hid_report_complete_cbindicate that this is only invoked when the report was sent successfully it wasn't even checked that this is the case. This can cause problems in the case there is a communication issue. - Adding an optional callback to inform the application in the case a transfer wasn't successful.