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
This commit is contained in:
parent
a660948b7b
commit
05ab03a317
@ -380,7 +380,7 @@ ums_intr_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
/* 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,6 +858,9 @@ ums_fifo_stop_read(struct usb_fifo *fifo)
|
||||
{
|
||||
struct ums_softc *sc = usb_fifo_softc(fifo);
|
||||
|
||||
#ifdef EVDEV_SUPPORT
|
||||
if ((sc->sc_evflags & UMS_EVDEV_OPENED) == 0)
|
||||
#endif
|
||||
ums_stop_rx(sc);
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user