Module Name:    src
Committed By:   jmcneill
Date:           Mon Oct 11 00:00:03 UTC 2021

Modified Files:
        src/sys/dev/usb: ukbd.c

Log Message:
ukbd: blink LEDs asynchronously at boot

Instead of holding up boot by 400ms for each attached ukbd to blink the
keyboard LEDs, turn them on and set a callout to turn them off later.


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.153 src/sys/dev/usb/ukbd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/ukbd.c
diff -u src/sys/dev/usb/ukbd.c:1.152 src/sys/dev/usb/ukbd.c:1.153
--- src/sys/dev/usb/ukbd.c:1.152	Sat Aug  7 16:19:17 2021
+++ src/sys/dev/usb/ukbd.c	Mon Oct 11 00:00:03 2021
@@ -1,4 +1,4 @@
-/*      $NetBSD: ukbd.c,v 1.152 2021/08/07 16:19:17 thorpej Exp $        */
+/*      $NetBSD: ukbd.c,v 1.153 2021/10/11 00:00:03 jmcneill Exp $        */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.152 2021/08/07 16:19:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.153 2021/10/11 00:00:03 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -343,6 +343,7 @@ Static void	ukbd_delayed_decode(void *);
 Static int	ukbd_enable(void *, int);
 Static void	ukbd_set_leds(void *, int);
 Static void	ukbd_set_leds_task(void *);
+Static void	ukbd_delayed_leds_off(void *);
 
 Static int	ukbd_ioctl(void *, u_long, void *, int, struct lwp *);
 #if  defined(WSDISPLAY_COMPAT_RAWKBD) && defined(UKBD_REPEAT)
@@ -486,8 +487,7 @@ ukbd_attach(device_t parent, device_t se
 	/* Flash the leds; no real purpose, just shows we're alive. */
 	ukbd_set_leds(sc, WSKBD_LED_SCROLL | WSKBD_LED_NUM | WSKBD_LED_CAPS
 			| WSKBD_LED_COMPOSE);
-	usbd_delay_ms(uha->parent->sc_udev, 400);
-	ukbd_set_leds(sc, 0);
+	callout_reset(&sc->sc_delay, mstohz(400), ukbd_delayed_leds_off, sc);
 
 	sc->sc_wskbddev = config_found(self, &a, wskbddevprint, CFARGS_NONE);
 
@@ -706,6 +706,14 @@ ukbd_intr(struct uhidev *addr, void *ibu
 	}
 }
 
+Static void
+ukbd_delayed_leds_off(void *addr)
+{
+	struct ukbd_softc *sc = addr;
+
+	ukbd_set_leds(sc, 0);
+}
+
 void
 ukbd_delayed_decode(void *addr)
 {

Reply via email to