svn commit: r359558 - stable/12/sys/dev/usb/input
Hans Petter Selasky
hselasky at FreeBSD.org
Thu Apr 2 07:41:36 UTC 2020
Author: hselasky
Date: Thu Apr 2 07:40:57 2020
New Revision: 359558
URL: https://svnweb.freebsd.org/changeset/base/359558
Log:
MFC r359439:
Evaluate modifier keys before the regular keys, so that if a modifier
key is pressed at the same time as a regular key, that means key with
modifier is output. Some automated USB keyboards like Yubikeys need this.
This fixes a regression issue after r357861.
Reported by: Adam McDougall <mcdouga9 at egr.msu.edu>
PR: 224592
PR: 233884
Sponsored by: Mellanox Technologies
Modified:
stable/12/sys/dev/usb/input/ukbd.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/dev/usb/input/ukbd.c
==============================================================================
--- stable/12/sys/dev/usb/input/ukbd.c Thu Apr 2 03:35:05 2020 (r359557)
+++ stable/12/sys/dev/usb/input/ukbd.c Thu Apr 2 07:40:57 2020 (r359558)
@@ -498,6 +498,21 @@ ukbd_interrupt(struct ukbd_softc *sc)
UKBD_LOCK_ASSERT();
+ /* Check for modifier key changes first */
+ for (key = 0xe0; key != 0xe8; key++) {
+ const uint64_t mask = 1ULL << (key % 64);
+ const uint64_t delta =
+ sc->sc_odata.bitmap[key / 64] ^
+ sc->sc_ndata.bitmap[key / 64];
+
+ if (delta & mask) {
+ if (sc->sc_odata.bitmap[key / 64] & mask)
+ ukbd_put_key(sc, key | KEY_RELEASE);
+ else
+ ukbd_put_key(sc, key | KEY_PRESS);
+ }
+ }
+
/* Check for key changes */
for (key = 0; key != UKBD_NKEYCODE; key++) {
const uint64_t mask = 1ULL << (key % 64);
@@ -508,6 +523,8 @@ ukbd_interrupt(struct ukbd_softc *sc)
if (mask == 1 && delta == 0) {
key += 63;
continue; /* skip empty areas */
+ } else if (ukbd_is_modifier_key(key)) {
+ continue;
} else if (delta & mask) {
if (sc->sc_odata.bitmap[key / 64] & mask) {
ukbd_put_key(sc, key | KEY_RELEASE);
@@ -517,9 +534,6 @@ ukbd_interrupt(struct ukbd_softc *sc)
sc->sc_repeat_key = 0;
} else {
ukbd_put_key(sc, key | KEY_PRESS);
-
- if (ukbd_is_modifier_key(key))
- continue;
sc->sc_co_basetime = sbinuptime();
sc->sc_delay = sc->sc_kbd.kb_delay1;
More information about the svn-src-stable
mailing list