From owner-dev-commits-src-main@freebsd.org Thu Jan 7 23:21:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C0914DE9CF; Thu, 7 Jan 2021 23:20:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DBj050s1nz4SwB; Thu, 7 Jan 2021 23:20:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B960193DF; Thu, 7 Jan 2021 23:20:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKqlW063460; Thu, 7 Jan 2021 23:20:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKqlU063459; Thu, 7 Jan 2021 23:20:52 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:52 GMT Message-Id: <202101072320.107NKqlU063459@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 3f2709285421 - main - hid_locate: do not ignore constant items. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3f270928542192dd1cb14429290ef97ab3f7fa94 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:21:00 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=3f270928542192dd1cb14429290ef97ab3f7fa94 commit 3f270928542192dd1cb14429290ef97ab3f7fa94 Author: Vladimir Kondratyev AuthorDate: 2020-12-24 11:46:24 +0000 Commit: Vladimir Kondratyev 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)