summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-01-12 17:45:38 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-01-12 17:45:38 +0000
commitbd12b26d69be03f4012a9fd13ee6b8d8b8133b47 (patch)
tree6041ab6e93b628515f9dfc19945ef6aac1e988d3 /sys
parentf70f71a04a7cdf9b9c342b4ce388e7c4ef515320 (diff)
Remap the audio mute key on type 5, as it collides with the keypad equal
key on type 4.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/sun/sunkbd.c26
-rw-r--r--sys/dev/sun/sunkbdmap.c11
-rw-r--r--sys/dev/sun/sunkbdvar.h4
3 files changed, 31 insertions, 10 deletions
diff --git a/sys/dev/sun/sunkbd.c b/sys/dev/sun/sunkbd.c
index 83764933fe6..9355a52ef69 100644
--- a/sys/dev/sun/sunkbd.c
+++ b/sys/dev/sun/sunkbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sunkbd.c,v 1.23 2009/01/11 18:59:54 miod Exp $ */
+/* $OpenBSD: sunkbd.c,v 1.24 2009/01/12 17:45:37 miod Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
@@ -57,6 +57,8 @@
#endif
void sunkbd_bell(struct sunkbd_softc *, u_int, u_int, u_int);
+void sunkbd_decode(u_int8_t, u_int *, int *);
+void sunkbd_decode5(u_int8_t, u_int *, int *);
int sunkbd_enable(void *, int);
int sunkbd_getleds(struct sunkbd_softc *);
int sunkbd_ioctl(void *, u_long, caddr_t, int, struct proc *);
@@ -76,6 +78,11 @@ sunkbd_attach(struct sunkbd_softc *sc, struct wskbddev_attach_args *waa)
timeout_set(&sc->sc_rawrepeat_tmo, sunkbd_rawrepeat, sc);
#endif
+ if (ISTYPE5(sc->sc_layout))
+ sc->sc_decode = sunkbd_decode5;
+ else
+ sc->sc_decode = sunkbd_decode;
+
sc->sc_wskbddev = config_found((struct device *)sc, waa,
wskbddevprint);
}
@@ -145,6 +152,19 @@ sunkbd_decode(u_int8_t c, u_int *type, int *value)
}
}
+void
+sunkbd_decode5(u_int8_t c, u_int *type, int *value)
+{
+ sunkbd_decode(c, type, value);
+ /*
+ * Scancode 0x2d is KS_KP_Equal on type 4, and KS_AudioMute on
+ * type 5. Rather than provide two distinct maps, we remap the
+ * scancode here.
+ */
+ if (*value == 0x2d)
+ *value = 0x7f;
+}
+
int
sunkbd_enable(void *v, int on)
{
@@ -176,7 +196,7 @@ sunkbd_input(struct sunkbd_softc *sc, u_int8_t *buf, u_int buflen)
npress = rlen = 0;
while (buflen-- != 0) {
- sunkbd_decode(*buf++, &type, &value);
+ (*sc->sc_decode)(*buf++, &type, &value);
c = sunkbd_rawmap[value];
if (c == RAWKEY_Null)
continue;
@@ -206,7 +226,7 @@ sunkbd_input(struct sunkbd_softc *sc, u_int8_t *buf, u_int buflen)
{
s = spltty();
while (buflen-- != 0) {
- sunkbd_decode(*buf++, &type, &value);
+ (*sc->sc_decode)(*buf++, &type, &value);
wskbd_input(sc->sc_wskbddev, type, value);
}
splx(s);
diff --git a/sys/dev/sun/sunkbdmap.c b/sys/dev/sun/sunkbdmap.c
index b35c57e3c0b..c313d6dea50 100644
--- a/sys/dev/sun/sunkbdmap.c
+++ b/sys/dev/sun/sunkbdmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sunkbdmap.c,v 1.2 2009/01/11 18:59:54 miod Exp $ */
+/* $OpenBSD: sunkbdmap.c,v 1.3 2009/01/12 17:45:37 miod Exp $ */
/*
* Copyright (c) 2002, 2003 Miodrag Vallat.
@@ -99,7 +99,7 @@ const u_int8_t sunkbd_rawmap[0x80] = {
RAWKEY_grave,
RAWKEY_BackSpace,
RAWKEY_Insert,
- RAWKEY_KP_Equal,
+ RAWKEY_KP_Equal, /* type 4 only */
RAWKEY_KP_Divide,
RAWKEY_KP_Multiply,
RAWKEY_Null,
@@ -165,7 +165,7 @@ const u_int8_t sunkbd_rawmap[0x80] = {
RAWKEY_period,
RAWKEY_slash,
RAWKEY_Shift_R,
- RAWKEY_Null, /* KS_Linefeed on type 3/4 */
+ RAWKEY_Null, /* KS_Linefeed on type 3/4 */
RAWKEY_KP_End,
RAWKEY_KP_Down,
RAWKEY_KP_Next,
@@ -181,7 +181,7 @@ const u_int8_t sunkbd_rawmap[0x80] = {
RAWKEY_Null,
RAWKEY_KP_Add,
RAWKEY_Null,
- RAWKEY_Null
+ RAWKEY_AudioMute /* type 5 remapped 0x2d */
};
#endif
@@ -232,7 +232,7 @@ const keysym_t sunkbd_keydesc_us[] = {
KC(0x2a), KS_grave, KS_asciitilde,
KC(0x2b), KS_Delete,
KC(0x2c), KS_Insert,
- KC(0x2d), KS_KP_Equal,
+ KC(0x2d), KS_KP_Equal, /* type 4 */
KC(0x2e), KS_KP_Divide,
KC(0x2f), KS_KP_Multiply,
KC(0x31), KS_Front,
@@ -307,6 +307,7 @@ const keysym_t sunkbd_keydesc_us[] = {
KC(0x7a), KS_Meta_R,
KC(0x7b), KS_Next,
KC(0x7d), KS_KP_Add,
+ KC(0x7f), KS_AudioMute, /* type 5 KC(0x2d) */
};
/* 002 French/Belgian type 4 keyboard */
diff --git a/sys/dev/sun/sunkbdvar.h b/sys/dev/sun/sunkbdvar.h
index 280f4798146..79e0805484b 100644
--- a/sys/dev/sun/sunkbdvar.h
+++ b/sys/dev/sun/sunkbdvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sunkbdvar.h,v 1.13 2009/01/11 18:59:54 miod Exp $ */
+/* $OpenBSD: sunkbdvar.h,v 1.14 2009/01/12 17:45:37 miod Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
@@ -37,6 +37,7 @@ struct sunkbd_softc {
struct device sc_dev;
int (*sc_sendcmd)(void *, u_int8_t *, u_int);
+ void (*sc_decode)(u_int8_t, u_int *, int *);
int sc_leds; /* LED status */
int sc_id; /* keyboard type */
@@ -63,7 +64,6 @@ extern struct wskbd_accessops sunkbd_accessops;
void sunkbd_attach(struct sunkbd_softc *, struct wskbddev_attach_args *);
void sunkbd_bellstop(void *);
-void sunkbd_decode(u_int8_t, u_int *, int *);
void sunkbd_input(struct sunkbd_softc *, u_int8_t *, u_int);
void sunkbd_raw(struct sunkbd_softc *, u_int8_t);
int sunkbd_setclick(struct sunkbd_softc *, int);