Added a separate keymap for escaped scancodes. This makes the code

a little cleaner (escaped scancodes are less of a special case) and
lets us be completely flexible when assigning meaning to them.

Future: a tool and ioctl to load the escaped keymap.
This commit is contained in:
Ben Gras 2009-02-04 17:04:16 +00:00
parent ba4687e519
commit 6a0e8e3b80
19 changed files with 23 additions and 60 deletions

View File

@ -18,7 +18,14 @@
#include <minix/com.h>
#include <minix/keymap.h>
#include "tty.h"
u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
#include "keymaps/us-std.src"
};
u16_t keymap_escaped[NR_SCAN_CODES * MAP_COLS] = {
#include "keymaps/us-std-esc.src"
};
int irq_hook_id = -1;
int aux_irq_hook_id = -1;
@ -467,7 +474,10 @@ int scode;
if (scode == SLASH_SCAN && esc) return '/'; /* don't map numeric slash */
keyrow = &keymap[scode * MAP_COLS];
if(esc)
keyrow = &keymap[scode * MAP_COLS];
else
keyrow = &keymap_escaped[scode * MAP_COLS];
caps = shift;
lk = locks[ccurrent];
@ -737,7 +747,6 @@ int scode; /* scan code of key just struck or released */
alt_down = make;
break;
case CALOCK: /* Caps lock - toggle on 0 -> 1 transition */
if(escape) return -1;
if (caps_down < make) {
locks[ccurrent] ^= CAPS_LOCK;
set_leds();
@ -745,7 +754,6 @@ int scode; /* scan code of key just struck or released */
caps_down = make;
break;
case NLOCK: /* Num lock */
if(escape) return -1;
if (num_down < make) {
locks[ccurrent] ^= NUM_LOCK;
set_leds();
@ -753,7 +761,6 @@ int scode; /* scan code of key just struck or released */
num_down = make;
break;
case SLOCK: /* Scroll lock */
if(escape) return -1;
if (scroll_down < make) {
locks[ccurrent] ^= SCROLL_LOCK;
set_leds();
@ -764,13 +771,9 @@ int scode; /* scan code of key just struck or released */
esc = 1; /* Next key is escaped */
return(-1);
default: /* A normal key */
if(escape) {
printf("tty: ignoring escaped 0x%x\n", scode);
return -1;
}
if(!ch) {
printf("tty: ignoring unrecognized scancode 0x%x\n",
scode);
printf("tty: ignoring unrecognized %s scancode 0x%x\n",
esc ? "escaped" : "straight", scode);
return -1;
}
if(make) return(ch);

View File

@ -24,6 +24,7 @@ all: \
spanish.map \
uk.map \
us-std.map \
us-std-esc.map \
us-swap.map \
install: \
@ -42,6 +43,7 @@ install: \
$(LK)/spanish.map \
$(LK)/uk.map \
$(LK)/us-std.map \
$(LK)/us-std-esc.map \
$(LK)/us-swap.map \
clean:
@ -92,5 +94,8 @@ $(LK)/uk.map: uk.map
$(LK)/us-std.map: us-std.map
install -c $? $@
$(LK)/us-std-esc.map: us-std-esc.map
install -c $? $@
$(LK)/us-swap.map: us-swap.map
install -c $? $@

View File

@ -3,8 +3,6 @@
* Contributed by: Ulrich Hobelmann <u.hobelmann@web.de>
*/
u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/* scan-code !Shift Shift Alt1 Alt2 Alt+Sh Ctrl */
/* ==================================================================== */
/* 00 - none */ 0, 0, 0, 0, 0, 0,
@ -135,5 +133,3 @@ u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/*125 - ??? */ 0, 0, 0, 0, 0, 0,
/*126 - ??? */ 0, 0, 0, 0, 0, 0,
/*127 - ??? */ 0, 0, 0, 0, 0, 0
};

View File

@ -1,7 +1,5 @@
/* Keymap for the French keyboard. */
u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/* scan-code !Shift Shift Alt AltGr Alt+Sh Ctrl */
/* ==================================================================== */
/* 00 - none */ 0, 0, 0, 0, 0, 0,
@ -132,4 +130,3 @@ u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/*125 - ??? */ 0, 0, 0, 0, 0, 0,
/*126 - ??? */ 0, 0, 0, 0, 0, 0,
/*127 - ??? */ 0, 0, 0, 0, 0, 0
};

View File

@ -8,7 +8,9 @@
#include <string.h>
#include <errno.h>
u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
#include KEYSRC
};
u8_t comprmap[4 + NR_SCAN_CODES * MAP_COLS * 9/8 * 2 + 1];

