static int sunkbd_configure(int flags) { struct sunkbd_softc *sc; if (uart_cpu_getdev(UART_DEV_KEYBOARD, &uart_keyboard)) return (0); 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); sc = &sunkbd_softc; callout_init(&sc->sc_repeat_callout, 0); sc->sc_repeat_key = -1; sc->sc_repeating = 0; kbd_init_struct(&sc->sc_kbd, "sunkbd", KB_OTHER, 0, 0, 0, 0); kbd_set_maps(&sc->sc_kbd, &keymap_sun_us_unix_kbd, &accentmap_sun_us_unix_kbd, fkey_tab, sizeof(fkey_tab) / sizeof(fkey_tab[0])); sc->sc_mode = K_XLATE; kbd_register(&sc->sc_kbd); sc->sc_sysdev = &uart_keyboard; return (0); }
static int sunkbd_configure(int flags) { struct sunkbd_softc *sc; /* * We are only prepared to be used for the high-level console * when the keyboard is both configured and attached. */ if (!(flags & KB_CONF_PROBE_ONLY)) { if (KBD_IS_INITIALIZED(&sunkbd_softc.sc_kbd)) goto found; else return (0); } if (uart_cpu_getdev(UART_DEV_KEYBOARD, &uart_keyboard)) return (0); if (uart_probe(&uart_keyboard)) return (0); uart_init(&uart_keyboard); uart_keyboard.type = UART_DEV_KEYBOARD; uart_keyboard.attach = sunkbd_attach; uart_add_sysdev(&uart_keyboard); if (sunkbd_probe_keyboard(&uart_keyboard) != KB_SUN4) return (0); sc = &sunkbd_softc; callout_init(&sc->sc_repeat_callout, 0); sunkbd_clear_state(&sc->sc_kbd); #if defined(SUNKBD_EMULATE_ATKBD) kbd_init_struct(&sc->sc_kbd, SUNKBD_DRIVER_NAME, KB_101, 0, 0, 0, 0); kbd_set_maps(&sc->sc_kbd, &key_map, &accent_map, fkey_tab, sizeof(fkey_tab) / sizeof(fkey_tab[0])); #else kbd_init_struct(&sc->sc_kbd, SUNKBD_DRIVER_NAME, KB_OTHER, 0, 0, 0, 0); kbd_set_maps(&sc->sc_kbd, &keymap_sun_us_unix_kbd, &accentmap_sun_us_unix_kbd, fkey_tab, sizeof(fkey_tab) / sizeof(fkey_tab[0])); #endif sc->sc_mode = K_XLATE; kbd_register(&sc->sc_kbd); sc->sc_sysdev = &uart_keyboard; found: /* Return number of found keyboards. */ return (1); }