git: 7683f19cbf40 - stable/13 - hkbd(4): Reduce diff with ukbd(4)
Vladimir Kondratyev
wulf at FreeBSD.org
Thu Sep 23 01:03:57 UTC 2021
The branch stable/13 has been updated by wulf:
URL: https://cgit.FreeBSD.org/src/commit/?id=7683f19cbf40cd757bf514617a9dcbe938f2989a
commit 7683f19cbf40cd757bf514617a9dcbe938f2989a
Author: Vladimir Kondratyev <wulf at FreeBSD.org>
AuthorDate: 2021-09-09 21:39:05 +0000
Commit: Vladimir Kondratyev <wulf at FreeBSD.org>
CommitDate: 2021-09-23 00:57:34 +0000
hkbd(4): Reduce diff with ukbd(4)
(cherry picked from commit 3ef9023f935ff721f72ed44cf26911b9af72dba1)
---
sys/dev/hid/hkbd.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/sys/dev/hid/hkbd.c b/sys/dev/hid/hkbd.c
index 55eba6d321ea..729602b12f3a 100644
--- a/sys/dev/hid/hkbd.c
+++ b/sys/dev/hid/hkbd.c
@@ -657,7 +657,6 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len)
uint32_t i;
uint8_t id = 0;
uint8_t modifiers;
- int offset;
HKBD_LOCK_ASSERT(sc);
@@ -709,13 +708,15 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len)
} else if (id != sc->sc_id_loc_key[i]) {
continue; /* invalid HID ID */
} else if (i == 0) {
- offset = sc->sc_loc_key[0].count;
- if (offset < 0 || offset > len)
- offset = len;
- while (offset--) {
+ struct hid_location tmp_loc = sc->sc_loc_key[0];
+ /* range check array size */
+ if (tmp_loc.count > HKBD_NKEYCODE)
+ tmp_loc.count = HKBD_NKEYCODE;
+ while (tmp_loc.count--) {
uint32_t key =
- hid_get_data(buf + offset, len - offset,
- &sc->sc_loc_key[i]);
+ hid_get_udata(buf, len, &tmp_loc);
+ /* advance to next location */
+ tmp_loc.pos += tmp_loc.size;
if (key == KEY_ERROR) {
DPRINTF("KEY_ERROR\n");
sc->sc_ndata = sc->sc_odata;
More information about the dev-commits-src-all
mailing list