Date: Tue, 28 Jan 2014 09:55:08 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r261228 - head/sys/dev/usb/input Message-ID: <201401280955.s0S9t8pv005917@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Tue Jan 28 09:55:07 2014 New Revision: 261228 URL: http://svnweb.freebsd.org/changeset/base/261228 Log: 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. MFC after: 1 week Modified: head/sys/dev/usb/input/ukbd.c Modified: head/sys/dev/usb/input/ukbd.c ============================================================================== --- head/sys/dev/usb/input/ukbd.c Tue Jan 28 09:12:04 2014 (r261227) +++ head/sys/dev/usb/input/ukbd.c Tue Jan 28 09:55:07 2014 (r261228) @@ -473,7 +473,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]); } @@ -1319,6 +1320,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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401280955.s0S9t8pv005917>