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
This commit is contained in:
parent
2554d6b9b4
commit
a2e25ee10d
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user