diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/adb/adb_kbd.c | 1 | ||||
-rw-r--r-- | sys/dev/atkbdc/atkbd.c | 1 | ||||
-rw-r--r-- | sys/dev/kbd/kbd.c | 40 | ||||
-rw-r--r-- | sys/dev/kbdmux/kbdmux.c | 1 | ||||
-rw-r--r-- | sys/dev/syscons/syscons.c | 2 | ||||
-rw-r--r-- | sys/dev/uart/uart_kbd_sun.c | 1 | ||||
-rw-r--r-- | sys/dev/usb/input/ukbd.c | 2 | ||||
-rw-r--r-- | sys/dev/vkbd/vkbd.c | 1 | ||||
-rw-r--r-- | sys/i386/ibcs2/ibcs2_ioctl.c | 4 | ||||
-rw-r--r-- | sys/pc98/cbus/pckbd.c | 1 | ||||
-rw-r--r-- | sys/sys/kbio.h | 18 |
11 files changed, 62 insertions, 10 deletions
diff --git a/sys/dev/adb/adb_kbd.c b/sys/dev/adb/adb_kbd.c index 22ab97d..e66b5b2 100644 --- a/sys/dev/adb/adb_kbd.c +++ b/sys/dev/adb/adb_kbd.c @@ -747,6 +747,7 @@ static int akbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t data) break; case PIO_KEYMAP: + case OPIO_KEYMAP: case PIO_KEYMAPENT: case PIO_DEADKEYMAP: default: diff --git a/sys/dev/atkbdc/atkbd.c b/sys/dev/atkbdc/atkbd.c index f2f5d74..e58ffc7 100644 --- a/sys/dev/atkbdc/atkbd.c +++ b/sys/dev/atkbdc/atkbd.c @@ -982,6 +982,7 @@ atkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg) return error; case PIO_KEYMAP: /* set keyboard translation table */ + case OPIO_KEYMAP: /* set keyboard translation table (compat) */ case PIO_KEYMAPENT: /* set keyboard translation table entry */ case PIO_DEADKEYMAP: /* set accent key translation table */ state->ks_accents = 0; diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c index 21818cb..01e262e 100644 --- a/sys/dev/kbd/kbd.c +++ b/sys/dev/kbd/kbd.c @@ -837,13 +837,12 @@ 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 + okeymap_t *omapp; keyarg_t *keyp; fkeyarg_t *fkeyp; int s; - int i; + int i, j; int error; s = spltty(); @@ -874,14 +873,39 @@ genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg) sizeof(keymap_t)); splx(s); return (error); + case OGIO_KEYMAP: /* get keyboard translation table (compat) */ + mapp = kbd->kb_keymap; + omapp = (okeymap_t *)arg; + omapp->n_keys = mapp->n_keys; + for (i = 0; i < NUM_KEYS; i++) { + for (j = 0; j < NUM_STATES; j++) + omapp->key[i].map[j] = + mapp->key[i].map[j]; + omapp->key[i].spcl = mapp->key[i].spcl; + omapp->key[i].flgs = mapp->key[i].flgs; + } + return (0); case PIO_KEYMAP: /* set keyboard translation table */ + case OPIO_KEYMAP: /* set keyboard translation table (compat) */ #ifndef KBD_DISABLE_KEYMAP_LOAD 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); + if (cmd == OPIO_KEYMAP) { + omapp = (okeymap_t *)arg; + mapp->n_keys = omapp->n_keys; + for (i = 0; i < NUM_KEYS; i++) { + for (j = 0; j < NUM_STATES; j++) + mapp->key[i].map[j] = + omapp->key[i].map[j]; + mapp->key[i].spcl = omapp->key[i].spcl; + mapp->key[i].flgs = omapp->key[i].flgs; + } + } else { + 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); diff --git a/sys/dev/kbdmux/kbdmux.c b/sys/dev/kbdmux/kbdmux.c index 64d5c24..a21b37c 100644 --- a/sys/dev/kbdmux/kbdmux.c +++ b/sys/dev/kbdmux/kbdmux.c @@ -1198,6 +1198,7 @@ kbdmux_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg) break; case PIO_KEYMAP: /* set keyboard translation table */ + case OPIO_KEYMAP: /* set keyboard translation table (compat) */ case PIO_KEYMAPENT: /* set keyboard translation table entry */ case PIO_DEADKEYMAP: /* set accent key translation table */ KBDMUX_LOCK(state); diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index b12b654..69d628e 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -1450,6 +1450,8 @@ sctty_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td) case GIO_KEYMAP: /* get keyboard translation table */ case PIO_KEYMAP: /* set keyboard translation table */ + case OGIO_KEYMAP: /* get keyboard translation table (compat) */ + case OPIO_KEYMAP: /* set keyboard translation table (compat) */ case GIO_DEADKEYMAP: /* get accent key translation table */ case PIO_DEADKEYMAP: /* set accent key translation table */ case GETFKEY: /* get function key string */ diff --git a/sys/dev/uart/uart_kbd_sun.c b/sys/dev/uart/uart_kbd_sun.c index 1564d3f..43c0096 100644 --- a/sys/dev/uart/uart_kbd_sun.c +++ b/sys/dev/uart/uart_kbd_sun.c @@ -739,6 +739,7 @@ sunkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t data) case KDSETRAD: break; case PIO_KEYMAP: + case OPIO_KEYMAP: case PIO_KEYMAPENT: case PIO_DEADKEYMAP: default: diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c index 1ad3bd5..bf3ecd7 100644 --- a/sys/dev/usb/input/ukbd.c +++ b/sys/dev/usb/input/ukbd.c @@ -1929,6 +1929,8 @@ ukbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg) return (ukbd_set_typematic(kbd, *(int *)arg)); case PIO_KEYMAP: /* set keyboard translation table */ + case OPIO_KEYMAP: /* set keyboard translation table + * (compat) */ case PIO_KEYMAPENT: /* set keyboard translation table * entry */ case PIO_DEADKEYMAP: /* set accent key translation table */ diff --git a/sys/dev/vkbd/vkbd.c b/sys/dev/vkbd/vkbd.c index 15cf059..42fca40 100644 --- a/sys/dev/vkbd/vkbd.c +++ b/sys/dev/vkbd/vkbd.c @@ -1208,6 +1208,7 @@ vkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg) break; case PIO_KEYMAP: /* set keyboard translation table */ + case OPIO_KEYMAP: /* set keyboard translation table (compat) */ case PIO_KEYMAPENT: /* set keyboard translation table entry */ case PIO_DEADKEYMAP: /* set accent key translation table */ state->ks_accents = 0; diff --git a/sys/i386/ibcs2/ibcs2_ioctl.c b/sys/i386/ibcs2/ibcs2_ioctl.c index 17749db..90184e3 100644 --- a/sys/i386/ibcs2/ibcs2_ioctl.c +++ b/sys/i386/ibcs2/ibcs2_ioctl.c @@ -654,12 +654,12 @@ ibcs2_ioctl(td, uap) break; case IBCS2_GIO_KEYMAP: /* Get keyboard map table */ - uap->cmd = GIO_KEYMAP; + uap->cmd = OGIO_KEYMAP; error = ioctl(td, (struct ioctl_args *)uap); break; case IBCS2_PIO_KEYMAP: /* Set keyboard map table */ - uap->cmd = PIO_KEYMAP; + uap->cmd = OPIO_KEYMAP; error = ioctl(td, (struct ioctl_args *)uap); break; diff --git a/sys/pc98/cbus/pckbd.c b/sys/pc98/cbus/pckbd.c index 24f7267..5efb983 100644 --- a/sys/pc98/cbus/pckbd.c +++ b/sys/pc98/cbus/pckbd.c @@ -799,6 +799,7 @@ pckbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg) break; case PIO_KEYMAP: /* set keyboard translation table */ + case OPIO_KEYMAP: /* set keyboard translation table (compat) */ case PIO_KEYMAPENT: /* set keyboard translation table entry */ case PIO_DEADKEYMAP: /* set accent key translation table */ state->ks_accents = 0; diff --git a/sys/sys/kbio.h b/sys/sys/kbio.h index 22b0285..7f17bda 100644 --- a/sys/sys/kbio.h +++ b/sys/sys/kbio.h @@ -120,6 +120,20 @@ struct keymap { }; typedef struct keymap keymap_t; +#ifdef _KERNEL +struct okeyent_t { + u_char map[NUM_STATES]; + u_char spcl; + u_char flgs; +}; + +struct okeymap { + u_short n_keys; + struct okeyent_t key[NUM_KEYS]; +}; +typedef struct okeymap okeymap_t; +#endif /* _KERNEL */ + #endif /* !_KEYMAP_DECLARED */ /* defines for "special" keys (spcl bit set in keymap) */ @@ -223,6 +237,10 @@ typedef struct fkeyarg fkeyarg_t; /* XXX: Should have keymap_t as an argument, but that's too big for ioctl()! */ #define GIO_KEYMAP _IO('k', 6) #define PIO_KEYMAP _IO('k', 7) +#ifdef _KERNEL +#define OGIO_KEYMAP _IOR('k', 6, okeymap_t) +#define OPIO_KEYMAP _IOW('k', 7, okeymap_t) +#endif /* _KERNEL */ #define GIO_DEADKEYMAP _IOR('k', 8, accentmap_t) #define PIO_DEADKEYMAP _IOW('k', 9, accentmap_t) #define GIO_KEYMAPENT _IOWR('k', 10, keyarg_t) |