Page MenuHomeFreeBSD

hid_locate: do not ignore constant items.
ClosedPublic

Authored by wulf on Dec 23 2020, 9:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 17, 8:23 AM
Unknown Object (File)
Mar 7 2024, 6:30 PM
Unknown Object (File)
Dec 23 2023, 1:59 AM
Unknown Object (File)
Dec 11 2023, 1:43 AM
Unknown Object (File)
Sep 12 2023, 8:53 PM
Unknown Object (File)
Aug 28 2023, 2:43 AM
Unknown Object (File)
Aug 14 2023, 9:05 AM
Unknown Object (File)
May 9 2023, 11:35 PM
Subscribers
None

Details

Summary

hid_locate() currently skips all HID items which tagged as constant,
i.e. bit 0 of main item data is set to 1. See p.6.2.2.4 of hid1_11.pdf [1].
It looks like such an items are treated as padding, but that is wrong. They
can be a features, see: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=232040

As p.6.2.2.9 of hid1_11.pdf clearly states: "Reports can be padded to
byte-align fields by declaring the appropriately sized main item and not
declaring a usage for the main item.", we should remove check for constant
from hid_locate(). Comparing of item usage is enough.

[1] https://www.usb.org/sites/default/files/documents/hid1_11.pdf

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

wulf requested review of this revision.Dec 23 2020, 9:13 PM
wulf created this revision.
This revision is now accepted and ready to land.Dec 24 2020, 11:29 AM

Really, Summary is slightly misleading. Const items can be used as byte-padding items too, but we can't blindly count on it. Will try to write it better.

This revision was automatically updated to reflect the committed changes.