summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Kondratyev <wulf@FreeBSD.org>2020-12-24 19:08:04 +0000
committerVladimir Kondratyev <wulf@FreeBSD.org>2020-12-24 19:08:04 +0000
commit30f34a519372ebce29c4439d0e6a7bc8c2df0566 (patch)
tree298bc7694564b8b1045930f1e601343eeb036f78
parent769935a4edf8a75805000900d44a66ad5d2eaabe (diff)
downloadsrc-test-30f34a519372ebce29c4439d0e6a7bc8c2df0566.tar.gz
src-test-30f34a519372ebce29c4439d0e6a7bc8c2df0566.zip
ukbd(4): Push LED events in ioctl handler rather than in xfer callback
If LED state is set through evdev interface, than asynchronous nature of USB transfer callback can lead to change of order of events echoed back to userland as it causes LED events to be echoed with some lag. Fix that with echoing of LED events synchronously in ioctl handler. Reviewed by: hselasky Obtained from: sysutils/iichid MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D27750
-rw-r--r--sys/dev/usb/input/ukbd.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c
index 1ab26ccfb2587..4f27bf95b948c 100644
--- a/sys/dev/usb/input/ukbd.c
+++ b/sys/dev/usb/input/ukbd.c
@@ -845,11 +845,6 @@ ukbd_set_leds_callback(struct usb_xfer *xfer, usb_error_t error)
if (!any)
break;
-#ifdef EVDEV_SUPPORT
- if (sc->sc_evdev != NULL)
- evdev_push_leds(sc->sc_evdev, sc->sc_leds);
-#endif
-
/* range check output report length */
len = sc->sc_led_size;
if (len > (UKBD_BUFFER_SIZE - 1))
@@ -1973,6 +1968,11 @@ ukbd_set_leds(struct ukbd_softc *sc, uint8_t leds)
UKBD_LOCK_ASSERT();
DPRINTF("leds=0x%02x\n", leds);
+#ifdef EVDEV_SUPPORT
+ if (sc->sc_evdev != NULL)
+ evdev_push_leds(sc->sc_evdev, leds);
+#endif
+
sc->sc_leds = leds;
sc->sc_flags |= UKBD_FLAG_SET_LEDS;