diff options
author | 2014-01-20 18:55:14 +0000 | |
---|---|---|
committer | 2014-01-20 18:55:14 +0000 | |
commit | 744b7621927f3af28373e306230cfd6a7b9e621a (patch) | |
tree | 2187662bf9a3af5e69634bd5cd9d4bdba6a7c7ad | |
parent | add ubcmtp, a USB driver for Broadcom multitouch trackpads found on (diff) | |
download | wireguard-openbsd-744b7621927f3af28373e306230cfd6a7b9e621a.tar.xz wireguard-openbsd-744b7621927f3af28373e306230cfd6a7b9e621a.zip |
call usbd_deactivate() for DVACT_DEACTIVATE
also check usbd_is_dying() when checking sc_status
requested by mpi@
-rw-r--r-- | sys/dev/usb/ubcmtp.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/dev/usb/ubcmtp.c b/sys/dev/usb/ubcmtp.c index 9e1708d190c..bd48fb8ab03 100644 --- a/sys/dev/usb/ubcmtp.c +++ b/sys/dev/usb/ubcmtp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ubcmtp.c,v 1.1 2014/01/20 18:27:46 jcs Exp $ */ +/* $OpenBSD: ubcmtp.c,v 1.2 2014/01/20 18:55:14 jcs Exp $ */ /* * Copyright (c) 2013-2014, joshua stein <jcs@openbsd.org> @@ -490,6 +490,7 @@ ubcmtp_activate(struct device *self, int act) ret = 0; if (sc->sc_wsmousedev != NULL) ret = config_deactivate(sc->sc_wsmousedev); + usbd_deactivate(sc->sc_udev); return (ret); } return (EOPNOTSUPP); @@ -503,6 +504,9 @@ ubcmtp_enable(void *v) if (sc->sc_status & UBCMTP_ENABLED) return (EBUSY); + if (usbd_is_dying(sc->sc_udev)) + return (EIO); + if (ubcmtp_raw_mode(sc, 1) != 0) { printf("%s: failed to enter raw mode\n", sc->sc_dev.dv_xname); return (1); @@ -520,7 +524,7 @@ ubcmtp_disable(void *v) { struct ubcmtp_softc *sc = v; - if (!(sc->sc_status & UBCMTP_ENABLED)) + if (usbd_is_dying(sc->sc_udev) || !(sc->sc_status & UBCMTP_ENABLED)) return; sc->sc_status &= ~UBCMTP_ENABLED; @@ -728,7 +732,7 @@ ubcmtp_tp_intr(struct usbd_xfer *xfer, void *priv, usbd_status status) u_int32_t pktlen; int i, diff = 0, finger = 0, fingers = 0, s, t; - if (!(sc->sc_status & UBCMTP_ENABLED)) + if (usbd_is_dying(sc->sc_udev) || !(sc->sc_status & UBCMTP_ENABLED)) return; if (status != USBD_NORMAL_COMPLETION) { @@ -835,7 +839,7 @@ ubcmtp_bt_intr(struct usbd_xfer *xfer, void *priv, usbd_status status) struct ubcmtp_button *pkt; u_int32_t len; - if (!(sc->sc_status & UBCMTP_ENABLED)) + if (usbd_is_dying(sc->sc_udev) || !(sc->sc_status & UBCMTP_ENABLED)) return; if (status != USBD_NORMAL_COMPLETION) { |