summaryrefslogtreecommitdiffstats
path: root/sys/dev/uart
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2005-01-31 04:31:22 +0000
committermarcel <marcel@FreeBSD.org>2005-01-31 04:31:22 +0000
commite9cee1ffe865dac9398097ebf0f27fdebac55bfd (patch)
tree1e8709b72c23467645b10189b918a1c1a88bdfea /sys/dev/uart
parent05611a581a26f3ff7d8adaa398616eb3b3141305 (diff)
downloadFreeBSD-src-e9cee1ffe865dac9398097ebf0f27fdebac55bfd.zip
FreeBSD-src-e9cee1ffe865dac9398097ebf0f27fdebac55bfd.tar.gz
Add the keyboard system device before we probe for the keyboard.
The presence or absence of a keyboard does not change whether an UART is designed as a keyboard port or not and thus whether we can use the port as a TTY or not. We now call sunkbd_attach() even when we didn't previously find a keyboard. Emit a useful message stating that no keyboard was found, but don't do anything else. MFC after: 5 days
Diffstat (limited to 'sys/dev/uart')
-rw-r--r--sys/dev/uart/uart_kbd_sun.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/dev/uart/uart_kbd_sun.c b/sys/dev/uart/uart_kbd_sun.c
index 0525418..0349659 100644
--- a/sys/dev/uart/uart_kbd_sun.c
+++ b/sys/dev/uart/uart_kbd_sun.c
@@ -194,12 +194,14 @@ sunkbd_configure(int flags)
if (uart_probe(&uart_keyboard))
return (0);
uart_init(&uart_keyboard);
- if (sunkbd_probe_keyboard(&uart_keyboard) == -1)
- return (0);
+
uart_keyboard.type = UART_DEV_KEYBOARD;
uart_keyboard.attach = sunkbd_attach;
uart_add_sysdev(&uart_keyboard);
+ if (sunkbd_probe_keyboard(&uart_keyboard) == -1)
+ return (0);
+
sc = &sunkbd_softc;
callout_init(&sc->sc_repeat_callout, 0);
sc->sc_repeat_key = -1;
@@ -221,6 +223,15 @@ static int
sunkbd_attach(struct uart_softc *sc)
{
+ /*
+ * Don't attach if we didn't probe the keyboard. Note that
+ * the UART is still marked as a system device in that case.
+ */
+ if (sunkbd_softc.sc_sysdev == NULL) {
+ device_printf(sc->sc_dev, "keyboard not present\n");
+ return (0);
+ }
+
if (sc->sc_sysdev != NULL) {
sunkbd_softc.sc_uart = sc;
OpenPOWER on IntegriCloud