remove hid host enumeration assumption #3340
Open
+27
−16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the PR
Remove assumption that HID Report descriptor is before HID Endpoint.
Additional context
I have been using tinyusb's HID Host stack in my project and came across a game controller that has an...odd configuration.
Most HID Devices have the HID Report Descriptor preceding the endpoint, however I came across a device that has it following the endpoint.
you can see it in this lsusb call where it tails the endpoint with
DEVICE CLASSwhich is actually the Report type that we need to parse.I noticed that tinyusb's
hidh_openhas this order hard coded, so I added a small function to seek the descriptor for theHID_DTYPE_HIDthat we want to parse.This successfully has the device attached to the hidh stack and I can continue to poll it.
If you are interested the project in question I'm using this in is a gamepad adapter for retro consoles. It's been a fun project!
https://github.com/dinsfire64/snekbox_firmware
Thank you as always for your work and effort, tinyusb has been a blast to implement.