1 /* $NetBSD: kbd_tables.c,v 1.9 2005/12/11 12:23:56 christos Exp $ */
4 * Copyright (c) 1996 Gordon W. Ross
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 * Keyboard translation tables. (See kbd_tables.h)
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD: kbd_tables.c,v 1.9 2005/12/11 12:23:56 christos Exp $");
35 #include <sys/types.h>
37 #define _KERNEL 1 /* XXX */
38 #include "kbd_tables.h"
41 /* The "compose" operations are not implemented. */
42 #define KEYSYM_COMPOSE KEYSYM_NOP
46 * Key release codes are decoded in this map.
48 u_short keymap_release
[KEYMAP_SIZE
] = {
50 /* 1: L1/Stop */ KEYSYM_NOP
,
52 /* 3: L2/Again */ KEYSYM_NOP
,
54 /* 5: F1 */ KEYSYM_NOP
,
55 /* 6: F2 */ KEYSYM_NOP
,
56 /* 7: F10 */ KEYSYM_NOP
,
57 /* 8: F3 */ KEYSYM_NOP
,
58 /* 9: F11 */ KEYSYM_NOP
,
59 /* 10: F4 */ KEYSYM_NOP
,
60 /* 11: F12 */ KEYSYM_NOP
,
61 /* 12: F5 */ KEYSYM_NOP
,
62 /* 13: AltGraph */ KEYSYM_CLRMOD
| KBMOD_ALTGRAPH
,
63 /* 14: F6 */ KEYSYM_NOP
,
64 /* 15: */ KEYSYM_HOLE
,
65 /* 16: F7 */ KEYSYM_NOP
,
66 /* 17: F8 */ KEYSYM_NOP
,
67 /* 18: F9 */ KEYSYM_NOP
,
68 /* 19: Alt_L */ KEYSYM_CLRMOD
| KBMOD_ALT_L
,
69 /* 20: T5_Up */ KEYSYM_NOP
,
70 /* 21: R1/Pause */ KEYSYM_NOP
,
71 /* 22: R2/Print */ KEYSYM_NOP
,
72 /* 23: R3/Break */ KEYSYM_NOP
,
73 /* 24: T5_Left */ KEYSYM_NOP
,
74 /* 25: L3/Props */ KEYSYM_NOP
,
75 /* 26: L4/Undo */ KEYSYM_NOP
,
76 /* 27: T5_Down */ KEYSYM_NOP
,
77 /* 28: T5_Right */ KEYSYM_NOP
,
78 /* 29: Esc */ KEYSYM_NOP
,
79 /* 30: 1 */ KEYSYM_NOP
,
80 /* 31: 2 */ KEYSYM_NOP
,
81 /* 32: 3 */ KEYSYM_NOP
,
82 /* 33: 4 */ KEYSYM_NOP
,
83 /* 34: 5 */ KEYSYM_NOP
,
84 /* 35: 6 */ KEYSYM_NOP
,
85 /* 36: 7 */ KEYSYM_NOP
,
86 /* 37: 8 */ KEYSYM_NOP
,
87 /* 38: 9 */ KEYSYM_NOP
,
88 /* 39: 0 */ KEYSYM_NOP
,
89 /* 40: minus */ KEYSYM_NOP
,
90 /* 41: equal */ KEYSYM_NOP
,
91 /* 42: grave/tilde */ KEYSYM_NOP
,
92 /* 43: BackSpace */ KEYSYM_NOP
,
93 /* 44: T5_Insert */ KEYSYM_NOP
,
94 /* 45: R4/KP_Equal */ KEYSYM_NOP
,
95 /* 46: R5/KP_Div */ KEYSYM_NOP
,
96 /* 47: R6/KP_Mult */ KEYSYM_NOP
,
98 /* 49: L5/Front */ KEYSYM_NOP
,
99 /* 50: KP_Delete */ KEYSYM_NOP
,
100 /* 51: L6/Copy */ KEYSYM_NOP
,
101 /* 52: T5_Home */ KEYSYM_NOP
,
102 /* 53: Tab */ KEYSYM_NOP
,
103 /* 54: Q */ KEYSYM_NOP
,
104 /* 55: W */ KEYSYM_NOP
,
105 /* 56: E */ KEYSYM_NOP
,
106 /* 57: R */ KEYSYM_NOP
,
107 /* 58: T */ KEYSYM_NOP
,
108 /* 59: Y */ KEYSYM_NOP
,
109 /* 60: U */ KEYSYM_NOP
,
110 /* 61: I */ KEYSYM_NOP
,
111 /* 62: O */ KEYSYM_NOP
,
112 /* 63: P */ KEYSYM_NOP
,
113 /* 64: [ */ KEYSYM_NOP
,
114 /* 65: ] */ KEYSYM_NOP
,
115 /* 66: Delete */ KEYSYM_NOP
,
116 /* 67: Compose */ KEYSYM_NOP
,
117 /* 68: R7/Home */ KEYSYM_NOP
,
118 /* 69: R8/Up */ KEYSYM_NOP
,
119 /* 70: R9/PgUp */ KEYSYM_NOP
,
120 /* 71: KP_Minus */ KEYSYM_NOP
,
121 /* 72: L7/Open */ KEYSYM_NOP
,
122 /* 73: L8/Paste */ KEYSYM_NOP
,
123 /* 74: T5_End */ KEYSYM_NOP
,
124 /* 75: */ KEYSYM_HOLE
,
125 /* 76: Ctrl_L */ KEYSYM_CLRMOD
| KBMOD_CTRL_L
,
126 /* 77: A */ KEYSYM_NOP
,
127 /* 78: S */ KEYSYM_NOP
,
128 /* 79: D */ KEYSYM_NOP
,
129 /* 80: F */ KEYSYM_NOP
,
130 /* 81: G */ KEYSYM_NOP
,
131 /* 82: H */ KEYSYM_NOP
,
132 /* 83: J */ KEYSYM_NOP
,
133 /* 84: K */ KEYSYM_NOP
,
134 /* 85: L */ KEYSYM_NOP
,
135 /* 86: ; */ KEYSYM_NOP
,
136 /* 87: apostr. */ KEYSYM_NOP
,
137 /* 88: backslash */ KEYSYM_NOP
,
138 /* 89: Return */ KEYSYM_NOP
,
139 /* 90: KP_Enter */ KEYSYM_NOP
,
140 /* 91: R10/Left */ KEYSYM_NOP
,
141 /* 92: R11/KP_5 */ KEYSYM_NOP
,
142 /* 93: R12/Right */ KEYSYM_NOP
,
143 /* 94: KP_Insert */ KEYSYM_NOP
,
144 /* 95: L9/Find */ KEYSYM_NOP
,
145 /* 96: T5_PgUp */ KEYSYM_NOP
,
146 /* 97: L10/Cut */ KEYSYM_NOP
,
147 /* 98: Num_Lock */ KEYSYM_NOP
,
148 /* 99: Shift_L */ KEYSYM_CLRMOD
| KBMOD_SHIFT_L
,
149 /* 100: Z */ KEYSYM_NOP
,
150 /* 101: X */ KEYSYM_NOP
,
151 /* 102: C */ KEYSYM_NOP
,
152 /* 103: V */ KEYSYM_NOP
,
153 /* 104: B */ KEYSYM_NOP
,
154 /* 105: N */ KEYSYM_NOP
,
155 /* 106: M */ KEYSYM_NOP
,
156 /* 107: , */ KEYSYM_NOP
,
157 /* 108: . */ KEYSYM_NOP
,
158 /* 109: / */ KEYSYM_NOP
,
159 /* 110: Shift_R */ KEYSYM_CLRMOD
| KBMOD_SHIFT_R
,
160 /* 111: Linefeed */ KEYSYM_NOP
,
161 /* 112: R13/End */ KEYSYM_NOP
,
162 /* 113: R14/Down */ KEYSYM_NOP
,
163 /* 114: R15/PgDn */ KEYSYM_NOP
,
164 /* 115: */ KEYSYM_HOLE
,
165 /* 116: */ KEYSYM_HOLE
,
166 /* 117: */ KEYSYM_HOLE
,
167 /* 118: L16/Help */ KEYSYM_NOP
,
168 /* 119: CapsLock */ KEYSYM_NOP
,
169 /* 120: Meta_L */ KEYSYM_CLRMOD
| KBMOD_META_L
,
170 /* 121: SpaceBar */ KEYSYM_NOP
,
171 /* 122: Meta_R */ KEYSYM_CLRMOD
| KBMOD_META_R
,
172 /* 123: T5_PgDn */ KEYSYM_NOP
,
173 /* 124: */ KEYSYM_HOLE
,
174 /* 125: KP_Add */ KEYSYM_NOP
,
175 /* 126: */ KEYSYM_LAYOUT
, /* layout next */
176 /* 127: */ KEYSYM_RESET
, /* kbd ID next */
181 * This map is used when a control key is down.
183 #define CTL(c) ((c)&0x1F)
184 u_short keymap_control
[KEYMAP_SIZE
] = {
185 /* 0: */ KEYSYM_HOLE
,
186 /* 1: L1/Stop */ KEYSYM_NOP
,
187 /* 2: */ KEYSYM_HOLE
,
188 /* 3: L2/Again */ KEYSYM_NOP
,
189 /* 4: */ KEYSYM_HOLE
,
190 /* 5: F1 */ KEYSYM_NOP
,
191 /* 6: F2 */ KEYSYM_NOP
,
192 /* 7: F10 */ KEYSYM_NOP
,
193 /* 8: F3 */ KEYSYM_NOP
,
194 /* 9: F11 */ KEYSYM_NOP
,
195 /* 10: F4 */ KEYSYM_NOP
,
196 /* 11: F12 */ KEYSYM_NOP
,
197 /* 12: F5 */ KEYSYM_NOP
,
198 /* 13: AltGraph */ KEYSYM_SETMOD
| KBMOD_ALTGRAPH
,
199 /* 14: F6 */ KEYSYM_NOP
,
200 /* 15: */ KEYSYM_HOLE
,
201 /* 16: F7 */ KEYSYM_NOP
,
202 /* 17: F8 */ KEYSYM_NOP
,
203 /* 18: F9 */ KEYSYM_NOP
,
204 /* 19: Alt_L */ KEYSYM_SETMOD
| KBMOD_ALT_L
,
205 /* 20: T5_Up */ KEYSYM_NOP
,
206 /* 21: R1/Pause */ KEYSYM_NOP
,
207 /* 22: R2/Print */ KEYSYM_NOP
,
208 /* 23: R3/Break */ KEYSYM_NOP
,
209 /* 24: T5_Left */ KEYSYM_NOP
,
210 /* 25: L3/Props */ KEYSYM_NOP
,
211 /* 26: L4/Undo */ KEYSYM_NOP
,
212 /* 27: T5_Down */ KEYSYM_NOP
,
213 /* 28: T5_Right */ KEYSYM_NOP
,
215 /* 30: 1 */ KEYSYM_NOP
,
216 /* 31: 2 */ CTL('@'),
217 /* 32: 3 */ KEYSYM_NOP
,
218 /* 33: 4 */ KEYSYM_NOP
,
219 /* 34: 5 */ KEYSYM_NOP
,
220 /* 35: 6 */ CTL('^'),
221 /* 36: 7 */ KEYSYM_NOP
,
222 /* 37: 8 */ KEYSYM_NOP
,
223 /* 38: 9 */ KEYSYM_NOP
,
224 /* 39: 0 */ KEYSYM_NOP
,
225 /* 40: minus _ */ CTL('_'),
226 /* 41: equal */ KEYSYM_NOP
,
227 /* 42: grave/tilde */ CTL('~'),
228 /* 43: BackSpace */ '\b',
229 /* 44: T5_Insert */ KEYSYM_NOP
,
230 /* 45: R4/KP_Equal */ KEYSYM_NOP
,
231 /* 46: R5/KP_Div */ KEYSYM_NOP
,
232 /* 47: R6/KP_Mult */ KEYSYM_NOP
,
233 /* 48: */ KEYSYM_NOP
,
234 /* 49: L5/Front */ KEYSYM_NOP
,
235 /* 50: KP_Delete */ KEYSYM_NOP
,
236 /* 51: L6/Copy */ KEYSYM_NOP
,
237 /* 52: T5_Home */ KEYSYM_NOP
,
239 /* 54: Q */ CTL('Q'),
240 /* 55: W */ CTL('W'),
241 /* 56: E */ CTL('E'),
242 /* 57: R */ CTL('R'),
243 /* 58: T */ CTL('T'),
244 /* 59: Y */ CTL('Y'),
245 /* 60: U */ CTL('U'),
246 /* 61: I */ CTL('I'),
247 /* 62: O */ CTL('O'),
248 /* 63: P */ CTL('P'),
249 /* 64: [ */ CTL('['),
250 /* 65: ] */ CTL(']'),
251 /* 66: Delete */ 0x7f,
252 /* 67: Compose */ KEYSYM_COMPOSE
,
253 /* 68: R7/Home */ CTL('A'), /* emacs */
254 /* 69: R8/Up */ CTL('P'), /* emacs */
255 /* 70: R9/PgUp */ 0x80|'v', /* emacs */
256 /* 71: KP_Minus */ KEYSYM_NOP
,
257 /* 72: L7/Open */ KEYSYM_NOP
,
258 /* 73: L8/Paste */ KEYSYM_NOP
,
259 /* 74: T5_End */ KEYSYM_NOP
,
260 /* 75: */ KEYSYM_HOLE
,
261 /* 76: Ctrl_L */ KEYSYM_SETMOD
| KBMOD_CTRL_L
,
262 /* 77: A */ CTL('A'),
263 /* 78: S */ CTL('S'),
264 /* 79: D */ CTL('D'),
265 /* 80: F */ CTL('F'),
266 /* 81: G */ CTL('G'),
267 /* 82: H */ CTL('H'),
268 /* 83: J */ CTL('J'),
269 /* 84: K */ CTL('K'),
270 /* 85: L */ CTL('L'),
271 /* 86: ; */ KEYSYM_NOP
,
272 /* 87: apostr. */ KEYSYM_NOP
,
273 /* 88: backslash */ CTL('\\'),
274 /* 89: Return */ '\r',
275 /* 90: KP_Enter */ KEYSYM_NOP
,
276 /* 91: R10/Left */ CTL('B'), /* emacs */
277 /* 92: R11/KP_5 */ KEYSYM_NOP
,
278 /* 93: R12/Right */ CTL('F'), /* emacs */
279 /* 94: KP_Insert */ KEYSYM_NOP
,
280 /* 95: L9/Find */ KEYSYM_NOP
,
281 /* 96: T5_PgUp */ KEYSYM_NOP
,
282 /* 97: L10/Cut */ KEYSYM_NOP
,
283 /* 98: Num_Lock */ KEYSYM_INVMOD
| KBMOD_NUMLOCK
,
284 /* 99: Shift_L */ KEYSYM_SETMOD
| KBMOD_SHIFT_L
,
285 /* 100: Z */ CTL('Z'),
286 /* 101: X */ CTL('X'),
287 /* 102: C */ CTL('C'),
288 /* 103: V */ CTL('V'),
289 /* 104: B */ CTL('B'),
290 /* 105: N */ CTL('N'),
291 /* 106: M */ CTL('M'),
292 /* 107: , */ KEYSYM_NOP
,
293 /* 108: . */ KEYSYM_NOP
,
294 /* 109: / ? */ CTL('?'),
295 /* 110: Shift_R */ KEYSYM_SETMOD
| KBMOD_SHIFT_R
,
296 /* 111: Linefeed */ '\n',
297 /* 112: R13/End */ CTL('E'), /* emacs */
298 /* 113: R14/Down */ CTL('N'), /* emacs */
299 /* 114: R15/PgDn */ CTL('V'), /* emacs */
300 /* 115: */ KEYSYM_HOLE
,
301 /* 116: */ KEYSYM_HOLE
,
302 /* 117: */ KEYSYM_HOLE
,
303 /* 118: L16/Help */ KEYSYM_NOP
,
304 /* 119: CapsLock */ KEYSYM_INVMOD
| KBMOD_CAPSLOCK
,
305 /* 120: Meta_L */ KEYSYM_SETMOD
| KBMOD_META_L
,
306 /* 121: SpaceBar */ CTL(' '),
307 /* 122: Meta_R */ KEYSYM_SETMOD
| KBMOD_META_R
,
308 /* 123: T5_PgDn */ KEYSYM_NOP
,
309 /* 124: */ KEYSYM_HOLE
,
310 /* 125: KP_Add */ KEYSYM_NOP
,
311 /* 126: */ KEYSYM_HW_ERR
,
312 /* 127: */ KEYSYM_ALL_UP
,
318 * Keymaps for the "type 3" keyboard.
319 * (lower-case, upper-case)
322 u_short keymap_s3_lc
[KEYMAP_SIZE
] = {
323 /* 0: */ KEYSYM_HOLE
,
324 /* 1: L1/Stop */ KEYSYM_FUNC_L(1),
325 /* 2: */ KEYSYM_HOLE
,
326 /* 3: L2/Again */ KEYSYM_FUNC_L(2),
327 /* 4: */ KEYSYM_HOLE
,
328 /* 5: F1 */ KEYSYM_FUNC_F(1),
329 /* 6: F2 */ KEYSYM_FUNC_F(2),
330 /* 7: F10 */ KEYSYM_HOLE
,
331 /* 8: F3 */ KEYSYM_FUNC_F(3),
332 /* 9: F11 */ KEYSYM_HOLE
,
333 /* 10: F4 */ KEYSYM_FUNC_F(4),
334 /* 11: F12 */ KEYSYM_HOLE
,
335 /* 12: F5 */ KEYSYM_FUNC_F(5),
336 /* 13: AltGraph */ KEYSYM_HOLE
,
337 /* 14: F6 */ KEYSYM_FUNC_F(6),
338 /* 15: */ KEYSYM_HOLE
,
339 /* 16: F7 */ KEYSYM_FUNC_F(7),
340 /* 17: F8 */ KEYSYM_FUNC_F(8),
341 /* 18: F9 */ KEYSYM_FUNC_F(9),
342 /* 19: Alt_L */ KEYSYM_SETMOD
| KBMOD_ALT_L
,
343 /* 20: T5_Up */ KEYSYM_HOLE
,
344 /* 21: R1/Pause */ KEYSYM_FUNC_R(1),
345 /* 22: R2/Print */ KEYSYM_FUNC_R(2),
346 /* 23: R3/Break */ KEYSYM_FUNC_R(3),
347 /* 24: T5_Left */ KEYSYM_HOLE
,
348 /* 25: L3/Props */ KEYSYM_FUNC_L(3),
349 /* 26: L4/Undo */ KEYSYM_FUNC_L(4),
350 /* 27: T5_Down */ KEYSYM_HOLE
,
351 /* 28: T5_Right */ KEYSYM_HOLE
,
365 /* 42: grave/tilde */ '`',
366 /* 43: BackSpace */ '\b',
367 /* 44: */ KEYSYM_HOLE
,
368 /* 45: R4/KP_Equal */ KEYSYM_FUNC_R(4),
369 /* 46: R5/KP_Div */ KEYSYM_FUNC_R(5),
370 /* 47: R6/KP_Mult */ KEYSYM_FUNC_R(6),
371 /* 48: */ KEYSYM_HOLE
,
372 /* 49: L5/Front */ KEYSYM_FUNC_L(5),
373 /* 50: KP_Delete */ KEYSYM_HOLE
,
374 /* 51: L6/Copy */ KEYSYM_FUNC_L(6),
375 /* 52: */ KEYSYM_HOLE
,
389 /* 66: Delete */ 0x7f,
390 /* 67: Compose */ KEYSYM_HOLE
,
391 /* 68: R7/Home */ KEYSYM_FUNC_R(7),
392 /* 69: R8/Up */ KEYSYM_FUNC_R(8),
393 /* 70: R9/PgUp */ KEYSYM_FUNC_R(9),
394 /* 71: KP_Minus */ KEYSYM_HOLE
,
395 /* 72: L7/Open */ KEYSYM_FUNC_L(7),
396 /* 73: L8/Paste */ KEYSYM_FUNC_L(8),
397 /* 74: */ KEYSYM_HOLE
,
398 /* 75: */ KEYSYM_HOLE
,
399 /* 76: Ctrl_L */ KEYSYM_SETMOD
| KBMOD_CTRL_L
,
410 /* 87: apostr. */ '\'',
411 /* 88: backslash */ '\\',
412 /* 89: Return */ '\r',
413 /* 90: KP_Enter */ KEYSYM_HOLE
,
414 /* 91: R10/Left */ KEYSYM_FUNC_R(10),
415 /* 92: R11/KP_5 */ KEYSYM_FUNC_R(11),
416 /* 93: R12/Right */ KEYSYM_FUNC_R(12),
417 /* 94: KP_Insert */ KEYSYM_HOLE
,
418 /* 95: L9/Find */ KEYSYM_FUNC_L(9),
419 /* 96: */ KEYSYM_HOLE
,
420 /* 97: L10/Cut */ KEYSYM_FUNC_L(10),
421 /* 98: Num_Lock */ KEYSYM_HOLE
,
422 /* 99: Shift_L */ KEYSYM_SETMOD
| KBMOD_SHIFT_L
,
433 /* 110: Shift_R */ KEYSYM_SETMOD
| KBMOD_SHIFT_R
,
434 /* 111: Linefeed */ '\n',
435 /* 112: R13/End */ KEYSYM_FUNC_R(13),
436 /* 113: R14/Down */ KEYSYM_FUNC_R(14),
437 /* 114: R15/PgDn */ KEYSYM_FUNC_R(15),
438 /* 115: */ KEYSYM_HOLE
,
439 /* 116: */ KEYSYM_HOLE
,
440 /* 117: */ KEYSYM_HOLE
,
441 /* 118: L16/Help */ KEYSYM_HOLE
,
442 /* 119: CapsLock */ KEYSYM_INVMOD
| KBMOD_CAPSLOCK
,
443 /* 120: Meta_L */ KEYSYM_SETMOD
| KBMOD_META_L
,
444 /* 121: SpaceBar */ ' ',
445 /* 122: Meta_R */ KEYSYM_SETMOD
| KBMOD_META_R
,
446 /* 123: */ KEYSYM_HOLE
,
447 /* 124: */ KEYSYM_HOLE
,
448 /* 125: KP_Add */ KEYSYM_HOLE
,
449 /* 126: */ KEYSYM_HW_ERR
,
450 /* 127: */ KEYSYM_ALL_UP
,
454 u_short keymap_s3_uc
[KEYMAP_SIZE
] = {
455 /* 0: */ KEYSYM_HOLE
,
456 /* 1: L1/Stop */ KEYSYM_FUNC_L(1),
457 /* 2: */ KEYSYM_HOLE
,
458 /* 3: L2/Again */ KEYSYM_FUNC_L(2),
459 /* 4: */ KEYSYM_HOLE
,
460 /* 5: F1 */ KEYSYM_FUNC_F(1),
461 /* 6: F2 */ KEYSYM_FUNC_F(2),
462 /* 7: F10 */ KEYSYM_HOLE
,
463 /* 8: F3 */ KEYSYM_FUNC_F(3),
464 /* 9: F11 */ KEYSYM_HOLE
,
465 /* 10: F4 */ KEYSYM_FUNC_F(4),
466 /* 11: F12 */ KEYSYM_HOLE
,
467 /* 12: F5 */ KEYSYM_FUNC_F(5),
468 /* 13: AltGraph */ KEYSYM_HOLE
,
469 /* 14: F6 */ KEYSYM_FUNC_F(6),
470 /* 15: */ KEYSYM_HOLE
,
471 /* 16: F7 */ KEYSYM_FUNC_F(7),
472 /* 17: F8 */ KEYSYM_FUNC_F(8),
473 /* 18: F9 */ KEYSYM_FUNC_F(9),
474 /* 19: Alt_L */ KEYSYM_SETMOD
| KBMOD_ALT_L
,
475 /* 20: T5_Up */ KEYSYM_HOLE
,
476 /* 21: R1/Pause */ KEYSYM_FUNC_R(1),
477 /* 22: R2/Print */ KEYSYM_FUNC_R(2),
478 /* 23: R3/Break */ KEYSYM_FUNC_R(3),
479 /* 24: T5_Left */ KEYSYM_HOLE
,
480 /* 25: L3/Props */ KEYSYM_FUNC_L(3),
481 /* 26: L4/Undo */ KEYSYM_FUNC_L(4),
482 /* 27: T5_Down */ KEYSYM_HOLE
,
483 /* 28: T5_Right */ KEYSYM_HOLE
,
497 /* 42: grave/tilde */ '~',
498 /* 43: BackSpace */ '\b',
499 /* 44: */ KEYSYM_HOLE
,
500 /* 45: R4/KP_Equal */ KEYSYM_FUNC_R(4),
501 /* 46: R5/KP_Div */ KEYSYM_FUNC_R(5),
502 /* 47: R6/KP_Mult */ KEYSYM_FUNC_R(6),
503 /* 48: */ KEYSYM_HOLE
,
504 /* 49: L5/Front */ KEYSYM_FUNC_L(5),
505 /* 50: KP_Delete */ KEYSYM_HOLE
,
506 /* 51: L6/Copy */ KEYSYM_FUNC_L(6),
507 /* 52: */ KEYSYM_HOLE
,
521 /* 66: Delete */ 0x7f,
522 /* 67: Compose */ KEYSYM_HOLE
,
523 /* 68: R7/Home */ KEYSYM_FUNC_R(7),
524 /* 69: R8/Up */ KEYSYM_FUNC_R(8),
525 /* 70: R9/PgUp */ KEYSYM_FUNC_R(9),
526 /* 71: KP_Minus */ KEYSYM_HOLE
,
527 /* 72: L7/Open */ KEYSYM_FUNC_L(7),
528 /* 73: L8/Paste */ KEYSYM_FUNC_L(8),
529 /* 74: */ KEYSYM_HOLE
,
530 /* 75: */ KEYSYM_HOLE
,
531 /* 76: Ctrl_L */ KEYSYM_SETMOD
| KBMOD_CTRL_L
,
542 /* 87: apostr. */ '"',
543 /* 88: backslash */ '|',
544 /* 89: Return */ '\r',
545 /* 90: KP_Enter */ KEYSYM_HOLE
,
546 /* 91: R10/Left */ KEYSYM_FUNC_R(10),
547 /* 92: R11/KP_5 */ KEYSYM_FUNC_R(11),
548 /* 93: R12/Right */ KEYSYM_FUNC_R(12),
549 /* 94: KP_Insert */ KEYSYM_HOLE
,
550 /* 95: L9/Find */ KEYSYM_FUNC_L(9),
551 /* 96: */ KEYSYM_HOLE
,
552 /* 97: L10/Cut */ KEYSYM_FUNC_L(10),
553 /* 98: Num_Lock */ KEYSYM_HOLE
,
554 /* 99: Shift_L */ KEYSYM_SETMOD
| KBMOD_SHIFT_L
,
565 /* 110: Shift_R */ KEYSYM_SETMOD
| KBMOD_SHIFT_R
,
566 /* 111: Linefeed */ '\n',
567 /* 112: R13/End */ KEYSYM_FUNC_R(13),
568 /* 113: R14/Down */ KEYSYM_FUNC_R(14),
569 /* 114: R15/PgDn */ KEYSYM_FUNC_R(15),
570 /* 115: */ KEYSYM_HOLE
,
571 /* 116: */ KEYSYM_HOLE
,
572 /* 117: */ KEYSYM_HOLE
,
573 /* 118: L16/Help */ KEYSYM_HOLE
,
574 /* 119: CapsLock */ KEYSYM_INVMOD
| KBMOD_CAPSLOCK
,
575 /* 120: Meta_L */ KEYSYM_SETMOD
| KBMOD_META_L
,
576 /* 121: SpaceBar */ ' ',
577 /* 122: Meta_R */ KEYSYM_SETMOD
| KBMOD_META_R
,
578 /* 123: */ KEYSYM_HOLE
,
579 /* 124: */ KEYSYM_HOLE
,
580 /* 125: KP_Add */ KEYSYM_HOLE
,
581 /* 126: */ KEYSYM_HW_ERR
,
582 /* 127: */ KEYSYM_ALL_UP
,
587 * Keymaps for the "type 4" keyboard.
588 * (lower-case, upper-case)
591 u_short keymap_s4_lc
[KEYMAP_SIZE
] = {
592 /* 0: */ KEYSYM_HOLE
,
593 /* 1: L1/Stop */ KEYSYM_FUNC_L(1),
594 /* 2: */ KEYSYM_HOLE
,
595 /* 3: L2/Again */ KEYSYM_FUNC_L(2),
596 /* 4: */ KEYSYM_HOLE
,
597 /* 5: F1 */ KEYSYM_FUNC_F(1),
598 /* 6: F2 */ KEYSYM_FUNC_F(2),
599 /* 7: F10 */ KEYSYM_FUNC_F(10),
600 /* 8: F3 */ KEYSYM_FUNC_F(3),
601 /* 9: F11 */ KEYSYM_FUNC_F(11),
602 /* 10: F4 */ KEYSYM_FUNC_F(4),
603 /* 11: F12 */ KEYSYM_FUNC_F(12),
604 /* 12: F5 */ KEYSYM_FUNC_F(5),
605 /* 13: AltGraph */ KEYSYM_SETMOD
| KBMOD_ALTGRAPH
,
606 /* 14: F6 */ KEYSYM_FUNC_F(6),
607 /* 15: */ KEYSYM_HOLE
,
608 /* 16: F7 */ KEYSYM_FUNC_F(7),
609 /* 17: F8 */ KEYSYM_FUNC_F(8),
610 /* 18: F9 */ KEYSYM_FUNC_F(9),
611 /* 19: Alt_L */ KEYSYM_SETMOD
| KBMOD_ALT_L
,
612 /* 20: T5_Up */ KEYSYM_STRING
| 1,
613 /* 21: R1/Pause */ KEYSYM_FUNC_R(1),
614 /* 22: R2/Print */ KEYSYM_FUNC_R(2),
615 /* 23: R3/Break */ KEYSYM_FUNC_R(3),
616 /* 24: T5_Left */ KEYSYM_STRING
| 3,
617 /* 25: L3/Props */ KEYSYM_FUNC_L(3),
618 /* 26: L4/Undo */ KEYSYM_FUNC_L(4),
619 /* 27: T5_Down */ KEYSYM_STRING
| 2,
620 /* 28: T5_Right */ KEYSYM_STRING
| 4,
634 /* 42: grave/tilde */ '`',
635 /* 43: BackSpace */ '\b',
636 /* 44: T5_Insert */ KEYSYM_FUNC_N(8),
637 /* 45: R4/KP_Equal */ KEYSYM_FUNC_R(4),
638 /* 46: R5/KP_Div */ KEYSYM_FUNC_R(5),
639 /* 47: R6/KP_Mult */ KEYSYM_FUNC_R(6),
640 /* 48: */ KEYSYM_FUNC_N(13),
641 /* 49: L5/Front */ KEYSYM_FUNC_L(5),
642 /* 50: KP_Delete */ KEYSYM_FUNC_N(10),
643 /* 51: L6/Copy */ KEYSYM_FUNC_L(6),
644 /* 52: T5_Home */ KEYSYM_FUNC_R(7),
658 /* 66: Delete */ 0x7f,
659 /* 67: Compose */ KEYSYM_COMPOSE
,
660 /* 68: R7/Home */ KEYSYM_FUNC_R(7),
661 /* 69: R8/Up */ KEYSYM_FUNC_R(8),
662 /* 70: R9/PgUp */ KEYSYM_FUNC_R(9),
663 /* 71: KP_Minus */ KEYSYM_FUNC_N(15),
664 /* 72: L7/Open */ KEYSYM_FUNC_L(7),
665 /* 73: L8/Paste */ KEYSYM_FUNC_L(8),
666 /* 74: T5_End */ KEYSYM_FUNC_R(13),
667 /* 75: */ KEYSYM_HOLE
,
668 /* 76: Ctrl_L */ KEYSYM_SETMOD
| KBMOD_CTRL_L
,
679 /* 87: apostr. */ '\'',
680 /* 88: backslash */ '\\',
681 /* 89: Return */ '\r',
682 /* 90: KP_Enter */ KEYSYM_FUNC_N(11),
683 /* 91: R10/Left */ KEYSYM_FUNC_R(10),
684 /* 92: R11/KP_5 */ KEYSYM_FUNC_R(11),
685 /* 93: R12/Right */ KEYSYM_FUNC_R(12),
686 /* 94: KP_Insert */ KEYSYM_FUNC_N(8),
687 /* 95: L9/Find */ KEYSYM_FUNC_L(9),
688 /* 96: T5_PgUp */ KEYSYM_FUNC_R(9),
689 /* 97: L10/Cut */ KEYSYM_FUNC_L(10),
690 /* 98: Num_Lock */ KEYSYM_INVMOD
| KBMOD_NUMLOCK
,
691 /* 99: Shift_L */ KEYSYM_SETMOD
| KBMOD_SHIFT_L
,
702 /* 110: Shift_R */ KEYSYM_SETMOD
| KBMOD_SHIFT_R
,
703 /* 111: Linefeed */ '\n',
704 /* 112: R13/End */ KEYSYM_FUNC_R(13),
705 /* 113: R14/Down */ KEYSYM_FUNC_R(14),
706 /* 114: R15/PgDn */ KEYSYM_FUNC_R(15),
707 /* 115: */ KEYSYM_HOLE
,
708 /* 116: */ KEYSYM_HOLE
,
709 /* 117: */ KEYSYM_HOLE
,
710 /* 118: L16/Help */ KEYSYM_FUNC_L(16),
711 /* 119: CapsLock */ KEYSYM_INVMOD
| KBMOD_CAPSLOCK
,
712 /* 120: Meta_L */ KEYSYM_SETMOD
| KBMOD_META_L
,
713 /* 121: SpaceBar */ ' ',
714 /* 122: Meta_R */ KEYSYM_SETMOD
| KBMOD_META_R
,
715 /* 123: T5_PgDn */ KEYSYM_FUNC_R(15),
716 /* 124: */ KEYSYM_HOLE
,
717 /* 125: KP_Add */ KEYSYM_FUNC_N(14),
718 /* 126: */ KEYSYM_HW_ERR
,
719 /* 127: */ KEYSYM_ALL_UP
,
723 u_short keymap_s4_uc
[KEYMAP_SIZE
] = {
724 /* 0: */ KEYSYM_HOLE
,
725 /* 1: L1/Stop */ KEYSYM_FUNC_L(1),
726 /* 2: */ KEYSYM_HOLE
,
727 /* 3: L2/Again */ KEYSYM_FUNC_L(2),
728 /* 4: */ KEYSYM_HOLE
,
729 /* 5: F1 */ KEYSYM_FUNC_F(1),
730 /* 6: F2 */ KEYSYM_FUNC_F(2),
731 /* 7: F10 */ KEYSYM_FUNC_F(10),
732 /* 8: F3 */ KEYSYM_FUNC_F(3),
733 /* 9: F11 */ KEYSYM_FUNC_F(11),
734 /* 10: F4 */ KEYSYM_FUNC_F(4),
735 /* 11: F12 */ KEYSYM_FUNC_F(12),
736 /* 12: F5 */ KEYSYM_FUNC_F(5),
737 /* 13: AltGraph */ KEYSYM_SETMOD
| KBMOD_ALTGRAPH
,
738 /* 14: F6 */ KEYSYM_FUNC_F(6),
739 /* 15: */ KEYSYM_HOLE
,
740 /* 16: F7 */ KEYSYM_FUNC_F(7),
741 /* 17: F8 */ KEYSYM_FUNC_F(8),
742 /* 18: F9 */ KEYSYM_FUNC_F(9),
743 /* 19: Alt_L */ KEYSYM_SETMOD
| KBMOD_ALT_L
,
744 /* 20: T5_Up */ KEYSYM_STRING
| 1,
745 /* 21: R1/Pause */ KEYSYM_FUNC_R(1),
746 /* 22: R2/Print */ KEYSYM_FUNC_R(2),
747 /* 23: R3/Break */ KEYSYM_FUNC_R(3),
748 /* 24: T5_Left */ KEYSYM_STRING
| 3,
749 /* 25: L3/Props */ KEYSYM_FUNC_L(3),
750 /* 26: L4/Undo */ KEYSYM_FUNC_L(4),
751 /* 27: T5_Down */ KEYSYM_STRING
| 2,
752 /* 28: T5_Right */ KEYSYM_STRING
| 4,
766 /* 42: grave/tilde */ '~',
767 /* 43: BackSpace */ '\b',
768 /* 44: T5_Insert */ KEYSYM_FUNC_N(8),
769 /* 45: R4/KP_Equal */ KEYSYM_FUNC_R(4),
770 /* 46: R5/KP_Div */ KEYSYM_FUNC_R(5),
771 /* 47: R6/KP_Mult */ KEYSYM_FUNC_R(6),
772 /* 48: */ KEYSYM_FUNC_N(13),
773 /* 49: L5/Front */ KEYSYM_FUNC_L(5),
774 /* 50: KP_Delete */ KEYSYM_FUNC_N(10),
775 /* 51: L6/Copy */ KEYSYM_FUNC_L(6),
776 /* 52: T5_Home */ KEYSYM_FUNC_R(7),
790 /* 66: Delete */ 0x7f,
791 /* 67: Compose */ KEYSYM_COMPOSE
,
792 /* 68: R7/Home */ KEYSYM_FUNC_R(7),
793 /* 69: R8/Up */ KEYSYM_FUNC_R(8),
794 /* 70: R9/PgUp */ KEYSYM_FUNC_R(9),
795 /* 71: KP_Minus */ KEYSYM_FUNC_N(15),
796 /* 72: L7/Open */ KEYSYM_FUNC_L(7),
797 /* 73: L8/Paste */ KEYSYM_FUNC_L(8),
798 /* 74: T5_End */ KEYSYM_FUNC_R(13),
799 /* 75: */ KEYSYM_HOLE
,
800 /* 76: Ctrl_L */ KEYSYM_SETMOD
| KBMOD_CTRL_L
,
811 /* 87: apostr. */ '"',
812 /* 88: backslash */ '|',
813 /* 89: Return */ '\r',
814 /* 90: KP_Enter */ KEYSYM_FUNC_N(11),
815 /* 91: R10/Left */ KEYSYM_FUNC_R(10),
816 /* 92: R11/KP_5 */ KEYSYM_FUNC_R(11),
817 /* 93: R12/Right */ KEYSYM_FUNC_R(12),
818 /* 94: KP_Insert */ KEYSYM_FUNC_N(8),
819 /* 95: L9/Find */ KEYSYM_FUNC_L(9),
820 /* 96: T5_PgUp */ KEYSYM_FUNC_R(9),
821 /* 97: L10/Cut */ KEYSYM_FUNC_L(10),
822 /* 98: Num_Lock */ KEYSYM_INVMOD
| KBMOD_NUMLOCK
,
823 /* 99: Shift_L */ KEYSYM_SETMOD
| KBMOD_SHIFT_L
,
834 /* 110: Shift_R */ KEYSYM_SETMOD
| KBMOD_SHIFT_R
,
835 /* 111: Linefeed */ '\n',
836 /* 112: R13/End */ KEYSYM_FUNC_R(13),
837 /* 113: R14/Down */ KEYSYM_FUNC_R(14),
838 /* 114: R15/PgDn */ KEYSYM_FUNC_R(15),
839 /* 115: */ KEYSYM_HOLE
,
840 /* 116: */ KEYSYM_HOLE
,
841 /* 117: */ KEYSYM_HOLE
,
842 /* 118: L16/Help */ KEYSYM_FUNC_L(16),
843 /* 119: CapsLock */ KEYSYM_INVMOD
| KBMOD_CAPSLOCK
,
844 /* 120: Meta_L */ KEYSYM_SETMOD
| KBMOD_META_L
,
845 /* 121: SpaceBar */ ' ',
846 /* 122: Meta_R */ KEYSYM_SETMOD
| KBMOD_META_R
,
847 /* 123: T5_PgDn */ KEYSYM_FUNC_R(15),
848 /* 124: */ KEYSYM_HOLE
,
849 /* 125: KP_Add */ KEYSYM_FUNC_N(14),
850 /* 126: */ KEYSYM_HW_ERR
,
851 /* 127: */ KEYSYM_ALL_UP
,
857 * Strings indexed by: (KEYSYM_STRING | idx)
859 char kbd_stringtab
[16][10] = {
860 { 0x1b, '[', 'H', 0 }, /* 0: Home */
861 { 0x1b, '[', 'A', 0 }, /* 1: Up */
862 { 0x1b, '[', 'B', 0 }, /* 2: Down */
863 { 0x1b, '[', 'D', 0 }, /* 3: Left */
864 { 0x1b, '[', 'C', 0 }, /* 4: Right */
868 * The "NumLock" map, which is used to remap
869 * function keysyms when NumLock is on.
871 unsigned short kbd_numlock_map
[64] = {
872 /* KEYSYM_FUNC_L: Identity map */
873 0x600, 0x601, 0x602, 0x603, 0x604, 0x605, 0x606, 0x607,
874 0x608, 0x609, 0x60a, 0x60b, 0x60c, 0x60d, 0x60e, 0x60f,
876 /* KEYSYM_FUNC_R: remap to numbers... */
884 /* KEYSYM_FUNC_F: Identity map */
885 0x620, 0x621, 0x622, 0x623, 0x624, 0x625, 0x626, 0x627,
886 0x628, 0x629, 0x62a, 0x62b, 0x62c, 0x62d, 0x62e, 0x62f,
888 /* KEYSYM_FUNC_N: remap just a few... */
889 0x630, 0x631, 0x632, 0x633, 0x634, 0x635, 0x636, '0',
890 0x638, '.', '\r', 0x63b, 0x63c, '+', '-', 0x63f,
895 * Keyboard descriptions for each type.
898 /* Treat type 2 as type 3 (close enough) */
899 #define kbd_type2 kbd_type3
901 static struct keyboard kbd_type3
= {
908 static struct keyboard kbd_type4
= {
915 /* Treat type 5 as type 4 (close enough) */
916 #define kbd_type5 kbd_type4
918 struct keyboard
* keyboards
[] = {
926 int kbd_max_type
= 5;