us-kbdmap.c revision 1.2.126.1       1  1.2.126.1    yamt /*	$NetBSD: us-kbdmap.c,v 1.2.126.1 2009/05/04 08:10:49 yamt Exp $	*/
      2        1.1     leo 
      3        1.1     leo #include "../../../dev/kbdmap.h"
      4        1.1     leo 
      5        1.1     leo /* mode shortcuts: */
      6        1.1     leo #define	S KBD_MODE_STRING
      7        1.1     leo #define C KBD_MODE_CAPS
      8        1.1     leo #define K KBD_MODE_KPAD
      9        1.1     leo 
     10        1.1     leo 
     11        1.1     leo /*
     12        1.1     leo |	20.June.95
     13        1.1     leo |	Abdulkareem asx (at) ccnet.com
     14        1.1     leo |
     15        1.1     leo |	Changes made for the US keyboard
     16        1.1     leo |	The pipe symbol '|', the double-quote '"', the at sign, '@', the
     17        1.1     leo |	tidle '~', the backslash '\' were incompatible to the built-in
     18        1.1     leo |	keymap and therefore not available on the US keyabords.
     19        1.1     leo |
     20        1.1     leo |	I've added the loadkmap us-map line in my /etc/rc.local file; don't
     21        1.1     leo |	know where else to put it.
     22        1.1     leo |
     23        1.1     leo */
     24        1.1     leo 
     25        1.1     leo 
     26        1.1     leo struct kbdmap kbdmap;
     27        1.1     leo struct kbdmap ascii_kbdmap = {
     28        1.1     leo 	/* normal map */
     29        1.1     leo 	{
     30        1.1     leo /* 0x00 */	0, 0,		0, ESC,		0, '1',		0, '2',
     31        1.1     leo /* 0x04 */	0, '3',		0, '4',		0, '5',		0, '6',
     32        1.1     leo /* 0x08 */	0, '7',		0, '8',		0, '9',		0, '0',
     33        1.1     leo /* 0x0c */	0, '-',		0, '=',		0, '\b',	0, '\t',
     34        1.1     leo /* 0x10	*/	C, 'q',		C, 'w',		C, 'e',		C, 'r',
     35        1.1     leo /* 0x14 */	C, 't',		C, 'y',		C, 'u',		C, 'i',
     36        1.1     leo /* 0x18 */	C, 'o',		C, 'p',		0, '[',		0, ']',
     37        1.1     leo /* 0x1c */	0, '\r',	0, DEL,		C, 'a',		C, 's',
     38        1.1     leo /* 0x20 */	C, 'd',		C, 'f',		C, 'g',		C, 'h',
     39        1.1     leo /* 0x24 */	C, 'j',		C, 'k',		C, 'l',		0, ';',
     40        1.1     leo /* 0x28 */	0, '\'',	0, '`',		0, 0,		0, '\\',
     41        1.1     leo /* 0x2c */	C, 'z',		C, 'x',		C, 'c',		C, 'v',
     42        1.1     leo /* 0x30 */	C, 'b',		C, 'n',		C, 'm',		0, ',',
     43        1.1     leo /* 0x34 */	0, '.',		0, '/',		0, 0,		0, 0,
     44        1.1     leo /* 0x38 */	0, 0,		0, ' ',		0, 0,		S, 0x10,
     45        1.1     leo /* 0x3c */	S, 0x15,	S, 0x1A,	S, 0x1F,	S, 0x24,
     46        1.1     leo /* 0x40 */	S, 0x29,	S, 0x2E,	S, 0x33,	S, 0x38,
     47        1.1     leo /* 0x44 */	S, 0x3D,	0, 0,		0, 0,		0, 0,
     48        1.1     leo /* 0x48 */	S, 0x00,	0, 0,		0, '-',		S, 0x0C,
     49        1.1     leo /* 0x4c */	0, 0,		S, 0x08,	0, '+',		0, 0,
     50        1.1     leo /* 0x50 */	S, 0x04,	0, 0,		0, 0,		0, DEL,
     51        1.1     leo /* 0x54 */	0, 0,		0, 0,		0, 0,		0, 0,
     52        1.1     leo /* 0x58 */	0, 0,		0, 0,		0, 0,		0, 0,
     53        1.1     leo /* 0x5c */	0, 0,		0, 0,		0, 0,		0, 0,
     54        1.1     leo /* 0x60 */
     55        1.1     leo /* 0x60 */	0, 0,		0, 0,		0, 0,		0, '(',
     56        1.1     leo /* 0x64 */	0, ')',		0, '/',		0, '*',		K, '7',
     57        1.1     leo /* 0x68 */	K, '8',		K, '9',		K, '4',		K, '5',
     58        1.1     leo /* 0x6c */	K, '6',		K, '1',		K, '2',		K, '3',
     59        1.1     leo /* 0x70 */	K, '0',		K, '.',		K, '\r',	0, 0,
     60        1.1     leo /* 0x74 */	0, 0,		0, 0,		0, 0,		0, 0,
     61        1.1     leo /* 0x78 */	0, 0,		0, 0,		0, 0,		0, 0,
     62        1.1     leo /* 0x7c */	0, 0,		0, 0,		0, 0,		0, 0
     63        1.1     leo },
     64        1.1     leo 	/* shifted map */
     65        1.1     leo 	{
     66        1.1     leo /* 0x00 */	0, 0,		0, ESC,		0, '!',		0, '@',
     67        1.1     leo /* 0x04 */	0, '#',		0, '$',		0, '%',		0, '^',
     68        1.1     leo /* 0x08 */	0, '&',		0, '*',		0, '(',		0, ')',
     69        1.1     leo /* 0x0c */	0, '_',		0, '+',		0, '\b',	0, '\t',
     70        1.1     leo /* 0x10	*/	C, 'Q',		C, 'W',		C, 'E',		C, 'R',
     71        1.1     leo /* 0x14 */	C, 'T',		C, 'Y',		C, 'U',		C, 'I',
     72        1.1     leo /* 0x18 */	C, 'O',		C, 'P',		0, '{',		0, '}',
     73        1.1     leo /* 0x1c */	0, '\r',	0, 0,		C, 'A',		C, 'S',
     74        1.1     leo /* 0x20 */	C, 'D',		C, 'F',		C, 'G',		C, 'H',
     75        1.1     leo /* 0x24 */	C, 'J',		C, 'K',		C, 'L',		0, ':',
     76        1.1     leo /* 0x28 */	0, '"',		0, '~',		0, 0,		0, '|',
     77        1.1     leo /* 0x2c */	C, 'Z',		C, 'X',		C, 'C',		C, 'V',
     78        1.1     leo /* 0x30 */	C, 'B',		C, 'N',		C, 'M',		0, '<',
     79        1.1     leo /* 0x34 */	0, '>',		0, '?',		0, 0,		0, 0,
     80        1.1     leo /* 0x38 */	0, 0,		0, ' ',		0, 0,		S, 0x5d,
     81        1.1     leo /* 0x3c */	S, 0x63,	S, 0x69,	S, 0x6F,	S, 0x75,
     82        1.1     leo /* 0x40 */	S, 0x7b,	S, 0x81,	S, 0x87,	S, 0x8d,
     83        1.1     leo /* 0x44 */	S, 0x93,	0, 0,		0, 0,		0, 0,
     84        1.1     leo /* 0x48 */	S, 0x47,	0, 0,		0, '-',		S, 0x57,
     85        1.1     leo /* 0x4c */	0, 0,		S, 0x51,	0, '+',		0, 0,
     86        1.1     leo /* 0x50 */	S, 0x4c,	0, 0,		0, 0,		0, DEL,
     87        1.1     leo /* 0x54 */	0, 0,		0, 0,		0, 0,		0, 0,
     88        1.1     leo /* 0x58 */	0, 0,		0, 0,		0, 0,		0, 0,
     89        1.1     leo /* 0x5c */	0, 0,		0, 0,		0, 0,		0, 0,
     90        1.1     leo /* 0x60 */
     91        1.1     leo /* 0x60 */	0, 0,		0, 0,		0, 0,		0, '(',
     92        1.1     leo /* 0x64 */	0, ')',		0, '/',		0, '*',		K, '7',
     93        1.1     leo /* 0x68 */	K, '8',		K, '9',		K, '4',		K, '5',
     94        1.1     leo /* 0x6c */	K, '6',		K, '1',		K, '2',		K, '3',
     95        1.1     leo /* 0x70 */	K, '0',		K, '.',		K, '\r',	0, 0,
     96        1.1     leo /* 0x74 */	0, 0,		0, 0,		0, 0,		0, 0,
     97        1.1     leo /* 0x78 */	0, 0,		0, 0,		0, 0,		0, 0,
     98        1.1     leo /* 0x7c */	0, 0,		0, 0,		0, 0,		0, 0
     99        1.1     leo 	},
    100        1.1     leo 
    101        1.1     leo 	/* alt map FIXME: No altmap yet.. */
    102        1.1     leo 	{
    103        1.1     leo 		0, 0
    104        1.1     leo 	},
    105        1.1     leo 
    106        1.1     leo 	/* shift alt map FIXME: No shift altmap yet... */
    107        1.1     leo 	{
    108        1.1     leo 		0, 0
    109        1.1     leo 	},
    110        1.1     leo 
    111        1.1     leo 	{
    112        1.1     leo 	  /* string table. If there's a better way to get the offsets into the
    113        1.1     leo 	     above table, please tell me..
    114        1.1     leo 
    115        1.1     leo 	     NOTE: save yourself and others a lot of grief by *not* using
    116        1.1     leo 	           CSI == 0x9b, using the two-character sequence gives
    117        1.1     leo 	           much less trouble, especially in GNU-Emacs.. */
    118        1.1     leo 
    119        1.1     leo 	  3, ESC, '[', 'A',		/* 0x00: CRSR UP */
    120        1.1     leo 	  3, ESC, '[', 'B',		/* 0x04: CRSR DOWN */
    121        1.1     leo 	  3, ESC, '[', 'C',		/* 0x08: CRSR RIGHT */
    122        1.1     leo 	  3, ESC, '[', 'D',		/* 0x0C: CRSR LEFT */
    123        1.1     leo 	  4, ESC, '[', '0', '~',	/* 0x10: F1 */
    124        1.1     leo 	  4, ESC, '[', '1', '~',	/* 0x15: F2 */
    125        1.1     leo 	  4, ESC, '[', '2', '~',	/* 0x1A: F3 */
    126        1.1     leo 	  4, ESC, '[', '3', '~',	/* 0x1F: F4 */
    127        1.1     leo 	  4, ESC, '[', '4', '~',	/* 0x24: F5 */
    128        1.1     leo 	  4, ESC, '[', '5', '~',	/* 0x29: F6 */
    129        1.1     leo 	  4, ESC, '[', '6', '~',	/* 0x2E: F7 */
    130        1.1     leo 	  4, ESC, '[', '7', '~',	/* 0x33: F8 */
    131        1.1     leo 	  4, ESC, '[', '8', '~',	/* 0x38: F9 */
    132        1.1     leo 	  4, ESC, '[', '9', '~',	/* 0x3D: F10 */
    133        1.1     leo 	  4, ESC, '[', '?', '~',	/* 0x42: HELP */
    134        1.1     leo 
    135        1.1     leo 	  4, ESC, '[', 'T', '~',	/* 0x47: shift CRSR UP */
    136        1.1     leo 	  4, ESC, '[', 'S', '~',	/* 0x4C: shift CRSR DOWN */
    137        1.1     leo 	  5, ESC, '[', ' ', '@', '~',	/* 0x51: shift CRSR RIGHT */
    138        1.1     leo 	  5, ESC, '[', ' ', 'A', '~',	/* 0x57: shift CRSR LEFT */
    139        1.1     leo 	  5, ESC, '[', '1', '0', '~',	/* 0x5D: shift F1 */
    140        1.1     leo 	  5, ESC, '[', '1', '1', '~',	/* 0x63: shift F2 */
    141        1.1     leo 	  5, ESC, '[', '1', '2', '~',	/* 0x69: shift F3 */
    142        1.1     leo 	  5, ESC, '[', '1', '3', '~',	/* 0x6F: shift F4 */
    143        1.1     leo 	  5, ESC, '[', '1', '4', '~',	/* 0x75: shift F5 */
    144        1.1     leo 	  5, ESC, '[', '1', '5', '~',	/* 0x7B: shift F6 */
    145        1.1     leo 	  5, ESC, '[', '1', '6', '~',	/* 0x81: shift F7 */
    146        1.1     leo 	  5, ESC, '[', '1', '7', '~',	/* 0x87: shift F8 */
    147        1.1     leo 	  5, ESC, '[', '1', '8', '~',	/* 0x8D: shift F9 */
    148        1.1     leo 	  5, ESC, '[', '1', '9', '~',	/* 0x93: shift F10 */
    149        1.1     leo 	  3, ESC, '[', 'Z',		/* 0x99: shift TAB */
    150        1.1     leo 	  2, ESC, '[',			/* 0x9d: alt ESC == CSI */
    151        1.1     leo 	},
    152        1.1     leo };
    153        1.1     leo 
    154        1.1     leo #ifndef _KERNEL
    155  1.2.126.1    yamt main(void)
    156        1.1     leo {
    157        1.2  thomas   exit(write (1, &ascii_kbdmap, sizeof (kbdmap)) == sizeof (kbdmap) ? 0 : 1);
    158        1.1     leo }
    159        1.1     leo #endif /* _KERNEL */
    160