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

Documentation: Clarify HID_DESCRIPTOR_VENDOR documentation #146

cinderblock opened this issue Feb 10, 2019 · 2 comments

Documentation: Clarify HID_DESCRIPTOR_VENDOR documentation #146

cinderblock opened this issue Feb 10, 2019 · 2 comments


Copy link

I am working on a project trying to implement "vendor defined" HID data. I have it working sending 8 bytes of data in two directions but I can't seem to change the payload size as I want.

I'm using the HID_DESCRIPTOR_VENDOR macro but I'm finding the documentation a little confusing.

I understand that HID reports in general are quick confusing and I'm not looking for an explanation of that.

Specifically, I this extract from the docs is giving me pause:

The resulting report should be a uint8_t byte array of the specified length in both Device to Host (IN) and Host to Device (OUT) directions

Is the "specified length" the length of the resultant list of USB_Descriptor_HIDReport_Datatype_t?

How can a single length be specified in two places (IN and OUT)?

I'm also unclear on what each of the parameters does. The names DataINUsage and DataINUsage are relatively clear but not with NumBytes there too.

The GenericHID demo suggests NumBytes is actually what controls the size of the packets but I've had trouble changing that. It looks like another person has had similar confusion:

It's also not clear if I can mess with CollectionUsage but I suspect that is a deeper HID spec thing.

I've tried looking at the #defined of HID_DESCRIPTOR_VENDOR but that jumble is quite confusing (as expected from the HID spec).

Any pointers greatly appreciated.

Copy link

cinderblock commented Feb 10, 2019

Well, I stayed up getting into the USB HID specifications and tried a couple more things. I'm not sure what I was doing wrong before but I can now increase the packet size as expected. EDIT: scratching my head as now it doesn't seem to be working. I must be doing something else silly but I can't find it. Ugh. EDIT Again: I had somehow been using REPORT_SIZE for Endpoint0Size which can apparently only be a power of 2.

After reading the documentation excerpt again, I believe I understand it now. Some thoughts:

The resulting reports will be uint8_t byte arrays of NumBytes length in both directions.

The references to IN/OUT I understood to mean related to the DataINUsage and DataInUsage arguments. In my naivety on the USB spec, I did not realize "Usage" has specific meanings.

Copy link

Sorry for the late reply - I've been away on a cruise ship around New Zealand, no internet access for the last week and a half.

I agree, the documentation could use some clarification. I'll mark this on the backlog for when I have a little free time.

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

No branches or pull requests

2 participants