tinyusb icon indicating copy to clipboard operation
tinyusb copied to clipboard

Add tuh_hid_get_report(...) to hid_host.h

Open arntsonl opened this issue 1 year ago • 1 comments

Describe the PR This allows USB host functionality to call HID_REQ_CONTROL_GET_REPORT on the TUSB_DIR_IN direction, and read the report buffer in the callback function.

This extends the functionality of the hid_host.h/.c files and gives the host a way to call the HID get report features.

Additional context I'm one of the main developers of https://gp2040-ce.info/ and we extensively use the TinyUSB library to handle USB calls. I wanted to try to keep our TUSB host code as hid_host friendly as possible, but I could not find a good way to call GET REPORT feature on the IN direction.

I just added a new authentication pass-through mode which requires 3 GET REPORT calls and 1 SET REPORT call to complete the authentication transaction. In order for our TUSB host to talk to the DS4 authentication mechanism, we have to run get report on the DS4 specific features and read in the buffer .

Right now, I manually added it to our program by retrieving the itf_num on hid_mount through the tuh_hid_mount_cb functionality, then passing that to the tuh_hid_get_report function we declare statically in our USB host manager code. This patch moves the functionality to the TinyUSB for anyone else who needs a get report feature call using hid_host.h callbacks.

arntsonl avatar Aug 15 '23 02:08 arntsonl

Hi there @hathach I wanted to see if this had been looked at as a possible addition to TinyUSB? We are still maintaining a local callback/hack in the GP2040-CE firmware to support this on GET FEATURE reporting.

arntsonl avatar Jan 08 '24 17:01 arntsonl

Not a problem, thank you for fixing it up and merging!

arntsonl avatar Apr 10 '24 13:04 arntsonl