git: 3f2709285421 - main - hid_locate: do not ignore constant items.

Vladimir Kondratyev wulf at FreeBSD.org
Thu Jan 7 23:21:01 UTC 2021


The branch main has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=3f270928542192dd1cb14429290ef97ab3f7fa94

commit 3f270928542192dd1cb14429290ef97ab3f7fa94
Author:     Vladimir Kondratyev <vladimir at kondratyev.su>
AuthorDate: 2020-12-24 11:46:24 +0000
Commit:     Vladimir Kondratyev <wulf at FreeBSD.org>
CommitDate: 2021-01-07 23:18:41 +0000

    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
---
 sys/dev/usb/usb_hid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/usb/usb_hid.c b/sys/dev/usb/usb_hid.c
index adba8e812417..dd0c8d4b42ac 100644
--- a/sys/dev/usb/usb_hid.c
+++ b/sys/dev/usb/usb_hid.c
@@ -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)


More information about the dev-commits-src-all mailing list