tinyusb icon indicating copy to clipboard operation
tinyusb copied to clipboard

HID class driver fixes

Open Rocky04 opened this issue 2 years ago • 0 comments

Addressing some drawbacks of the HID class driver implementation.

  • Fixing that the tud_hid_set_report_cb callback 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 by hidd_xfer_cb and not by hidd_control_xfer_cb anymore. Then the HID examples wouldn't work anymore because the result state wouldn't be right.
  • Only invoke tud_hid_report_complete_cb and tud_hid_set_report_cb if the result state of the corresponding transfer was successful. While the comment for the tud_hid_report_complete_cb indicate 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.

Rocky04 avatar Sep 13 '23 21:09 Rocky04