diff --git a/sys/dev/sun/kbd.c b/sys/dev/sun/kbd.c index 98e36094475b..037e444b95ad 100644 --- a/sys/dev/sun/kbd.c +++ b/sys/dev/sun/kbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: kbd.c,v 1.45 2005/04/29 10:49:26 martin Exp $ */ +/* $NetBSD: kbd.c,v 1.46 2005/05/16 16:23:57 martin Exp $ */ /* * Copyright (c) 1992, 1993 @@ -47,7 +47,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.45 2005/04/29 10:49:26 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.46 2005/05/16 16:23:57 martin Exp $"); #include #include @@ -74,6 +74,10 @@ __KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.45 2005/04/29 10:49:26 martin Exp $"); #include #include +#if NWSKBD > 0 +#include "opt_wsdisplay_compat.h" +#endif + #include "locators.h" extern struct cfdriver kbd_cd; @@ -949,10 +953,16 @@ static void kbd_input_wskbd(struct kbd_softc *k, int code) { int type, key; + u_char buf; - type = KEY_UP(code) ? WSCONS_EVENT_KEY_UP : WSCONS_EVENT_KEY_DOWN; - key = KEY_CODE(code); - wskbd_input(k->k_wskbd, type, key); + if (k->k_wsraw) { + buf = code; + wskbd_rawinput(k->k_wskbd, &buf, 1); + } else { + type = KEY_UP(code) ? WSCONS_EVENT_KEY_UP : WSCONS_EVENT_KEY_DOWN; + key = KEY_CODE(code); + wskbd_input(k->k_wskbd, type, key); + } } int @@ -1011,7 +1021,9 @@ wssunkbd_ioctl(v, cmd, data, flag, p) switch (cmd) { case WSKBDIO_GTYPE: - *(int *)data = WSKBD_TYPE_SUN5; + /* we can't tell 4 from 5 or 6 */ + *(int *)data = k->k_state.kbd_id < KB_SUN4 ? + WSKBD_TYPE_SUN : WSKBD_TYPE_SUN5; return (0); case WSKBDIO_SETLEDS: wssunkbd_set_leds(v, *(int *)data); @@ -1019,11 +1031,9 @@ wssunkbd_ioctl(v, cmd, data, flag, p) case WSKBDIO_GETLEDS: *(int *)data = k->k_leds; return (0); -#ifdef WSDISPLAY_COMPAT_RAWKBD___ +#ifdef WSDISPLAY_COMPAT_RAWKBD case WSKBDIO_SETMODE: - DPRINTF(("wssunkbd_ioctl: set raw = %d\n", *(int *)data)); - sc->sc_rawkbd = *(int *)data == WSKBD_RAW; - usb_uncallout(sc->sc_rawrepeat_ch, ukbd_rawrepeat, sc); + k->k_wsraw = *(int *)data == WSKBD_RAW; return (0); #endif } diff --git a/sys/dev/sun/kbdvar.h b/sys/dev/sun/kbdvar.h index b2109e728ce7..e8102cf30868 100644 --- a/sys/dev/sun/kbdvar.h +++ b/sys/dev/sun/kbdvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: kbdvar.h,v 1.15 2005/04/28 15:03:49 martin Exp $ */ +/* $NetBSD: kbdvar.h,v 1.16 2005/05/16 16:23:57 martin Exp $ */ /* * Copyright (c) 1992, 1993 @@ -57,6 +57,7 @@ struct kbd_softc { #if NWSKBD > 0 struct device * k_wskbd;/* handle for wskbd, if it is attached */ int k_wsenabled; /* set if we are using wskbd */ + int k_wsraw; /* send raw events to wscons */ struct callout k_wsbell;/* to shut the bell off */ #endif