summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-06-18 03:32:42 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-06-18 03:32:42 +0000
commitce05b867a48a0ab6a5bad5700ca7c6497dd7ac79 (patch)
tree9608dcc3b498750f7aa15095edcb959c7e2fc46a /sys/arch
parent22c866adfe34488f89387f925a2701c7b797d175 (diff)
"option CAPS_IS_CONTROL" will enable use of caps key as control
(need wsconsctl keymap too)
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/macppc/dev/akbd.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/sys/arch/macppc/dev/akbd.c b/sys/arch/macppc/dev/akbd.c
index 6363360fde2..46b49e22eb4 100644
--- a/sys/arch/macppc/dev/akbd.c
+++ b/sys/arch/macppc/dev/akbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: akbd.c,v 1.10 2002/06/07 07:14:48 miod Exp $ */
+/* $OpenBSD: akbd.c,v 1.11 2002/06/18 03:32:41 itojun Exp $ */
/* $NetBSD: akbd.c,v 1.13 2001/01/25 14:08:55 tsubai Exp $ */
/*
@@ -506,21 +506,49 @@ akbd_intr(event)
{
int key, press, val;
int type;
+#ifdef CAPS_IS_CONTROL
+ static int shift;
+#endif
struct akbd_softc *sc = akbd_cd.cd_devs[0];
key = event->u.k.key;
+
+#ifdef CAPS_IS_CONTROL
+ /*
+ * Caps lock is weird. The key sequence generated is:
+ * press: down(57) [57] (LED turns on)
+ * release: up(127) [255]
+ * press: up(127) [255]
+ * release: up(57) [185] (LED turns off)
+ */
+ if (ADBK_KEYVAL(key) == ADBK_CAPSLOCK)
+ shift = 0;
+
+ if (key == 255) {
+ if (shift == 0) {
+ key = ADBK_KEYUP(ADBK_CAPSLOCK);
+ shift = 1;
+ } else {
+ key = ADBK_KEYDOWN(ADBK_CAPSLOCK);
+ shift = 0;
+ }
+ }
+#endif
+
press = ADBK_PRESS(key);
val = ADBK_KEYVAL(key);
type = press ? WSCONS_EVENT_KEY_DOWN : WSCONS_EVENT_KEY_UP;
switch (val) {
+#ifndef CAPS_IS_CONTROL
case ADBK_CAPSLOCK:
type = WSCONS_EVENT_KEY_DOWN;
wskbd_input(sc->sc_wskbddev, type, val);
type = WSCONS_EVENT_KEY_UP;
break;
+#endif
#if 0
/* not supported... */