Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Feb 2021 10:19:16 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: e8eded55f237 - stable/12 - ukbd(4): Push LED events in ioctl handler rather than in xfer callback
Message-ID:  <202102051019.115AJGBr029947@gitrepo.freebsd.org>

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

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

commit e8eded55f2372406e872282914a48adcba5dfeef
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2020-12-24 19:08:04 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2021-02-05 10:17:52 +0000

    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
    
    (cherry picked from commit 30f34a519372ebce29c4439d0e6a7bc8c2df0566)
---
 sys/dev/usb/input/ukbd.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c
index cf1c11069ffc..e438a1521f97 100644
--- a/sys/dev/usb/input/ukbd.c
+++ b/sys/dev/usb/input/ukbd.c
@@ -846,11 +846,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))
@@ -1978,6 +1973,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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102051019.115AJGBr029947>