hid_locate: do not ignore constant items.

hid_locate() currently ignores 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]. Such an items are unconditionally treated as
byte-alignment padding. While that may be right decision for input and
output reports that is wrong for features reports. Feature reports can
contain constant capabilities e.g. 'Contact Count Maximum'.
See: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=232040

Remove check for constant from hid_locate() to make possible parsing of
such a reports.

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

Reviewed by:	hselasky
Obtained from:	sysutils/iichid
Differential Revision:	https://reviews.freebsd.org/D27747
This commit is contained in:
Vladimir Kondratyev 2020-12-24 14:46:24 +03:00 committed by Vladimir Kondratyev
parent 5cc52631b3
commit 3f27092854

View File

@ -622,7 +622,7 @@ hid_locate(const void *desc, usb_size_t size, int32_t u, enum hid_kind k,
struct hid_item h;
for (d = hid_start_parse(desc, size, 1 << k); hid_get_item(d, &h);) {
if (h.kind == k && !(h.flags & HIO_CONST) && h.usage == u) {
if (h.kind == k && h.usage == u) {
if (index--)
continue;
if (loc != NULL)