1 /* $NetBSD: kbdmap.c,v 1.11 2002/01/26 13:40:58 aymeric Exp $ */
4 * Copyright (c) 1993 Markus Wild
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.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Markus Wild.
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #include <sys/cdefs.h>
34 __KERNEL_RCSID(0, "$NetBSD$");
36 #include <amiga/dev/kbdmap.h>
38 /* define a default keymap. This can be changed by keyboard ioctl's
42 #define S KBD_MODE_STRING
43 #define DG (KBD_MODE_DEAD | KBD_MODE_GRAVE)
44 #define DA (KBD_MODE_DEAD | KBD_MODE_ACUTE)
45 #define DC (KBD_MODE_DEAD | KBD_MODE_CIRC)
46 #define DT (KBD_MODE_DEAD | KBD_MODE_TILDE)
47 #define DD (KBD_MODE_DEAD | KBD_MODE_DIER)
48 #define C KBD_MODE_CAPS
49 #define K KBD_MODE_KPAD
52 struct kbdmap ascii_kbdmap
= {
55 { 0, '`' }, /* 0x00 */
63 { 0, '8' }, /* 0x08 */
71 { C
, 'q' }, /* 0x10 */
79 { C
, 'o' }, /* 0x18 */
87 { C
, 'a' }, /* 0x20 */
95 { C
, 'l' }, /* 0x28 */
111 { 0, ',' }, /* 0x38 */
119 { 0, ' ' }, /* 0x40 */
120 { 0, DEL
}, /* really BS, DEL & BS swapped */
122 { K
, '\r' }, /* enter */
123 { 0, '\r' }, /* return */
125 { 0, '\b' }, /* really DEL, BS & DEL swapped */
131 { S
, 0x00 }, /* now it gets hairy.. CRSR UP */
132 { S
, 0x04 }, /* CRSR DOWN */
133 { S
, 0x08 }, /* CRSR RIGHT */
134 { S
, 0x0C }, /* CRSR LEFT */
135 { S
, 0x10 }, /* 0x50 F1 */
136 { S
, 0x15 }, /* F2 */
137 { S
, 0x1A }, /* F3 */
138 { S
, 0x1F }, /* F4 */
139 { S
, 0x24 }, /* F5 */
140 { S
, 0x29 }, /* F6 */
141 { S
, 0x2E }, /* F7 */
142 { S
, 0x33 }, /* F8 */
143 { S
, 0x38 }, /* 0x58 F9 */
144 { S
, 0x3D }, /* F10 */
150 { S
, 0x42 } /* HELP */
155 { 0, '~' }, /* 0x00 */
163 { 0, '*' }, /* 0x08 */
171 { C
, 'Q' }, /* 0x10 */
179 { C
, 'O' }, /* 0x18 */
187 { C
, 'A' }, /* 0x20 */
195 { C
, 'L' }, /* 0x28 */
211 { 0, '<' }, /* 0x38 */
219 { 0, ' ' }, /* 0x40 */
220 { 0, DEL
}, /* really BS, DEL & BS swapped */
221 { S
, 0x99 }, /* shift TAB */
222 { K
, '\r' }, /* enter */
223 { 0, '\r' }, /* return */
225 { 0, '\b' }, /* really DEL, BS & DEL swapped */
231 { S
, 0x47 }, /* shift CRSR UP */
232 { S
, 0x4C }, /* shift CRSR DOWN */
233 { S
, 0x51 }, /* shift CRSR RIGHT */
234 { S
, 0x57 }, /* shift CRSR LEFT */
235 { S
, 0x5D }, /* 0x50 shift F1 */
236 { S
, 0x63 }, /* shift F2 */
237 { S
, 0x69 }, /* shift F3 */
238 { S
, 0x6F }, /* shift F4 */
239 { S
, 0x75 }, /* shift F5 */
240 { S
, 0x7B }, /* shift F6 */
241 { S
, 0x81 }, /* shift F7 */
242 { S
, 0x87 }, /* shift F8 */
243 { S
, 0x8D }, /* 0x58 shift F9 */
244 { S
, 0x93 }, /* shift F10 */
250 { S
, 0x42 } /* HELP (no special shift code) */
256 { 0, '`' }, /* 0x00 */
264 { 0, '·' }, /* 0x08 */
272 { C
, 'å' }, /* 0x10 */
280 { C
, 'ø' }, /* 0x18 */
288 { C
, 'æ' }, /* 0x20 */
296 { 0, '£' }, /* 0x28 */
312 { 0, ',' }, /* 0x38 */
320 { 0, ' ' }, /* 0x40 */
321 { 0, DEL
}, /* really BS, DEL & BS swapped */
323 { K
, '\r' }, /* enter */
324 { 0, '\r' }, /* return */
325 { S
, 0x9d }, /* CSI */
326 { 0, '\b' }, /* really DEL, BS & DEL swapped */
332 { S
, 0x00 }, /* now it gets hairy.. CRSR UP */
333 { S
, 0x04 }, /* CRSR DOWN */
334 { S
, 0x08 }, /* CRSR RIGHT */
335 { S
, 0x0C }, /* CRSR LEFT */
336 { S
, 0x10 }, /* 0x50 F1 */
337 { S
, 0x15 }, /* F2 */
338 { S
, 0x1A }, /* F3 */
339 { S
, 0x1F }, /* F4 */
340 { S
, 0x24 }, /* F5 */
341 { S
, 0x29 }, /* F6 */
342 { S
, 0x2E }, /* F7 */
343 { S
, 0x33 }, /* F8 */
344 { S
, 0x38 }, /* 0x58 F9 */
345 { S
, 0x3D }, /* F10 */
351 { S
, 0x42 } /* HELP */
356 { 0, '~' }, /* 0x00 */
364 { 0, '*' }, /* 0x08 */
372 { C
, 'Å' }, /* 0x10 */
380 { C
, 'Ø' }, /* 0x18 */
388 { C
, 'Æ' }, /* 0x20 */
396 { 0, '£' }, /* 0x28 */
412 { 0, ',' }, /* 0x38 */
420 { 0, ' ' }, /* 0x40 */
421 { 0, DEL
}, /* really BS, DEL & BS swapped */
423 { K
, '\r' }, /* enter */
424 { 0, '\r' }, /* return */
425 { S
, 0x9d }, /* CSI */
426 { 0, '\b' }, /* really DEL, BS & DEL swapped */
432 { S
, 0x00 }, /* now it gets hairy.. CRSR UP */
433 { S
, 0x04 }, /* CRSR DOWN */
434 { S
, 0x08 }, /* CRSR RIGHT */
435 { S
, 0x0C }, /* CRSR LEFT */
436 { S
, 0x10 }, /* 0x50 F1 */
437 { S
, 0x15 }, /* F2 */
438 { S
, 0x1A }, /* F3 */
439 { S
, 0x1F }, /* F4 */
440 { S
, 0x24 }, /* F5 */
441 { S
, 0x29 }, /* F6 */
442 { S
, 0x2E }, /* F7 */
443 { S
, 0x33 }, /* F8 */
444 { S
, 0x38 }, /* 0x58 F9 */
445 { S
, 0x3D }, /* F10 */
451 { S
, 0x42 } /* HELP */
455 /* string table. If there's a better way to get the offsets into the
456 above table, please tell me..
458 NOTE: save yourself and others a lot of grief by *not* using
459 CSI == 0x9b, using the two-character sequence gives
460 much less trouble, especially in GNU-Emacs.. */
462 3, ESC
, '[', 'A', /* 0x00: CRSR UP */
463 3, ESC
, '[', 'B', /* 0x04: CRSR DOWN */
464 3, ESC
, '[', 'C', /* 0x08: CRSR RIGHT */
465 3, ESC
, '[', 'D', /* 0x0C: CRSR LEFT */
466 4, ESC
, '[', '0', '~', /* 0x10: F1 */
467 4, ESC
, '[', '1', '~', /* 0x15: F2 */
468 4, ESC
, '[', '2', '~', /* 0x1A: F3 */
469 4, ESC
, '[', '3', '~', /* 0x1F: F4 */
470 4, ESC
, '[', '4', '~', /* 0x24: F5 */
471 4, ESC
, '[', '5', '~', /* 0x29: F6 */
472 4, ESC
, '[', '6', '~', /* 0x2E: F7 */
473 4, ESC
, '[', '7', '~', /* 0x33: F8 */
474 4, ESC
, '[', '8', '~', /* 0x38: F9 */
475 4, ESC
, '[', '9', '~', /* 0x3D: F10 */
476 4, ESC
, '[', '?', '~', /* 0x42: HELP */
478 4, ESC
, '[', 'T', '~', /* 0x47: shift CRSR UP */
479 4, ESC
, '[', 'S', '~', /* 0x4C: shift CRSR DOWN */
480 5, ESC
, '[', ' ', '@', '~', /* 0x51: shift CRSR RIGHT */
481 5, ESC
, '[', ' ', 'A', '~', /* 0x57: shift CRSR LEFT */
482 5, ESC
, '[', '1', '0', '~', /* 0x5D: shift F1 */
483 5, ESC
, '[', '1', '1', '~', /* 0x63: shift F2 */
484 5, ESC
, '[', '1', '2', '~', /* 0x69: shift F3 */
485 5, ESC
, '[', '1', '3', '~', /* 0x6F: shift F4 */
486 5, ESC
, '[', '1', '4', '~', /* 0x75: shift F5 */
487 5, ESC
, '[', '1', '5', '~', /* 0x7B: shift F6 */
488 5, ESC
, '[', '1', '6', '~', /* 0x81: shift F7 */
489 5, ESC
, '[', '1', '7', '~', /* 0x87: shift F8 */
490 5, ESC
, '[', '1', '8', '~', /* 0x8D: shift F9 */
491 5, ESC
, '[', '1', '9', '~', /* 0x93: shift F10 */
492 3, ESC
, '[', 'Z', /* 0x99: shift TAB */
493 2, ESC
, '[', /* 0x9d: alt ESC == CSI */
497 unsigned char acctable
[KBD_NUM_ACC
][64] = {
498 { "@ÀBCDÈFGHÌJKLMNÒPQRSTÙVWXYZ[\\]^_"
499 "`àbcdèfghìjklmnòpqrstùvwxyz{|}~\177"}, /* KBD_ACC_GRAVE */
501 { "@ÁBCDÉFGHÍJKLMNÓPQRSTÚVWXYZ[\\]^_"
502 "`ábcdéfghíjklmnópqrstúvwxyz{|}~\177"}, /* KBD_ACC_ACUTE */
504 { "@ÂBCDÊFGHÎJKLMNÔPQRSTÛVWXYZ[\\]^_"
505 "`âbcdêfghîjklmnôpqrstûvwxyz{|}~\177"}, /* KBD_ACC_CIRC */
507 { "@ÃBCDEFGHIJKLMÑÕPQRSTUVWXYZ[\\]^_"
508 "`ãbcdefghijklmñÕpqrstuvwxyz{|}~\177"}, /* KBD_ACC_TILDE */
510 { "@ÄBCDËFGHÏJKLMNÖPQRSTÜVWXYZ[\\]^_"
511 "`äbcdëfghïjklmnöpqrstüvwxyz{|}~\177"}, /* KBD_ACC_DIER */