summaryrefslogtreecommitdiff
path: root/sys/dev/pckbc/pckbd.c
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2007-12-31 17:08:08 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2007-12-31 17:08:08 +0000
commit8d980d40e55ec8cf8d7314370fb339d8c0a49e90 (patch)
tree87ea3b2cf2086368cdfde3ae0d64fa45b3d86aba /sys/dev/pckbc/pckbd.c
parent08d55a795ade813f9a909471f859e6ab4668f85a (diff)
Keep running the scancode translation state machine even when the keyboard
is set to raw mode, but only feed decoded events to wscons if non-raw mode. Then, as an exception to this, pass the audio control keys events to wscons even if in raw mode, so that the in-kernel mixer control code can perform its work. The event is also seen by the raw event consumer (i.e. the X server). Requested and tested by many...
Diffstat (limited to 'sys/dev/pckbc/pckbd.c')
-rw-r--r--sys/dev/pckbc/pckbd.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/sys/dev/pckbc/pckbd.c b/sys/dev/pckbc/pckbd.c
index fa7a7d609cb..46ee6bb19b5 100644
--- a/sys/dev/pckbc/pckbd.c
+++ b/sys/dev/pckbc/pckbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pckbd.c,v 1.12 2007/10/17 21:54:29 deraadt Exp $ */
+/* $OpenBSD: pckbd.c,v 1.13 2007/12/31 17:08:07 miod Exp $ */
/* $NetBSD: pckbd.c,v 1.24 2000/06/05 22:20:57 sommerfeld Exp $ */
/*-
@@ -119,7 +119,9 @@ struct pckbd_softc {
struct device *sc_wskbddev;
#ifdef WSDISPLAY_COMPAT_RAWKBD
- int rawkbd;
+ int rawkbd;
+ u_int sc_rawcnt;
+ char sc_rawbuf[3];
#endif
};
@@ -561,16 +563,28 @@ pckbd_input(vsc, data)
int data;
{
struct pckbd_softc *sc = vsc;
- int type, key;
+ int rc, type, key;
+
+ rc = pckbd_decode(sc->id, data, &type, &key);
#ifdef WSDISPLAY_COMPAT_RAWKBD
if (sc->rawkbd) {
- char d = data;
- wskbd_rawinput(sc->sc_wskbddev, &d, 1);
- return;
+ sc->sc_rawbuf[sc->sc_rawcnt++] = (char)data;
+
+ if (rc != 0 || sc->sc_rawcnt == sizeof(sc->sc_rawbuf)) {
+ wskbd_rawinput(sc->sc_wskbddev, sc->sc_rawbuf,
+ sc->sc_rawcnt);
+ sc->sc_rawcnt = 0;
+ }
+
+ /*
+ * Pass audio keys to wskbd_input anyway.
+ */
+ if (rc == 0 || (key != 160 && key != 174 && key != 176))
+ return;
}
#endif
- if (pckbd_decode(sc->id, data, &type, &key))
+ if (rc != 0)
wskbd_input(sc->sc_wskbddev, type, key);
}