From a818e483013c955a0c0cb0481f857f6c7e5b4b7a Mon Sep 17 00:00:00 2001 From: anton Date: Tue, 31 Aug 2021 05:17:49 +0000 Subject: [PATCH] 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 Dell keyboard. --- sys/dev/usb/ucc.c | 8 ++++---- 1 file 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 @@ -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); -- 2.20.1