Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/fdt Read the initial key state at startup so we only...



details:   https://anonhg.NetBSD.org/src/rev/eb0610a77e2b
branches:  trunk
changeset: 825267:eb0610a77e2b
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Jul 06 14:01:38 2017 +0000

description:
Read the initial key state at startup so we only trigger events on state
changes. Prevents a misconfigured power button from shutting us down at
boot.

diffstat:

 sys/dev/fdt/gpiokeys.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 4ff524a32471 -r eb0610a77e2b sys/dev/fdt/gpiokeys.c
--- a/sys/dev/fdt/gpiokeys.c    Thu Jul 06 11:09:00 2017 +0000
+++ b/sys/dev/fdt/gpiokeys.c    Thu Jul 06 14:01:38 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gpiokeys.c,v 1.2 2015/12/16 19:33:55 jmcneill Exp $ */
+/* $NetBSD: gpiokeys.c,v 1.3 2017/07/06 14:01:38 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gpiokeys.c,v 1.2 2015/12/16 19:33:55 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gpiokeys.c,v 1.3 2017/07/06 14:01:38 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -128,6 +128,7 @@
                key->key_debounce = debounce;
                key->key_pin = fdtbus_gpio_acquire(child, "gpios",
                    GPIO_PIN_INPUT);
+               key->key_state = fdtbus_gpio_read(key->key_pin);
 
                key->key_pswitch.smpsw_name = key->key_label;
                switch (code) {



Home | Main Index | Thread Index | Old Index