Page MenuHomeFreeBSD

Increase "Report Count" limit in HID descriptor parser
ClosedPublic

Authored by wulf on Jul 19 2018, 11:09 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Oct 30, 3:30 PM
Unknown Object (File)
Mon, Oct 21, 6:22 AM
Unknown Object (File)
Oct 4 2024, 11:01 AM
Unknown Object (File)
Oct 4 2024, 8:00 AM
Unknown Object (File)
Jul 28 2024, 3:03 PM
Unknown Object (File)
Jul 28 2024, 1:49 PM
Unknown Object (File)
Jul 19 2024, 9:40 PM
Unknown Object (File)
Jul 19 2024, 5:59 AM
Subscribers

Details

Summary

Increase "Report Count" value limit in HID descriptor parser from 255 to 256 to fix usage/report size calculation of Microsoft`s "Touch Hardware Quality Assurance" certificate blob[1] found in many touchscreens.

Some devices like WaveShare touchscreens require reading of THQA report at initialization stage to start event generation so it would be nice to provide usbd_req_get_report() with proper report length. Also it should fix infamous "hid_get_item: Number of items(256) truncated to 255" boot message.

It may make sense to bump the limit to 1k or even more to fix e.g. some gaming keyboards HID-descriptor parsing[2]

While here, join several "c->flags = dval" lines in to single line.

[1] https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/touch-and-pen-support
[2] https://unix.stackexchange.com/questions/401722/new-trueos-install-keyboard-doesnt-work-right

Test Plan

Attach touchscreen and see "hid_get_item: Number of items(256) truncated to 255" warning gone.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Looks good! Maybe you should bump the __FreeBSD_version due to changing a structure size. What about MFC-ing?

This revision is now accepted and ready to land.Jul 20 2018, 8:30 AM

Did you check that enumerating loops of loc.count use a 32-bit variable aswell. I'm not sure if there are any such in the kernel.

Maybe you should bump the __FreeBSD_version due to changing a structure size.

No need. hid_data is private structure

What about MFC-ing?

Will do

Did you check that enumerating loops of loc.count use a 32-bit variable aswell. I'm not sure if there are any such in the kernel.

All existing in-tree drivers except wmt(4) use hid_locate() wrapper which is still artificially limited to 255 usages of the same type with defining of "index" input parameter as uint8_t. As these drivers call hid_locate() with index=0 or index=1 only, I see no reason to break KPI with extending the limit just now. Internally hid_locate() uses 32-bit variables so possible growth of number of returned usages should not do any harm.

This revision was automatically updated to reflect the committed changes.