View File

@ -1,7 +1,5 @@
/* Keymap for German MF-2 keyboard. */
u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/* scan-code unsh Shift Alt AltGr Alt+Sh Strg */
/* ==================================================================== */
/* 00 - none */ 0, 0, 0, 0, 0, 0,
@ -132,4 +130,3 @@ u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/*125 - ??? */ 0, 0, 0, 0, 0, 0,
/*126 - ??? */ 0, 0, 0, 0, 0, 0,
/*127 - ??? */ 0, 0, 0, 0, 0, 0
};

View File

@ -2,8 +2,6 @@
/* Modified by Ernesto Del Prete in October 1997 */
/* ernesto@cclix1.polito.it or s84508@cclix1.polito.it */
u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/* scan-code !Shift Shift Alt AltGr Alt+Sh Ctrl */
/* ==================================================================== */
/* 00 - none */ 0, 0, 0, 0, 0, 0,
@ -134,4 +132,3 @@ u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/*125 - ??? */ 0, 0, 0, 0, 0, 0,
/*126 - ??? */ 0, 0, 0, 0, 0, 0,
/*127 - ??? */ 0, 0, 0, 0, 0, 0
};

View File

@ -22,8 +22,6 @@
#error NR_SCAN_CODES mis-match
#endif
u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/* scan-code !Shift Shift Alt1 Alt2 Alt+Sh Ctrl */
/* ==================================================================== */
/* 00 - none */ 0, 0, 0, 0, 0, 0,
@ -154,4 +152,3 @@ u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/*125 - YEN */ '\\', '|', A('\\'),A('\\'),A('|'), C('\\'),
/*126 - ??? */ 0, 0, 0, 0, 0, 0,
/*127 - ??? */ 0, 0, 0, 0, 0, 0
};

View File

@ -18,8 +18,6 @@
#error NR_SCAN_CODES mis-match
#endif
u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/* scan-code !Shift Shift Alt1 Alt2 Alt+Sh Ctrl */
/* ==================================================================== */
/* 00 - none */ 0, 0, 0, 0, 0, 0,
@ -150,4 +148,3 @@ u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/*125 - ??? */ 0, 0, 0, 0, 0, 0,
/*126 - ??? */ 0, 0, 0, 0, 0, 0,
/*127 - ??? */ 0, 0, 0, 0, 0, 0
};

View File

@ -1,7 +1,5 @@
/* Keymap for the Olivetti M24. */
u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/* scan-code !Shift Shift Alt1 Alt2 Alt+Sh Ctrl */
/* ==================================================================== */
/* 00 - none */ 0, 0, 0, 0, 0, 0,
@ -132,4 +130,3 @@ u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/*125 - ??? */ 0, 0, 0, 0, 0, 0,
/*126 - ??? */ 0, 0, 0, 0, 0, 0,
/*127 - ??? */ 0, 0, 0, 0, 0, 0
};

View File

@ -4,9 +4,6 @@
* Charset: ISO-8859-2 - [Polska Norma PN-93 T-42118]
*/
u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/* scan-code !Shift Shift Alt1 Alt2 Alt+Sh Ctrl */
/* ==================================================================== */
/* 00 - none */ 0, 0, 0, 0, 0, 0,
@ -137,4 +134,3 @@ u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/*125 - ??? */ 0, 0, 0, 0, 0, 0,
/*126 - ??? */ 0, 0, 0, 0, 0, 0,
/*127 - ??? */ 0, 0, 0, 0, 0, 0
};

View File

@ -3,8 +3,6 @@
* Modified by Roman V. Ignatov <ignatov@minix3.ru>
* Charset: cp866
*/
u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/* scan-code !Shift Shift Alt1 Alt2 Alt+Sh Ctrl */
/* ==================================================================== */
@ -136,4 +134,3 @@ u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/*125 - ??? */ 0, 0, 0, 0, 0, 0,
/*126 - ??? */ 0, 0, 0, 0, 0, 0,
/*127 - ??? */ 0, 0, 0, 0, 0, 0
};

View File

@ -3,8 +3,6 @@
* Modified by Roman V. Ignatov <ignatov@minix3.ru>
* Charset: koi8-r
*/
u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/* scan-code !Shift Shift Alt1 Alt2 Alt+Sh Ctrl */
/* ==================================================================== */
@ -136,4 +134,3 @@ u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/*125 - ??? */ 0, 0, 0, 0, 0, 0,
/*126 - ??? */ 0, 0, 0, 0, 0, 0,
/*127 - ??? */ 0, 0, 0, 0, 0, 0
};

View File

