svn commit: r261477 - stable/9/sys/dev/usb/input
Hans Petter Selasky
hselasky at FreeBSD.org
Tue Feb 4 09:06:07 UTC 2014
Author: hselasky
Date: Tue Feb 4 09:06:07 2014
New Revision: 261477
URL: http://svnweb.freebsd.org/changeset/base/261477
Log:
MFC r261228:
When detaching a [USB] keyboard, keys might still be pressed. Ensure
that all pressed keys are released before completing the USB keyboard
detach. This will prevent so-called "ghost-keys" from appearing after
that the USB device generating the key event(s) has been detached.
Modified:
stable/9/sys/dev/usb/input/ukbd.c
Directory Properties:
stable/9/sys/ (props changed)
stable/9/sys/dev/ (props changed)
Modified: stable/9/sys/dev/usb/input/ukbd.c
==============================================================================
--- stable/9/sys/dev/usb/input/ukbd.c Tue Feb 4 09:03:14 2014 (r261476)
+++ stable/9/sys/dev/usb/input/ukbd.c Tue Feb 4 09:06:07 2014 (r261477)
@@ -469,7 +469,8 @@ ukbd_get_key(struct ukbd_softc *sc, uint
|| (sc->sc_flags & UKBD_FLAG_POLLING) != 0,
("not polling in kdb or panic\n"));
- if (sc->sc_inputs == 0) {
+ if (sc->sc_inputs == 0 &&
+ (sc->sc_flags & UKBD_FLAG_GONE) == 0) {
/* start transfer, if not already started */
usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT]);
}
@@ -1300,6 +1301,18 @@ ukbd_detach(device_t dev)
usb_callout_stop(&sc->sc_callout);
+ /* kill any stuck keys */
+ if (sc->sc_flags & UKBD_FLAG_ATTACHED) {
+ /* stop receiving events from the USB keyboard */
+ usbd_transfer_stop(sc->sc_xfer[UKBD_INTR_DT]);
+
+ /* release all leftover keys, if any */
+ memset(&sc->sc_ndata, 0, sizeof(sc->sc_ndata));
+
+ /* process releasing of all keys */
+ ukbd_interrupt(sc);
+ }
+
ukbd_disable(&sc->sc_kbd);
#ifdef KBD_INSTALL_CDEV
More information about the svn-src-stable-9
mailing list