Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tuh_hid_get_report(...) to hid_host.h #2223

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

arntsonl
Copy link
Contributor

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
Copy link
Contributor Author

arntsonl commented Jan 8, 2024

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.

This allows USB host functionality to call HID_REQ_CONTROL_GET_REPORT on the IN Endpoint, and read the report buffer in the callback.
Copy link
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for the PR and sorry for late response. I have rebase to resolve conflict in the latest as well a minor format. The code look great, will merge when ci passed.

@hathach hathach merged commit aa07647 into hathach:master Apr 10, 2024
49 checks passed
@arntsonl
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants