Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jun 2021 22:02:48 GMT
From:      Vladimir Kondratyev <wulf@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: a4a738ba7575 - stable/13 - ums(4): Do not stop USB xfers on FIFO close when evdev is still active
Message-ID:  <202106132202.15DM2m7E074815@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=a4a738ba757571088143c8c781d187b71c3a672d

commit a4a738ba757571088143c8c781d187b71c3a672d
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2021-05-23 22:38:53 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2021-06-13 21:59:18 +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
    Differential revision:  https://reviews.freebsd.org/D30342
    
    (cherry picked from commit 05ab03a31798d4cc96c22a8f30b1d9a0d7a3dd35)
---
 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 3d57a6c7be5d..cce1831287e4 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?202106132202.15DM2m7E074815>