From 817e6995a19cb6f35851d0191bb1099a73d98bb9 Mon Sep 17 00:00:00 2001 From: Vladimir Kondratyev Date: Sun, 12 Apr 2026 21:09:23 +0300 Subject: [PATCH] wsp(4): Make evdev interface operational if sysmouse one is not opened Before this change evdev interface sent only copy of data sent through the sysmouse interface. It worked as /dev/wsp0 device node was automatcaly opened by devd(8) with starting of moused(8). Starting with 15.0 moused(8) does not open sysmouse interface by default thus making wsp(4) device dysfunctional. Fix it with adding extra checks of interfaces state. MFC after: 1 week --- sys/dev/usb/input/wsp.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/dev/usb/input/wsp.c b/sys/dev/usb/input/wsp.c index a78fac49491..2d7e3b796b1 100644 --- a/sys/dev/usb/input/wsp.c +++ b/sys/dev/usb/input/wsp.c @@ -1068,6 +1068,10 @@ wsp_intr_callback(struct usb_xfer *xfer, usb_error_t error) if (evdev_rcpt_mask & EVDEV_RCPT_HW_MOUSE) { evdev_push_key(sc->sc_evdev, BTN_LEFT, ibt); evdev_sync(sc->sc_evdev); + if ((sc->sc_fflags & FREAD) == 0 || + usb_fifo_put_bytes_max( + sc->sc_fifo.fp[USB_FIFO_RX]) == 0) + goto tr_setup; } #endif sc->sc_status.flags &= ~MOUSE_POSCHANGED; @@ -1357,7 +1361,12 @@ wsp_intr_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: tr_setup: /* check if we can put more data into the FIFO */ - if (usb_fifo_put_bytes_max( + if ( +#ifdef EVDEV_SUPPORT + ((evdev_rcpt_mask & EVDEV_RCPT_HW_MOUSE) != 0 && + (sc->sc_state & WSP_EVDEV_OPENED) != 0) || +#endif + usb_fifo_put_bytes_max( sc->sc_fifo.fp[USB_FIFO_RX]) != 0) { usbd_xfer_set_frame_len(xfer, 0, sc->tp_datalen);