summaryrefslogtreecommitdiffstats
path: root/sys/dev/kbd
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-09-19 17:56:26 +0000
committered <ed@FreeBSD.org>2009-09-19 17:56:26 +0000
commit48c86dac0525a55eff2b75b5ba8dc573d1014cfe (patch)
tree1c093255582b069eabdbf07475eaefadbeaa94dd /sys/dev/kbd
parent064ad1c10a013fdee8dfa0bfcedcec6231604546 (diff)
downloadFreeBSD-src-48c86dac0525a55eff2b75b5ba8dc573d1014cfe.zip
FreeBSD-src-48c86dac0525a55eff2b75b5ba8dc573d1014cfe.tar.gz
Make the keyboard layer Unicode aware.
Just take keyent_t to use an u_int to store the Unicode codepoints. Unfortunately the keymap is now too big to be loaded using an ioctl argument, so change the ioctl to pick a pointer. This change breaks kbdcontrol ABI. It doesn't break X11, because X11 doesn't do anything with syscons keymaps. It just switches the device out of K_XLATE. Obtained from: //depot/user/ed/newcons/...
Diffstat (limited to 'sys/dev/kbd')
-rw-r--r--sys/dev/kbd/kbd.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c
index 851f677..57df934 100644
--- a/sys/dev/kbd/kbd.c
+++ b/sys/dev/kbd/kbd.c
@@ -837,13 +837,14 @@ static int fkey_change_ok(fkeytab_t *, fkeyarg_t *, struct thread *);
int
genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
{
+#ifndef KBD_DISABLE_KEYMAP_LOAD
+ keymap_t *mapp;
+#endif
keyarg_t *keyp;
fkeyarg_t *fkeyp;
int s;
int i;
-#ifndef KBD_DISABLE_KEYMAP_LOAD
int error;
-#endif
s = spltty();
switch (cmd) {
@@ -869,18 +870,29 @@ genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
break;
case GIO_KEYMAP: /* get keyboard translation table */
- bcopy(kbd->kb_keymap, arg, sizeof(*kbd->kb_keymap));
- break;
+ error = copyout(kbd->kb_keymap, *(void **)arg,
+ sizeof(keymap_t));
+ splx(s);
+ return (error);
case PIO_KEYMAP: /* set keyboard translation table */
#ifndef KBD_DISABLE_KEYMAP_LOAD
- error = keymap_change_ok(kbd->kb_keymap, (keymap_t *)arg,
- curthread);
+ mapp = malloc(sizeof *mapp, M_TEMP, M_NOWAIT);
+ error = copyin(*(void **)arg, mapp, sizeof *mapp);
+ if (error != 0) {
+ splx(s);
+ free(mapp, M_TEMP);
+ return (error);
+ }
+
+ error = keymap_change_ok(kbd->kb_keymap, mapp, curthread);
if (error != 0) {
splx(s);
+ free(mapp, M_TEMP);
return (error);
}
bzero(kbd->kb_accentmap, sizeof(*kbd->kb_accentmap));
- bcopy(arg, kbd->kb_keymap, sizeof(*kbd->kb_keymap));
+ bcopy(mapp, kbd->kb_keymap, sizeof(*kbd->kb_keymap));
+ free(mapp, M_TEMP);
break;
#else
splx(s);
OpenPOWER on IntegriCloud