summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorAnton Lindqvist <anton@cvs.openbsd.org>2021-08-31 05:17:50 +0000
committerAnton Lindqvist <anton@cvs.openbsd.org>2021-08-31 05:17:50 +0000
commitc667dfd4631414f6c8a2a63fcaa9479740fc5f48 (patch)
tree283aae05f59a299948af7e55de87931c3d68a10c /sys/dev
parenta4c5b97a26e17ce681d3e773d7013f848e49ada2 (diff)
In enumerating mode, calculate the bit offset using the HID input
location as the product of the corresponding Report Count and Report Size can be greater than one. Fixes Richard Toohey's <richardjtoohey at gmail dot com> Dell keyboard.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/ucc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/usb/ucc.c b/sys/dev/usb/ucc.c
index 39e588dee76..ed10412b70a 100644
--- a/sys/dev/usb/ucc.c
+++ b/sys/dev/usb/ucc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ucc.c,v 1.20 2021/08/31 05:16:45 anton Exp $ */
+/* $OpenBSD: ucc.c,v 1.21 2021/08/31 05:17:49 anton Exp $ */
/*
* Copyright (c) 2021 Anton Lindqvist <anton@openbsd.org>
@@ -859,6 +859,7 @@ ucc_hid_parse(struct ucc_softc *sc, void *desc, int descsiz)
enum { OFFSET, LENGTH } istate = OFFSET;
struct hid_item hi;
struct hid_data *hd;
+ u_int bit = 0;
int error = 0;
int nsyms = nitems(ucc_keysyms);
int repid = sc->sc_hdev.sc_report_id;
@@ -897,8 +898,6 @@ ucc_hid_parse(struct ucc_softc *sc, void *desc, int descsiz)
hd = hid_start_parse(desc, descsiz, hid_input);
while (hid_get_item(hd, &hi)) {
- u_int bit;
-
if (hi.report_ID != repid || hi.kind != hid_input)
continue;
@@ -931,10 +930,11 @@ ucc_hid_parse(struct ucc_softc *sc, void *desc, int descsiz)
break;
}
- bit = sc->sc_nusages++;
error = ucc_add_key(sc, HID_GET_USAGE(hi.usage), bit);
if (error)
break;
+ sc->sc_nusages++;
+ bit += hi.loc.size * hi.loc.count;
}
hid_end_parse(hd);