summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/arm/xscale/pxa27x_kpc.c4
-rw-r--r--sys/arch/hp300/dev/dnkbd.c4
-rw-r--r--sys/arch/luna88k/dev/lunaws.c4
-rw-r--r--sys/arch/sgi/hpc/z8530kbd.c4
-rw-r--r--sys/arch/vax/dec/dzkbd.c4
-rw-r--r--sys/arch/vax/vxt/qsckbd.c4
-rw-r--r--sys/arch/zaurus/dev/zaurus_kbd.c4
-rw-r--r--sys/arch/zaurus/dev/zaurus_remote.c4
-rw-r--r--sys/dev/adb/akbd.c4
-rw-r--r--sys/dev/hil/hilkbd.c6
-rw-r--r--sys/dev/pckbc/pckbd.c4
-rw-r--r--sys/dev/sun/sunkbdmap.c6
-rw-r--r--sys/dev/usb/ukbd.c4
-rw-r--r--sys/dev/wscons/wskbd.c110
-rw-r--r--sys/dev/wscons/wskbdutil.c6
-rw-r--r--sys/dev/wscons/wsksymdef.h21
-rw-r--r--sys/dev/wscons/wsksymvar.h6
-rw-r--r--sys/dev/wscons/wsmux.c26
-rw-r--r--sys/dev/wscons/wsmuxvar.h4
19 files changed, 139 insertions, 90 deletions
diff --git a/sys/arch/arm/xscale/pxa27x_kpc.c b/sys/arch/arm/xscale/pxa27x_kpc.c
index f89abed43f2..7ae267330d0 100644
--- a/sys/arch/arm/xscale/pxa27x_kpc.c
+++ b/sys/arch/arm/xscale/pxa27x_kpc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pxa27x_kpc.c,v 1.2 2013/02/09 20:36:14 miod Exp $ */
+/* $OpenBSD: pxa27x_kpc.c,v 1.3 2014/01/26 17:48:07 miod Exp $ */
/*
* Copyright (c) 2009 Marek Vasut <marex@openbsd.org>
*
@@ -50,7 +50,7 @@ struct wscons_keydesc pxa27x_kpc_keydesctab[] = {
};
struct wskbd_mapdata pxa27x_kpc_mapdata = {
- pxa27x_kpc_keydesctab, KB_US,
+ pxa27x_kpc_keydesctab, KB_US | KB_DEFAULT,
};
void pxa27x_kpc_cngetc(void *, u_int *, int *);
diff --git a/sys/arch/hp300/dev/dnkbd.c b/sys/arch/hp300/dev/dnkbd.c
index da91908d625..5f28644d2e9 100644
--- a/sys/arch/hp300/dev/dnkbd.c
+++ b/sys/arch/hp300/dev/dnkbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dnkbd.c,v 1.18 2011/11/09 14:22:37 shadchin Exp $ */
+/* $OpenBSD: dnkbd.c,v 1.19 2014/01/26 17:48:07 miod Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat
@@ -201,7 +201,7 @@ struct wskbd_mapdata dnkbd_keymapdata = {
#ifdef DNKBD_LAYOUT
DNKBD_LAYOUT
#else
- KB_US
+ KB_US | KB_DEFAULT
#endif
};
diff --git a/sys/arch/luna88k/dev/lunaws.c b/sys/arch/luna88k/dev/lunaws.c
index 6ee0768e81e..cfebdb16915 100644
--- a/sys/arch/luna88k/dev/lunaws.c
+++ b/sys/arch/luna88k/dev/lunaws.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lunaws.c,v 1.9 2013/05/22 11:35:02 aoyama Exp $ */
+/* $OpenBSD: lunaws.c,v 1.10 2014/01/26 17:48:07 miod Exp $ */
/* $NetBSD: lunaws.c,v 1.6 2002/03/17 19:40:42 atatat Exp $ */
/*-
@@ -87,7 +87,7 @@ const struct wskbd_mapdata omkbd_keymapdata = {
#ifdef OMKBD_LAYOUT
OMKBD_LAYOUT,
#else
- KB_JP,
+ KB_JP | KB_DEFAULT,
#endif
};
diff --git a/sys/arch/sgi/hpc/z8530kbd.c b/sys/arch/sgi/hpc/z8530kbd.c
index 1fcb0162ca6..b671cb99578 100644
--- a/sys/arch/sgi/hpc/z8530kbd.c
+++ b/sys/arch/sgi/hpc/z8530kbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: z8530kbd.c,v 1.4 2012/04/29 09:01:38 miod Exp $ */
+/* $OpenBSD: z8530kbd.c,v 1.5 2014/01/26 17:48:07 miod Exp $ */
/* $NetBSD: zs_kbd.c,v 1.8 2008/03/29 19:15:35 tsutsui Exp $ */
/*
@@ -163,7 +163,7 @@ static struct zsops zskbd_zsops = {
extern const struct wscons_keydesc wssgi_keydesctab[];
const struct wskbd_mapdata sgikbd_wskbd_keymapdata = {
wssgi_keydesctab,
- KB_US
+ KB_US | KB_DEFAULT
};
const struct wskbd_accessops zskbd_wskbd_accessops = {
diff --git a/sys/arch/vax/dec/dzkbd.c b/sys/arch/vax/dec/dzkbd.c
index e01074f60f4..c455678d168 100644
--- a/sys/arch/vax/dec/dzkbd.c
+++ b/sys/arch/vax/dec/dzkbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dzkbd.c,v 1.14 2008/08/20 16:31:41 miod Exp $ */
+/* $OpenBSD: dzkbd.c,v 1.15 2014/01/26 17:48:07 miod Exp $ */
/* $NetBSD: dzkbd.c,v 1.1 2000/12/02 17:03:55 ragge Exp $ */
/*
@@ -113,7 +113,7 @@ const struct wskbd_mapdata dzkbd_keymapdata = {
#ifdef LKKBD_LAYOUT
LKKBD_LAYOUT,
#else
- KB_US,
+ KB_US | KB_DEFAULT,
#endif
};
diff --git a/sys/arch/vax/vxt/qsckbd.c b/sys/arch/vax/vxt/qsckbd.c
index bf9f54ade79..a65f1810970 100644
--- a/sys/arch/vax/vxt/qsckbd.c
+++ b/sys/arch/vax/vxt/qsckbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: qsckbd.c,v 1.1 2006/08/27 16:55:41 miod Exp $ */
+/* $OpenBSD: qsckbd.c,v 1.2 2014/01/26 17:48:07 miod Exp $ */
/* from OpenBSD: dzkbd.c,v 1.11 2006/08/05 22:05:55 miod Exp */
/*
* Copyright (c) 2006 Miodrag Vallat.
@@ -127,7 +127,7 @@ const struct wskbd_mapdata qsckbd_keymapdata = {
#ifdef LKKBD_LAYOUT
LKKBD_LAYOUT,
#else
- KB_US,
+ KB_US | KB_DEFAULT,
#endif
};
diff --git a/sys/arch/zaurus/dev/zaurus_kbd.c b/sys/arch/zaurus/dev/zaurus_kbd.c
index ea8cc1a704c..e6d9eead203 100644
--- a/sys/arch/zaurus/dev/zaurus_kbd.c
+++ b/sys/arch/zaurus/dev/zaurus_kbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zaurus_kbd.c,v 1.33 2011/11/09 14:22:37 shadchin Exp $ */
+/* $OpenBSD: zaurus_kbd.c,v 1.34 2014/01/26 17:48:08 miod Exp $ */
/*
* Copyright (c) 2005 Dale Rahn <drahn@openbsd.org>
*
@@ -151,7 +151,7 @@ struct wskbd_consops zkbd_consops = {
struct wskbd_mapdata zkbd_keymapdata = {
zkbd_keydesctab,
- KB_US,
+ KB_US | KB_DEFAULT,
};
diff --git a/sys/arch/zaurus/dev/zaurus_remote.c b/sys/arch/zaurus/dev/zaurus_remote.c
index 582ea8e01b8..ae12c08b23c 100644
--- a/sys/arch/zaurus/dev/zaurus_remote.c
+++ b/sys/arch/zaurus/dev/zaurus_remote.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zaurus_remote.c,v 1.1 2005/11/17 05:26:31 uwe Exp $ */
+/* $OpenBSD: zaurus_remote.c,v 1.2 2014/01/26 17:48:08 miod Exp $ */
/*
* Copyright (c) 2005 Uwe Stuehler <uwe@openbsd.org>
@@ -153,7 +153,7 @@ static const struct wscons_keydesc zrc_keydesctab[] = {
};
struct wskbd_mapdata zrc_keymapdata = {
- zrc_keydesctab, KB_US
+ zrc_keydesctab, KB_US | KB_DEFAULT
};
diff --git a/sys/dev/adb/akbd.c b/sys/dev/adb/akbd.c
index d588ddcadb0..c7287c81fe9 100644
--- a/sys/dev/adb/akbd.c
+++ b/sys/dev/adb/akbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: akbd.c,v 1.13 2013/08/22 11:46:38 mpi Exp $ */
+/* $OpenBSD: akbd.c,v 1.14 2014/01/26 17:48:08 miod Exp $ */
/* $NetBSD: akbd.c,v 1.17 2005/01/15 16:00:59 chs Exp $ */
/*
@@ -80,7 +80,7 @@ struct wskbd_mapdata akbd_keymapdata = {
#ifdef AKBD_LAYOUT
AKBD_LAYOUT,
#else
- KB_US,
+ KB_US | KB_DEFAULT,
#endif
};
diff --git a/sys/dev/hil/hilkbd.c b/sys/dev/hil/hilkbd.c
index 7b0a13cf48d..2af64896b61 100644
--- a/sys/dev/hil/hilkbd.c
+++ b/sys/dev/hil/hilkbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hilkbd.c,v 1.15 2011/11/09 14:22:37 shadchin Exp $ */
+/* $OpenBSD: hilkbd.c,v 1.16 2014/01/26 17:48:08 miod Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
* All rights reserved.
@@ -104,7 +104,7 @@ struct wskbd_mapdata hilkbd_keymapdata = {
#ifdef HILKBD_LAYOUT
HILKBD_LAYOUT,
#else
- KB_US,
+ KB_US | KB_DEFAULT,
#endif
};
@@ -113,7 +113,7 @@ struct wskbd_mapdata hilkbd_keymapdata_ps2 = {
#ifdef HILKBD_LAYOUT
HILKBD_LAYOUT,
#else
- KB_US,
+ KB_US | KB_DEFAULT,
#endif
};
diff --git a/sys/dev/pckbc/pckbd.c b/sys/dev/pckbc/pckbd.c
index 7971119d4b9..59906a824c7 100644
--- a/sys/dev/pckbc/pckbd.c
+++ b/sys/dev/pckbc/pckbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pckbd.c,v 1.34 2013/02/15 10:20:07 ratchov Exp $ */
+/* $OpenBSD: pckbd.c,v 1.35 2014/01/26 17:48:08 miod Exp $ */
/* $NetBSD: pckbd.c,v 1.24 2000/06/05 22:20:57 sommerfeld Exp $ */
/*-
@@ -157,7 +157,7 @@ const struct wskbd_mapdata pckbd_keymapdata = {
#ifdef PCKBD_LAYOUT
PCKBD_LAYOUT,
#else
- KB_US,
+ KB_US | KB_DEFAULT,
#endif
};
diff --git a/sys/dev/sun/sunkbdmap.c b/sys/dev/sun/sunkbdmap.c
index 03f80caae43..b37cf6724c9 100644
--- a/sys/dev/sun/sunkbdmap.c
+++ b/sys/dev/sun/sunkbdmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sunkbdmap.c,v 1.5 2012/11/29 14:51:27 shadchin Exp $ */
+/* $OpenBSD: sunkbdmap.c,v 1.6 2014/01/26 17:48:08 miod Exp $ */
/*
* Copyright (c) 2002, 2003 Miodrag Vallat.
@@ -1162,7 +1162,7 @@ struct wskbd_mapdata sunkbd_keymapdata = {
#ifdef SUNKBD_LAYOUT
SUNKBD_LAYOUT,
#else
- KB_US,
+ KB_US | KB_DEFAULT,
#endif
};
@@ -1171,6 +1171,6 @@ struct wskbd_mapdata sunkbd5_keymapdata = {
#ifdef SUNKBD5_LAYOUT
SUNKBD5_LAYOUT,
#else
- KB_US,
+ KB_US | KB_DEFAULT,
#endif
};
diff --git a/sys/dev/usb/ukbd.c b/sys/dev/usb/ukbd.c
index 07b5e6f697c..1774a3142f4 100644
--- a/sys/dev/usb/ukbd.c
+++ b/sys/dev/usb/ukbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ukbd.c,v 1.62 2013/11/15 08:17:44 pirofti Exp $ */
+/* $OpenBSD: ukbd.c,v 1.63 2014/01/26 17:48:08 miod Exp $ */
/* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */
/*
@@ -265,7 +265,7 @@ ukbd_attach(struct device *parent, struct device *self, void *aux)
#ifdef UKBD_LAYOUT
layout = UKBD_LAYOUT;
#else
- layout = KB_US;
+ layout = KB_US | KB_DEFAULT;
#endif
}
diff --git a/sys/dev/wscons/wskbd.c b/sys/dev/wscons/wskbd.c
index d9cca40c364..ebe3d482d50 100644
--- a/sys/dev/wscons/wskbd.c
+++ b/sys/dev/wscons/wskbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wskbd.c,v 1.75 2013/11/04 11:57:26 mpi Exp $ */
+/* $OpenBSD: wskbd.c,v 1.76 2014/01/26 17:48:08 miod Exp $ */
/* $NetBSD: wskbd.c,v 1.80 2005/05/04 01:52:16 augustss Exp $ */
/*
@@ -122,8 +122,6 @@ int wskbddebug = 0;
#include <dev/wscons/wsmuxvar.h>
struct wskbd_internal {
- const struct wskbd_mapdata *t_keymap;
-
const struct wskbd_consops *t_consops;
void *t_consaccesscookie;
@@ -138,6 +136,9 @@ struct wskbd_internal {
keysym_t t_symbols[MAXKEYSYMSPERKEY];
struct wskbd_softc *t_sc; /* back pointer */
+
+ struct wskbd_mapdata t_keymap; /* translation map table and
+ current layout */
};
struct wskbd_softc {
@@ -165,7 +166,6 @@ struct wskbd_softc {
int sc_maplen; /* number of entries in sc_map */
struct wscons_keymap *sc_map; /* current translation map */
- kbd_t sc_layout; /* current layout */
int sc_refcnt;
u_char sc_dying; /* device is being detached */
@@ -307,6 +307,8 @@ wskbd_update_layout(struct wskbd_internal *id, kbd_t enc)
id->t_flags |= WSKFL_METAESC;
else
id->t_flags &= ~WSKFL_METAESC;
+
+ id->t_keymap.layout = enc;
}
/*
@@ -354,7 +356,9 @@ wskbd_attach(struct device *parent, struct device *self, void *aux)
{
struct wskbd_softc *sc = (struct wskbd_softc *)self;
struct wskbddev_attach_args *ap = aux;
+ kbd_t layout;
#if NWSMUX > 0
+ struct wsmux_softc *wsmux_sc;
int mux, error;
#endif
@@ -370,8 +374,11 @@ wskbd_attach(struct device *parent, struct device *self, void *aux)
/* printf(" (mux %d ignored for console)", mux); */
mux = -1;
}
- if (mux >= 0)
+ if (mux >= 0) {
printf(" mux %d", mux);
+ wsmux_sc = wsmux_getmux(mux);
+ } else
+ wsmux_sc = NULL;
#else
#if 0 /* not worth keeping, especially since the default value is not -1... */
if (sc->sc_base.me_dv.dv_cfdata->wskbddevcf_mux >= 0)
@@ -384,8 +391,7 @@ wskbd_attach(struct device *parent, struct device *self, void *aux)
} else {
sc->id = malloc(sizeof(struct wskbd_internal),
M_DEVBUF, M_WAITOK | M_ZERO);
- sc->id->t_keymap = ap->keymap;
- wskbd_update_layout(sc->id, ap->keymap->layout);
+ bcopy(ap->keymap, &sc->id->t_keymap, sizeof(sc->id->t_keymap));
}
#if NWSDISPLAY > 0
@@ -400,11 +406,36 @@ wskbd_attach(struct device *parent, struct device *self, void *aux)
sc->sc_translating = 1;
sc->sc_ledstate = -1; /* force update */
- if (wskbd_load_keymap(sc->id->t_keymap,
- &sc->sc_map, &sc->sc_maplen) != 0)
- panic("cannot load keymap");
-
- sc->sc_layout = sc->id->t_keymap->layout;
+ /*
+ * If this layout is the default choice of the driver (i.e. the
+ * driver doesn't know better), pick the existing layout of the
+ * current mux, if any.
+ */
+ layout = sc->id->t_keymap.layout;
+#if NWSMUX > 0
+ if (layout & KB_DEFAULT) {
+ if (wsmux_sc != NULL && wsmux_get_layout(wsmux_sc) != KB_NONE)
+ layout = wsmux_get_layout(wsmux_sc);
+ }
+#endif
+ for (;;) {
+ if (wskbd_load_keymap(&sc->id->t_keymap, layout, &sc->sc_map,
+ &sc->sc_maplen) == 0)
+ break;
+#if NWSMUX > 0
+ if (layout == sc->id->t_keymap.layout)
+ panic("cannot load keymap");
+ if (wsmux_sc != NULL && wsmux_get_layout(wsmux_sc) != KB_NONE) {
+ printf("\n%s: cannot load keymap, "
+ "falling back to default\n%s",
+ sc->sc_base.me_dv.dv_xname,
+ sc->sc_base.me_dv.dv_xname);
+ layout = wsmux_get_layout(wsmux_sc);
+ } else
+#endif
+ panic("cannot load keymap");
+ }
+ wskbd_update_layout(sc->id, layout);
/* set default bell and key repeat data */
sc->sc_bell_data = wskbd_default_bell_data;
@@ -427,11 +458,21 @@ wskbd_attach(struct device *parent, struct device *self, void *aux)
printf("\n");
#if NWSMUX > 0
- if (mux >= 0) {
- error = wsmux_attach_sc(wsmux_getmux(mux), &sc->sc_base);
+ if (wsmux_sc != NULL) {
+ error = wsmux_attach_sc(wsmux_sc, &sc->sc_base);
if (error)
printf("%s: attach error=%d\n",
sc->sc_base.me_dv.dv_xname, error);
+
+ /*
+ * Try and set this encoding as the mux default if it
+ * hasn't any yet, and if this is not a driver default
+ * layout (i.e. parent driver pretends to know better).
+ * Note that wsmux_set_layout() rejects layouts with
+ * KB_DEFAULT set.
+ */
+ if (wsmux_get_layout(wsmux_sc) == KB_NONE)
+ wsmux_set_layout(wsmux_sc, layout);
}
#endif
@@ -451,7 +492,6 @@ wskbd_attach(struct device *parent, struct device *self, void *aux)
}
}
#endif
-
}
void
@@ -461,7 +501,7 @@ wskbd_cnattach(const struct wskbd_consops *consops, void *conscookie,
KASSERT(!wskbd_console_initted);
- wskbd_console_data.t_keymap = mapdata;
+ bcopy(mapdata, &wskbd_console_data.t_keymap, sizeof(*mapdata));
wskbd_update_layout(&wskbd_console_data, mapdata->layout);
wskbd_console_data.t_consops = consops;
@@ -479,10 +519,11 @@ wskbd_cndetach(void)
{
KASSERT(wskbd_console_initted);
- wskbd_console_data.t_keymap = 0;
+ wskbd_console_data.t_keymap.keydesc = NULL;
+ wskbd_console_data.t_keymap.layout = KB_NONE;
- wskbd_console_data.t_consops = 0;
- wskbd_console_data.t_consaccesscookie = 0;
+ wskbd_console_data.t_consops = NULL;
+ wskbd_console_data.t_consaccesscookie = NULL;
#if NWSDISPLAY > 0
wsdisplay_unset_cons_kbd();
@@ -510,7 +551,7 @@ wskbd_repeat(void *v)
/* deliver keys */
if (sc->sc_displaydv != NULL)
wsdisplay_kbdinput(sc->sc_displaydv,
- sc->id->t_keymap->layout,
+ sc->id->t_keymap.layout,
sc->id->t_symbols, sc->sc_repeating);
} else {
/* queue event */
@@ -629,7 +670,7 @@ wskbd_input(struct device *dev, u_int type, int value)
}
#endif
wsdisplay_kbdinput(sc->sc_displaydv,
- sc->id->t_keymap->layout,
+ sc->id->t_keymap.layout,
sc->id->t_symbols, num);
}
@@ -955,7 +996,6 @@ wskbd_displayioctl(struct device *dev, u_long cmd, caddr_t data, int flag,
struct wskbd_bell_data *ubdp, *kbdp;
struct wskbd_keyrepeat_data *ukdp, *kkdp;
struct wskbd_map_data *umdp;
- struct wskbd_mapdata md;
kbd_t enc;
void *buf;
int len, error;
@@ -1070,9 +1110,9 @@ getkeyrepeat:
&sc->sc_map, &sc->sc_maplen);
memcpy(sc->sc_map, buf, len);
/* drop the variant bits handled by the map */
- sc->sc_layout = KB_USER |
- (KB_VARIANT(sc->sc_layout) & KB_HANDLEDBYWSKBD);
- wskbd_update_layout(sc->id, sc->sc_layout);
+ enc = KB_USER | (KB_VARIANT(sc->id->t_keymap.layout) &
+ KB_HANDLEDBYWSKBD);
+ wskbd_update_layout(sc->id, enc);
}
free(buf, M_TEMP);
return(error);
@@ -1086,28 +1126,30 @@ getkeyrepeat:
return(error);
case WSKBDIO_GETENCODING:
- *((kbd_t *) data) = sc->sc_layout;
+ *((kbd_t *)data) = sc->id->t_keymap.layout & ~KB_DEFAULT;
return(0);
case WSKBDIO_SETENCODING:
enc = *((kbd_t *)data);
if (KB_ENCODING(enc) == KB_USER) {
/* user map must already be loaded */
- if (KB_ENCODING(sc->sc_layout) != KB_USER)
+ if (KB_ENCODING(sc->id->t_keymap.layout) != KB_USER)
return (EINVAL);
/* map variants make no sense */
if (KB_VARIANT(enc) & ~KB_HANDLEDBYWSKBD)
return (EINVAL);
} else {
- md = *(sc->id->t_keymap); /* structure assignment */
- md.layout = enc;
- error = wskbd_load_keymap(&md, &sc->sc_map,
- &sc->sc_maplen);
+ error = wskbd_load_keymap(&sc->id->t_keymap, enc,
+ &sc->sc_map, &sc->sc_maplen);
if (error)
- return(error);
+ return (error);
}
- sc->sc_layout = enc;
wskbd_update_layout(sc->id, enc);
+#if NWSMUX > 0
+ /* Update mux default layout */
+ if (sc->sc_base.me_parent != NULL)
+ wsmux_set_layout(sc->sc_base.me_parent, enc);
+#endif
return (0);
}
@@ -1528,7 +1570,7 @@ wskbd_translate(struct wskbd_internal *id, u_int type, int value)
kp = sc->sc_map + value;
} else {
kp = &kpbuf;
- wskbd_get_mapentry(id->t_keymap, value, kp);
+ wskbd_get_mapentry(&id->t_keymap, value, kp);
}
/* if this key has a command, process it first */
diff --git a/sys/dev/wscons/wskbdutil.c b/sys/dev/wscons/wskbdutil.c
index b5377990c61..9c83d72e08d 100644
--- a/sys/dev/wscons/wskbdutil.c
+++ b/sys/dev/wscons/wskbdutil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wskbdutil.c,v 1.10 2012/12/05 23:20:22 deraadt Exp $ */
+/* $OpenBSD: wskbdutil.c,v 1.11 2014/01/26 17:48:08 miod Exp $ */
/* $NetBSD: wskbdutil.c,v 1.7 1999/12/21 11:59:13 drochner Exp $ */
/*-
@@ -395,7 +395,7 @@ wskbd_init_keymap(int newlen, struct wscons_keymap **map, int *maplen)
}
int
-wskbd_load_keymap(const struct wskbd_mapdata *mapdata,
+wskbd_load_keymap(const struct wskbd_mapdata *mapdata, kbd_t layout,
struct wscons_keymap **map, int *maplen)
{
int i, s, kc, stack_ptr;
@@ -404,7 +404,7 @@ wskbd_load_keymap(const struct wskbd_mapdata *mapdata,
kbd_t cur;
keysym_t ksg;
- for (cur = mapdata->layout & ~KB_HANDLEDBYWSKBD, stack_ptr = 0;
+ for (cur = layout & ~KB_HANDLEDBYWSKBD, stack_ptr = 0;
cur != 0; stack_ptr++) {
mp = mapdata->keydesc;
while (mp->map_size > 0) {
diff --git a/sys/dev/wscons/wsksymdef.h b/sys/dev/wscons/wsksymdef.h
index b1abb46f393..9570da68ca9 100644
--- a/sys/dev/wscons/wsksymdef.h
+++ b/sys/dev/wscons/wsksymdef.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsksymdef.h,v 1.35 2013/10/18 22:06:42 miod Exp $ */
+/* $OpenBSD: wsksymdef.h,v 1.36 2014/01/26 17:48:08 miod Exp $ */
/* $NetBSD: wsksymdef.h,v 1.34.4.1 2000/07/07 09:49:54 hannken Exp $ */
/*-
@@ -735,15 +735,16 @@
#define KB_LV 0x1b00
#define KB_IS 0x1c00
-#define KB_NODEAD 0x000001 /* disable dead accents */
-#define KB_DECLK 0x000002 /* DEC LKnnn layout */
-#define KB_LK401 0x000004 /* DEC LK401 instead LK201 */
-#define KB_SWAPCTRLCAPS 0x000008 /* swap Left-Control and Caps-Lock */
-#define KB_DVORAK 0x000010 /* Dvorak layout */
-#define KB_METAESC 0x000020 /* generate ESC prefix on ALT-key */
-#define KB_IOPENER 0x000040 /* f1-f12 -> ESC,f1-f11 */
-#define KB_MACHDEP 0x000080 /* machine dependent */
-#define KB_APPLE 0x010000 /* Apple specific layout */
+#define KB_NODEAD 0x00000001 /* disable dead accents */
+#define KB_DECLK 0x00000002 /* DEC LKnnn layout */
+#define KB_LK401 0x00000004 /* DEC LK401 instead LK201 */
+#define KB_SWAPCTRLCAPS 0x00000008 /* swap Left-Control and Caps-Lock */
+#define KB_DVORAK 0x00000010 /* Dvorak layout */
+#define KB_METAESC 0x00000020 /* generate ESC prefix on ALT-key */
+#define KB_IOPENER 0x00000040 /* f1-f12 -> ESC,f1-f11 */
+#define KB_MACHDEP 0x00000080 /* machine dependent */
+#define KB_APPLE 0x00010000 /* Apple specific layout */
+#define KB_DEFAULT 0x80000000 /* (attach-only) default layout */
#define KB_ENCTAB \
{ KB_USER, "user" }, \
diff --git a/sys/dev/wscons/wsksymvar.h b/sys/dev/wscons/wsksymvar.h
index 026abee57c4..e40889dd81c 100644
--- a/sys/dev/wscons/wsksymvar.h
+++ b/sys/dev/wscons/wsksymvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsksymvar.h,v 1.7 2008/06/26 05:42:19 ray Exp $ */
+/* $OpenBSD: wsksymvar.h,v 1.8 2014/01/26 17:48:08 miod Exp $ */
/* $NetBSD: wsksymvar.h,v 1.8.4.1 2000/07/07 09:50:21 hannken Exp $ */
/*-
@@ -60,7 +60,7 @@ struct wskbd_mapdata {
};
/* layout variant bits ignored by mapping code */
-#define KB_HANDLEDBYWSKBD KB_METAESC
+#define KB_HANDLEDBYWSKBD (KB_METAESC | KB_DEFAULT)
/*
* Utility functions.
@@ -68,7 +68,7 @@ struct wskbd_mapdata {
void wskbd_get_mapentry(const struct wskbd_mapdata *, int,
struct wscons_keymap *);
void wskbd_init_keymap(int, struct wscons_keymap **, int *);
-int wskbd_load_keymap(const struct wskbd_mapdata *,
+int wskbd_load_keymap(const struct wskbd_mapdata *, kbd_t,
struct wscons_keymap **, int *);
keysym_t wskbd_compose_value(keysym_t *);
diff --git a/sys/dev/wscons/wsmux.c b/sys/dev/wscons/wsmux.c
index 8bdf6f1e205..8e43a33c051 100644
--- a/sys/dev/wscons/wsmux.c
+++ b/sys/dev/wscons/wsmux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsmux.c,v 1.25 2013/12/02 02:36:22 krw Exp $ */
+/* $OpenBSD: wsmux.c,v 1.26 2014/01/26 17:48:08 miod Exp $ */
/* $NetBSD: wsmux.c,v 1.37 2005/04/30 03:47:12 augustss Exp $ */
/*
@@ -519,13 +519,8 @@ wsmux_do_ioctl(struct device *dv, u_long cmd, caddr_t data, int flag,
if (!error)
ok = 1;
}
- if (ok) {
+ if (ok)
error = 0;
- if (cmd == WSKBDIO_SETENCODING) {
- sc->sc_kbd_layout = *((kbd_t *)data);
- }
-
- }
return (error);
}
@@ -633,10 +628,6 @@ wsmux_attach_sc(struct wsmux_softc *sc, struct wsevsrc *me)
(void)wsevsrc_ioctl(me, WSKBDIO_SETMODE,
&sc->sc_rawkbd, FWRITE, 0);
#endif
- if (sc->sc_kbd_layout != KB_NONE)
- (void)wsevsrc_ioctl(me,
- WSKBDIO_SETENCODING,
- &sc->sc_kbd_layout, FWRITE, 0);
}
}
}
@@ -821,3 +812,16 @@ wsmux_set_display(struct wsmux_softc *sc, struct device *displaydv)
return (error);
}
#endif /* NWSDISPLAY > 0 */
+
+uint32_t
+wsmux_get_layout(struct wsmux_softc *sc)
+{
+ return sc->sc_kbd_layout;
+}
+
+void
+wsmux_set_layout(struct wsmux_softc *sc, uint32_t layout)
+{
+ if ((layout & KB_DEFAULT) == 0)
+ sc->sc_kbd_layout = layout;
+}
diff --git a/sys/dev/wscons/wsmuxvar.h b/sys/dev/wscons/wsmuxvar.h
index 4027cca7e7d..4d62521573c 100644
--- a/sys/dev/wscons/wsmuxvar.h
+++ b/sys/dev/wscons/wsmuxvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsmuxvar.h,v 1.9 2013/12/02 02:36:22 krw Exp $ */
+/* $OpenBSD: wsmuxvar.h,v 1.10 2014/01/26 17:48:08 miod Exp $ */
/* $NetBSD: wsmuxvar.h,v 1.10 2005/04/30 03:47:12 augustss Exp $ */
/*
@@ -93,6 +93,8 @@ struct wsmux_softc *wsmux_create(const char *, int);
int wsmux_attach_sc(struct wsmux_softc *, struct wsevsrc *);
void wsmux_detach_sc(struct wsevsrc *);
int wsmux_set_display(struct wsmux_softc *, struct device *);
+uint32_t wsmux_get_layout(struct wsmux_softc *);
+void wsmux_set_layout(struct wsmux_softc *, uint32_t);
int wskbd_add_mux(int, struct wsmux_softc *);
int wsmouse_add_mux(int, struct wsmux_softc *);