remove hid host enumeration assumption#3340
Conversation
|
seems like lsusb also got confused by the device as well, this device is clearly out of specs. I am ok to add support for it. But the change seems to be more complicated than it should be. Let keep most the code intact, and only change to allow the hid descriptor to either before (as current) or after endpoint descriptor |
|
So are you imagining changing the original assert into a check if it fails, attempt to flip the order and parse it that way? Then assert if that fails? |
support rare case where hid descriptor is after endpoint descriptor
|
@dinsfire64 I push the update, please try to see if that works for you. |
|
Apologies for the delay, the holidays have eaten up my time to test. Your suggested commit works correctly with the quirky device and I am happy with the solution if you are. |
|
perfect, thank you |
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.