Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb ukbd: blink LEDs asynchronously at boot



details:   https://anonhg.NetBSD.org/src/rev/8601cb89b3d6
branches:  trunk
changeset: 989054:8601cb89b3d6
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Oct 11 00:00:03 2021 +0000

description:
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.

diffstat:

 sys/dev/usb/ukbd.c |  16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diffs (51 lines):

diff -r f66199130353 -r 8601cb89b3d6 sys/dev/usb/ukbd.c
--- a/sys/dev/usb/ukbd.c        Sun Oct 10 23:46:22 2021 +0000
+++ b/sys/dev/usb/ukbd.c        Mon Oct 11 00:00:03 2021 +0000
@@ -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 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 @@
        /* 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 @@
        }
 }
 
+Static void
+ukbd_delayed_leds_off(void *addr)
+{
+       struct ukbd_softc *sc = addr;
+
+       ukbd_set_leds(sc, 0);
+}
+
 void
 ukbd_delayed_decode(void *addr)
 {



Home | Main Index | Thread Index | Old Index