@ -3,8 +3,6 @@
* preliminary version, 8 Sept 1996
*/
u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/* scan-code unsh Shift Alt AltGr Alt+Sh Ctrl */
/* ==================================================================== */
/* 00 - none */ 0, 0, 0, 0, 0, 0,
@ -135,4 +133,3 @@ u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/*125 - ??? */ 0, 0, 0, 0, 0, 0,
/*126 - ??? */ 0, 0, 0, 0, 0, 0,
/*127 - ??? */ 0, 0, 0, 0, 0, 0
};

View File

@ -1,8 +1,6 @@
/* Keymap for Spanish MF-2 keyboard. */
/* Modified by Javier Garcia Martin jawa@inf.deusto.es */
u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/* scan-code !Shift Shift Alt AltGr Alt+Sh Ctrl */
/*
====================================================================
@ -135,4 +133,3 @@ u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/*125 - ??? */ 0, 0, 0, 0, 0, 0,
/*126 - ??? */ 0, 0, 0, 0, 0, 0,
/*127 - ??? */ 0, 0, 0, 0, 0, 0
};

View File

@ -1,7 +1,5 @@
/* Keymap for standard UK keyboard. Author: Darren Mason */
u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/* scan-code !Shift Shift Alt1 Alt2 Alt+Sh Ctrl */
/* ==================================================================== */
/* 00 - none */ 0, 0, 0, 0, 0, 0,
@ -132,4 +130,3 @@ u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/*125 - ??? */ 0, 0, 0, 0, 0, 0,
/*126 - ??? */ 0, 0, 0, 0, 0, 0,
/*127 - ??? */ 0, 0, 0, 0, 0, 0
};

View File

@ -60,7 +60,7 @@
/* 55 - '*' */ '*', '*', A('*'), A('*'), A('*'), C('@'),
/* 56 - ALT */ ALT, ALT, ALT, ALT, ALT, ALT,
/* 57 - ' ' */ ' ', ' ', A(' '), A(' '), A(' '), C('@'),
/* 58 - CapsLck */ CALOCK, CALOCK, CALOCK, CALOCK, CALOCK, CALOCK,
/* 58 - CapsLck */ 0, 0, 0, 0, 0, 0,
/* 59 - F1 */ F1, SF1, AF1, AF1, ASF1, CF1,
/* 60 - F2 */ F2, SF2, AF2, AF2, ASF2, CF2,
/* 61 - F3 */ F3, SF3, AF3, AF3, ASF3, CF3,
@ -71,8 +71,8 @@
/* 66 - F8 */ F8, SF8, AF8, AF8, ASF8, CF8,
/* 67 - F9 */ F9, SF9, AF9, AF9, ASF9, CF9,
/* 68 - F10 */ F10, SF10, AF10, AF10, ASF10, CF10,
/* 69 - NumLock */ NLOCK, NLOCK, NLOCK, NLOCK, NLOCK, NLOCK,
/* 70 - ScrLock */ SLOCK, SLOCK, SLOCK, SLOCK, SLOCK, SLOCK,
/* 69 - NumLock */ 0, 0, 0, 0, 0, 0,
/* 70 - ScrLock */ 0, 0, 0, 0, 0, 0,
/* 71 - Home */ HOME, '7', AHOME, AHOME, A('7'), CHOME,
/* 72 - CurUp */ UP, '8', AUP, AUP, A('8'), CUP,
/* 73 - PgUp */ PGUP, '9', APGUP, APGUP, A('9'), CPGUP,

View File

@ -1,7 +1,5 @@
/* Keymap for US MF-2 keyboard. */
u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/* scan-code !Shift Shift Alt1 Alt2 Alt+Sh Ctrl */
/* ==================================================================== */
/* 00 - none */ 0, 0, 0, 0, 0, 0,
@ -132,4 +130,3 @@ u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/*125 - ??? */ 0, 0, 0, 0, 0, 0,
/*126 - ??? */ 0, 0, 0, 0, 0, 0,
/*127 - ??? */ 0, 0, 0, 0, 0, 0
};

View File

@ -1,7 +1,5 @@
/* Keymap for US MF-2 keyboard with the Caps Lock and Control key swapped. */
u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/* scan-code !Shift Shift Alt1 Alt2 Alt+Sh Ctrl */
/* ==================================================================== */
/* 00 - none */ 0, 0, 0, 0, 0, 0,
@ -132,4 +130,3 @@ u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
/*125 - ??? */ 0, 0, 0, 0, 0, 0,
/*126 - ??? */ 0, 0, 0, 0, 0, 0,
/*127 - ??? */ 0, 0, 0, 0, 0, 0
};