diff options
author | Vladimir Kondratyev <wulf@FreeBSD.org> | 2022-11-18 23:54:46 +0000 |
---|---|---|
committer | Vladimir Kondratyev <wulf@FreeBSD.org> | 2022-11-18 23:54:46 +0000 |
commit | 183088934a6c4384e45ac6d01c04754e0d7a991c (patch) | |
tree | b3cbed3bdda97882020d0ea3e8d22445d886870b | |
parent | d487cba33d777efb9f6f7d7967ad2eaa629bcb90 (diff) | |
download | src-183088934a6c4384e45ac6d01c04754e0d7a991c.tar.gz src-183088934a6c4384e45ac6d01c04754e0d7a991c.zip |
-rw-r--r-- | sys/dev/atkbdc/atkbd.c | 3 | ||||
-rw-r--r-- | sys/dev/evdev/evdev.c | 2 | ||||
-rw-r--r-- | sys/dev/gpio/gpiokeys.c | 4 | ||||
-rw-r--r-- | sys/dev/hid/hkbd.c | 4 | ||||
-rw-r--r-- | sys/dev/hyperv/input/hv_kbd.c | 2 | ||||
-rw-r--r-- | sys/dev/kbdmux/kbdmux.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/input/ukbd.c | 4 |
7 files changed, 22 insertions, 0 deletions
diff --git a/sys/dev/atkbdc/atkbd.c b/sys/dev/atkbdc/atkbd.c index 3e261115527b..eb76882bf9f7 100644 --- a/sys/dev/atkbdc/atkbd.c +++ b/sys/dev/atkbdc/atkbd.c @@ -703,6 +703,9 @@ next_code: evdev_sync(state->ks_evdev); } } + + if (state->ks_evdev != NULL && evdev_is_grabbed(state->ks_evdev)) + return (NOKEY); #endif /* return the byte as is for the K_RAW mode */ diff --git a/sys/dev/evdev/evdev.c b/sys/dev/evdev/evdev.c index a0a039f0b691..2bb365125b5a 100644 --- a/sys/dev/evdev/evdev.c +++ b/sys/dev/evdev/evdev.c @@ -1097,6 +1097,8 @@ evdev_release_client(struct evdev_dev *evdev, struct evdev_client *client) bool evdev_is_grabbed(struct evdev_dev *evdev) { + if (kdb_active || SCHEDULER_STOPPED()) + return (false); /* * The function is intended to be called from evdev-unrelated parts of * code like syscons-compatible parts of mouse and keyboard drivers. diff --git a/sys/dev/gpio/gpiokeys.c b/sys/dev/gpio/gpiokeys.c index bea5844bad5e..36746923f01b 100644 --- a/sys/dev/gpio/gpiokeys.c +++ b/sys/dev/gpio/gpiokeys.c @@ -194,6 +194,10 @@ gpiokeys_key_event(struct gpiokeys_softc *sc, struct gpiokey *key, int pressed) evdev_push_key(sc->sc_evdev, key->evcode, pressed); evdev_sync(sc->sc_evdev); } + if (evdev_is_grabbed(sc->sc_evdev)) { + GPIOKEYS_UNLOCK(sc); + return; + } #endif if (key->keycode != GPIOKEY_NONE) { code = key->keycode & SCAN_KEYCODE_MASK; diff --git a/sys/dev/hid/hkbd.c b/sys/dev/hid/hkbd.c index 6fee3b0094a5..09339a762679 100644 --- a/sys/dev/hid/hkbd.c +++ b/sys/dev/hid/hkbd.c @@ -391,6 +391,8 @@ hkbd_put_key(struct hkbd_softc *sc, uint32_t key) if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && sc->sc_evdev != NULL) evdev_push_event(sc->sc_evdev, EV_KEY, evdev_hid2key(KEY_INDEX(key)), !(key & KEY_RELEASE)); + if (sc->sc_evdev != NULL && evdev_is_grabbed(sc->sc_evdev)) + return; #endif tail = (sc->sc_inputtail + 1) % HKBD_IN_BUF_SIZE; @@ -541,6 +543,8 @@ hkbd_interrupt(struct hkbd_softc *sc) #ifdef EVDEV_SUPPORT if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && sc->sc_evdev != NULL) evdev_sync(sc->sc_evdev); + if (sc->sc_evdev != NULL && evdev_is_grabbed(sc->sc_evdev)) + return; #endif /* wakeup keyboard system */ diff --git a/sys/dev/hyperv/input/hv_kbd.c b/sys/dev/hyperv/input/hv_kbd.c index 53aacda7fbcb..ea1a8b883fbb 100644 --- a/sys/dev/hyperv/input/hv_kbd.c +++ b/sys/dev/hyperv/input/hv_kbd.c @@ -340,6 +340,8 @@ next_code: evdev_sync(sc->ks_evdev); } } + if (sc->ks_evdev != NULL && evdev_is_grabbed(sc->ks_evdev)) + return (NOKEY); #endif ++kbd->kb_count; DEBUG_HVKBD(kbd, "read scan: 0x%x\n", scancode); diff --git a/sys/dev/kbdmux/kbdmux.c b/sys/dev/kbdmux/kbdmux.c index 3bbdc78b7c1a..b70e956830e5 100644 --- a/sys/dev/kbdmux/kbdmux.c +++ b/sys/dev/kbdmux/kbdmux.c @@ -715,6 +715,9 @@ next_code: evdev_sync(state->ks_evdev); } } + + if (state->ks_evdev != NULL && evdev_is_grabbed(state->ks_evdev)) + return (NOKEY); #endif /* return the byte as is for the K_RAW mode */ diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c index 4353888505da..c8658f9b62da 100644 --- a/sys/dev/usb/input/ukbd.c +++ b/sys/dev/usb/input/ukbd.c @@ -394,6 +394,8 @@ ukbd_put_key(struct ukbd_softc *sc, uint32_t key) if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && sc->sc_evdev != NULL) evdev_push_event(sc->sc_evdev, EV_KEY, evdev_hid2key(KEY_INDEX(key)), !(key & KEY_RELEASE)); + if (sc->sc_evdev != NULL && evdev_is_grabbed(sc->sc_evdev)) + return; #endif if (sc->sc_inputs < UKBD_IN_BUF_SIZE) { @@ -562,6 +564,8 @@ ukbd_interrupt(struct ukbd_softc *sc) #ifdef EVDEV_SUPPORT if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && sc->sc_evdev != NULL) evdev_sync(sc->sc_evdev); + if (sc->sc_evdev != NULL && evdev_is_grabbed(sc->sc_evdev)) + return; #endif /* wakeup keyboard system */ |