Date: Sun, 23 May 2021 22:44:09 GMT From: Vladimir Kondratyev <wulf@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 05ab03a31798 - main - ums(4): Do not stop USB xfers on FIFO close when evdev is still active Message-ID: <202105232244.14NMi9K8068162@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=05ab03a31798d4cc96c22a8f30b1d9a0d7a3dd35 commit 05ab03a31798d4cc96c22a8f30b1d9a0d7a3dd35 Author: Vladimir Kondratyev <wulf@FreeBSD.org> AuthorDate: 2021-05-23 22:38:53 +0000 Commit: Vladimir Kondratyev <wulf@FreeBSD.org> CommitDate: 2021-05-23 22:38:53 +0000 ums(4): Do not stop USB xfers on FIFO close when evdev is still active This fixes lose of evdev events after moused has been killed. While here use bitwise operations for UMS_EVDEV_OPENED flag. Reviewed by: hselasky MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30342 --- sys/dev/usb/input/ums.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/dev/usb/input/ums.c b/sys/dev/usb/input/ums.c index 6b7c3d526ad0..b9533221ca8a 100644 --- a/sys/dev/usb/input/ums.c +++ b/sys/dev/usb/input/ums.c @@ -380,7 +380,7 @@ tr_setup: /* check if we can put more data into the FIFO */ if (usb_fifo_put_bytes_max(sc->sc_fifo.fp[USB_FIFO_RX]) == 0) { #ifdef EVDEV_SUPPORT - if (sc->sc_evflags == 0) + if ((sc->sc_evflags & UMS_EVDEV_OPENED) == 0) break; #else break; @@ -858,7 +858,10 @@ ums_fifo_stop_read(struct usb_fifo *fifo) { struct ums_softc *sc = usb_fifo_softc(fifo); - ums_stop_rx(sc); +#ifdef EVDEV_SUPPORT + if ((sc->sc_evflags & UMS_EVDEV_OPENED) == 0) +#endif + ums_stop_rx(sc); } #if ((MOUSE_SYS_PACKETSIZE != 8) || \ @@ -945,7 +948,7 @@ ums_ev_open(struct evdev_dev *evdev) mtx_assert(&sc->sc_mtx, MA_OWNED); - sc->sc_evflags = UMS_EVDEV_OPENED; + sc->sc_evflags |= UMS_EVDEV_OPENED; if (sc->sc_fflags == 0) { ums_reset(sc); @@ -962,7 +965,7 @@ ums_ev_close(struct evdev_dev *evdev) mtx_assert(&sc->sc_mtx, MA_OWNED); - sc->sc_evflags = 0; + sc->sc_evflags &= ~UMS_EVDEV_OPENED; if (sc->sc_fflags == 0) ums_stop_rx(sc); @@ -984,7 +987,7 @@ ums_fifo_open(struct usb_fifo *fifo, int fflags) /* check for first open */ #ifdef EVDEV_SUPPORT - if (sc->sc_fflags == 0 && sc->sc_evflags == 0) + if (sc->sc_fflags == 0 && (sc->sc_evflags & UMS_EVDEV_OPENED) == 0) ums_reset(sc); #else if (sc->sc_fflags == 0)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105232244.14NMi9K8068162>