Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/evbarm/fdt Don't call ukbd_cnattach() unconditional...



details:   https://anonhg.NetBSD.org/src/rev/08ad06d0e5e1
branches:  trunk
changeset: 836093:08ad06d0e5e1
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Wed Sep 26 09:06:48 2018 +0000

description:
Don't call ukbd_cnattach() unconditionally, this causes a non-functionnal
keyboard if there is a framebuffer but the console is serial only.
Instead add a fdt_device_register_post_config() callback, which checks
if the just-attached wsdisplay is the console, and calls ukbd_cnattach()
in this case.
OK jmcneill@

diffstat:

 sys/arch/evbarm/fdt/fdt_machdep.c |  26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diffs (82 lines):

diff -r 30f3944d6e24 -r 08ad06d0e5e1 sys/arch/evbarm/fdt/fdt_machdep.c
--- a/sys/arch/evbarm/fdt/fdt_machdep.c Wed Sep 26 09:04:12 2018 +0000
+++ b/sys/arch/evbarm/fdt/fdt_machdep.c Wed Sep 26 09:06:48 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_machdep.c,v 1.38 2018/09/22 11:58:19 jmcneill Exp $ */
+/* $NetBSD: fdt_machdep.c,v 1.39 2018/09/26 09:06:48 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.38 2018/09/22 11:58:19 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.39 2018/09/26 09:06:48 bouyer Exp $");
 
 #include "opt_machdep.h"
 #include "opt_bootconfig.h"
@@ -38,6 +38,7 @@
 #include "opt_cpuoptions.h"
 
 #include "ukbd.h"
+#include "wsdisplay.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -84,6 +85,9 @@
 #if NUKBD > 0
 #include <dev/usb/ukbdvar.h>
 #endif
+#if NWSDISPLAY > 0
+#include <dev/wscons/wsdisplayvar.h>
+#endif
 
 #ifdef MEMORY_DISK_DYNAMIC
 #include <dev/md.h>
@@ -116,6 +120,7 @@
 
 static void fdt_update_stdout_path(void);
 static void fdt_device_register(device_t, void *);
+static void fdt_device_register_post_config(device_t, void *);
 static void fdt_cpu_rootconf(void);
 static void fdt_reset(void);
 static void fdt_powerdown(void);
@@ -428,6 +433,7 @@
        cpu_reset_address = fdt_reset;
        cpu_powerdown_address = fdt_powerdown;
        evbarm_device_register = fdt_device_register;
+       evbarm_device_register_post_config = fdt_device_register_post_config;
        evbarm_cpu_rootconf = fdt_cpu_rootconf;
 
        /* Talk to the user */
@@ -541,10 +547,6 @@
 
        cons->consinit(&faa, uart_freq);
 
-#if NUKBD > 0
-       ukbd_cnattach();        /* allow USB keyboard to become console */
-#endif
-
        initialized = true;
 }
 
@@ -626,6 +628,18 @@
 }
 
 static void
+fdt_device_register_post_config(device_t self, void *aux)
+{
+#if NUKBD > 0 && NWSDISPLAY > 0
+       if (device_is_a(self, "wsdisplay")) {
+               struct wsdisplay_softc *sc = device_private(self);
+               if (wsdisplay_isconsole(sc))
+                       ukbd_cnattach();
+       }
+#endif
+}
+
+static void
 fdt_cpu_rootconf(void)
 {
        device_t dev;



Home | Main Index | Thread Index | Old Index