Page MenuHomeFreeBSD

hid_locate: do not ignore constant items.
ClosedPublic

Authored by wulf on Dec 23 2020, 9:13 PM.
Tags
None
Referenced Files
F163087661: D27747.id81842.diff
Sun, Jul 19, 11:30 PM
Unknown Object (File)
Sun, Jul 12, 12:15 AM
Unknown Object (File)
Fri, Jul 10, 6:12 AM
Unknown Object (File)
Wed, Jul 8, 12:19 AM
Unknown Object (File)
Jun 18 2026, 5:55 PM
Unknown Object (File)
Jun 18 2026, 12:40 PM
Unknown Object (File)
Jun 18 2026, 12:20 AM
Unknown Object (File)
Jun 17 2026, 11:56 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.