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)
Dec 20 2023, 1:21 AM
Unknown Object (File)
Nov 24 2023, 4:51 PM
Unknown Object (File)
Nov 21 2023, 4:14 PM
Unknown Object (File)
Nov 15 2023, 11:44 PM
Unknown Object (File)
Nov 13 2023, 7:54 PM
Unknown Object (File)
Nov 11 2023, 8:00 PM
Unknown Object (File)
Nov 8 2023, 3:57 AM
Unknown Object (File)
Nov 6 2023, 5:36 PM
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.