root/kernel/chr_drv/keyboard.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. keyboard_interrupt
  2. put_queue
  3. puts_queue
  4. ctrl
  5. alt
  6. unctrl
  7. unalt
  8. lshift
  9. unlshift
  10. rshift
  11. unrshift
  12. caps
  13. uncaps
  14. show_ptregs
  15. scroll
  16. num
  17. applkey
  18. do_self
  19. handle_diacr
  20. cursor
  21. cur
  22. func
  23. slash
  24. star
  25. enter
  26. minus
  27. plus
  28. none
  29. kb_wait
  30. kb_ack
  31. set_leds
  32. hard_reset_now
  33. kbd_init

   1 /*
   2  * linux/kernel/chr_drv/keyboard.c
   3  *
   4  * Keyboard driver for Linux v0.96 using Latin-1.
   5  *
   6  * Written for linux by Johan Myreen as a translation from
   7  * the assembly version by Linus (with diacriticals added)
   8  */
   9 
  10 #define KEYBOARD_IRQ 1
  11 
  12 #include <linux/sched.h>
  13 #include <linux/ctype.h>
  14 #include <linux/tty.h>
  15 #include <linux/mm.h>
  16 #include <linux/ptrace.h>
  17 #include <linux/keyboard.h>
  18 
  19 /*
  20  * The default IO slowdown is doing 'inb()'s from 0x61, which should be
  21  * safe. But as that is the keyboard controller chip address, we do our
  22  * slowdowns here by doing short jumps: the keyboard controller should
  23  * be able to keep up
  24  */
  25 #define REALLY_SLOW_IO
  26 #define SLOW_IO_BY_JUMPING
  27 #include <asm/io.h>
  28 #include <asm/system.h>
  29 
  30 extern void do_keyboard_interrupt(void);
  31 extern void ctrl_alt_del(void);
  32 extern void change_console(unsigned int new_console);
  33 
  34 unsigned long kbd_flags = 0;
  35 unsigned long kbd_dead_keys = 0;
  36 unsigned long kbd_prev_dead_keys = 0;
  37 
  38 struct kbd_struct kbd_table[NR_CONSOLES];
  39 static struct kbd_struct * kbd = kbd_table;
  40 static struct tty_struct * tty = NULL;
  41 
  42 typedef void (*fptr)(int);
  43 
  44 static int diacr = -1;
  45 static int npadch = 0;
  46 fptr key_table[];
  47 
  48 static void put_queue(int);
  49 void set_leds(void);
  50 static void applkey(int);
  51 static void cur(int);
  52 static unsigned int handle_diacr(unsigned int);
  53 
  54 static struct pt_regs * pt_regs;
  55 
  56 static void keyboard_interrupt(int int_pt_regs)
     /* [previous][next][first][last][top][bottom][index][help] */
  57 {
  58         static unsigned char rep = 0xff;
  59         unsigned char scancode;
  60 
  61         pt_regs = (struct pt_regs *) int_pt_regs;
  62         while (inb_p(0x64) & 1) {
  63                 kbd_prev_dead_keys |= kbd_dead_keys;
  64                 if (!kbd_dead_keys)
  65                         kbd_prev_dead_keys = 0;
  66                 kbd_dead_keys = 0;
  67                 scancode = inb_p(0x60);
  68                 tty = TTY_TABLE(0);
  69                 kbd = kbd_table + fg_console;
  70                 if (vc_kbd_flag(kbd,VC_RAW)) {
  71                         kbd_flags = 0;
  72                         put_queue(scancode);
  73                         continue;
  74                 }
  75                 if (scancode == 0xe0) {
  76                         set_kbd_dead(KGD_E0);
  77                         continue;
  78                 } else if (scancode == 0xe1) {
  79                         set_kbd_dead(KGD_E1);
  80                         continue;
  81                 }
  82                 /*
  83                  *  The keyboard maintains its own internal caps lock and num lock
  84                  *  statuses. In caps lock mode E0 AA precedes make code and E0 2A
  85                  *  follows break code. In num lock mode, E0 2A precedes make
  86                  *  code and E0 AA follows break code. We do our own book-keeping,
  87                  *  so we will just ignore these.
  88                  */
  89                 if (kbd_dead(KGD_E0) && (scancode == 0x2a || scancode == 0xaa))
  90                         continue;
  91                 /*
  92                  *  Repeat a key only if the input buffers are empty or the
  93                  *  characters get echoed locally. This makes key repeat usable
  94                  *  with slow applications and unders heavy loads.
  95                  */
  96                 if (scancode == rep) {
  97                         if (!(vc_kbd_flag(kbd,VC_REPEAT) && tty &&
  98                                    (L_ECHO(tty) ||
  99                                     (EMPTY(&tty->secondary) &&
 100                                      EMPTY(&tty->read_q)))))
 101                                 continue;
 102                 }
 103                 rep = scancode;
 104                 key_table[scancode](scancode);
 105         }
 106         do_keyboard_interrupt();
 107 }
 108 
 109 static void put_queue(int ch)
     /* [previous][next][first][last][top][bottom][index][help] */
 110 {
 111         struct tty_queue *qp;
 112         unsigned long new_head;
 113 
 114         wake_up_interruptible(&keypress_wait);
 115         if (!tty)
 116                 return;
 117         qp = &tty->read_q;
 118 
 119         qp->buf[qp->head]=ch;
 120         if ((new_head=(qp->head+1)&(TTY_BUF_SIZE-1)) != qp->tail)
 121                 qp->head=new_head;
 122         wake_up_interruptible(&qp->proc_list);
 123 }
 124 
 125 static void puts_queue(char *cp)
     /* [previous][next][first][last][top][bottom][index][help] */
 126 {
 127         struct tty_queue *qp;
 128         unsigned long new_head;
 129         char ch;
 130 
 131         wake_up_interruptible(&keypress_wait);
 132         if (!tty)
 133                 return;
 134         qp = &tty->read_q;
 135 
 136         while ((ch = *(cp++)) != 0) {
 137                 qp->buf[qp->head]=ch;
 138                 if ((new_head=(qp->head+1)&(TTY_BUF_SIZE-1))
 139                                  != qp->tail)
 140                         qp->head=new_head;
 141         }
 142         wake_up_interruptible(&qp->proc_list);
 143 }
 144 
 145 static void ctrl(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
 146 {
 147         if (kbd_dead(KGD_E0))
 148                 set_kbd_flag(KG_RCTRL);
 149         else
 150                 set_kbd_flag(KG_LCTRL);
 151 }
 152 
 153 static void alt(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
 154 {
 155         if (kbd_dead(KGD_E0))
 156                 set_kbd_flag(KG_ALTGR);
 157         else
 158                 set_kbd_flag(KG_ALT);
 159 }
 160 
 161 static void unctrl(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
 162 {
 163         if (kbd_dead(KGD_E0))
 164                 clr_kbd_flag(KG_RCTRL);
 165         else
 166                 clr_kbd_flag(KG_LCTRL);
 167 }
 168 
 169 static void unalt(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
 170 {
 171         if (kbd_dead(KGD_E0))
 172                 clr_kbd_flag(KG_ALTGR);
 173         else {
 174                 clr_kbd_flag(KG_ALT);
 175                 if (npadch != 0) {
 176                         put_queue(npadch);
 177                         npadch=0;
 178                 }
 179         }
 180 }
 181 
 182 static void lshift(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
 183 {
 184         set_kbd_flag(KG_LSHIFT);
 185 }
 186 
 187 static void unlshift(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
 188 {
 189         clr_kbd_flag(KG_LSHIFT);
 190 }
 191 
 192 static void rshift(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
 193 {
 194         set_kbd_flag(KG_RSHIFT);
 195 }
 196 
 197 static void unrshift(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
 198 {
 199         clr_kbd_flag(KG_RSHIFT);
 200 }
 201 
 202 static void caps(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
 203 {
 204         if (kbd_flag(KG_CAPSLOCK))
 205                 return;         /* key already pressed: defeat repeat */
 206         set_kbd_flag(KG_CAPSLOCK);
 207         chg_vc_kbd_flag(kbd,VC_CAPSLOCK);
 208         set_leds();
 209 }
 210 
 211 static void uncaps(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
 212 {
 213         clr_kbd_flag(KG_CAPSLOCK);
 214 }
 215 
 216 static void show_ptregs(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 217 {
 218         if (!pt_regs)
 219                 return;
 220         printk("\nEIP: %04x:%08x",0xffff & pt_regs->cs,pt_regs->eip);
 221         if (pt_regs->cs & 3)
 222                 printk(" ESP: %04x:%08x",0xffff & pt_regs->cs,pt_regs->eip);
 223         printk(" EFLAGS: %08x",pt_regs->eflags);
 224         printk("\nEAX: %08x EBX: %08x ECX: %08x EDX: %08x",
 225                 pt_regs->orig_eax,pt_regs->ebx,pt_regs->ecx,pt_regs->edx);
 226         printk("\nESI: %08x EDI: %08x EBP: %08x",
 227                 pt_regs->esi, pt_regs->edi, pt_regs->ebp);
 228         printk(" DS: %04x ES: %04x FS: %04x GS: %04x\n",
 229                 0xffff & pt_regs->ds,0xffff & pt_regs->es,
 230                 0xffff & pt_regs->fs,0xffff & pt_regs->gs);
 231 }
 232 
 233 static void scroll(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
 234 {
 235         if (kbd_flag(KG_LSHIFT) || kbd_flag(KG_RSHIFT))
 236                 show_mem();
 237         else if (kbd_flag(KG_ALT) || kbd_flag(KG_ALTGR))
 238                 show_ptregs();
 239         else if (kbd_flag(KG_LCTRL) || kbd_flag(KG_RCTRL))
 240                 show_state();
 241         else {
 242                 chg_vc_kbd_flag(kbd,VC_SCROLLOCK);
 243                 set_leds();
 244         }
 245 }
 246 
 247 static void num(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
 248 {
 249         if (vc_kbd_flag(kbd,VC_APPLIC))
 250                 applkey(0x50);
 251         else {
 252                 chg_vc_kbd_flag(kbd,VC_NUMLOCK);
 253                 set_leds();
 254         }
 255 }
 256 
 257 static void applkey(int key)
     /* [previous][next][first][last][top][bottom][index][help] */
 258 {
 259         char buf[] = { 0x1b, 0x4f, 0x00, 0x00 };
 260 
 261         buf[2] = key;
 262         puts_queue(buf);
 263 }
 264 
 265 #if defined KBD_FINNISH
 266 
 267 static unsigned char key_map[] = {
 268           0,   27,  '1',  '2',  '3',  '4',  '5',  '6',
 269         '7',  '8',  '9',  '0',  '+', '\'',  127,    9,
 270         'q',  'w',  'e',  'r',  't',  'y',  'u',  'i',
 271         'o',  'p',  '}',    0,   13,    0,  'a',  's',
 272         'd',  'f',  'g',  'h',  'j',  'k',  'l',  '|',
 273         '{',    0,    0, '\'',  'z',  'x',  'c',  'v',
 274         'b',  'n',  'm',  ',',  '.',  '-',    0,  '*',
 275           0,   32,    0,    0,    0,    0,    0,    0,
 276           0,    0,    0,    0,    0,    0,    0,    0,
 277           0,    0,  '-',    0,    0,    0,  '+',    0,
 278           0,    0,    0,    0,    0,    0,  '<',    0,
 279           0,    0,    0,    0,    0,    0,    0,    0,
 280           0 };
 281 
 282 static unsigned char shift_map[] = {
 283           0,   27,  '!', '\"',  '#',  '$',  '%',  '&',
 284         '/',  '(',  ')',  '=',  '?',  '`',  127,    9,
 285         'Q',  'W',  'E',  'R',  'T',  'Y',  'U',  'I',
 286         'O',  'P',  ']',  '^',   13,    0,  'A',  'S',
 287         'D',  'F',  'G',  'H',  'J',  'K',  'L', '\\',
 288         '[',    0,    0,  '*',  'Z',  'X',  'C',  'V',
 289         'B',  'N',  'M',  ';',  ':',  '_',    0,  '*',
 290           0,   32,    0,    0,    0,    0,    0,    0,
 291           0,    0,    0,    0,    0,    0,    0,    0,
 292           0,    0,  '-',    0,    0,    0,  '+',    0,
 293           0,    0,    0,    0,    0,    0,  '>',    0,
 294           0,    0,    0,    0,    0,    0,    0,    0,
 295           0 };
 296 
 297 static unsigned char alt_map[] = {
 298           0,    0,    0,  '@',  163,  '$',    0,    0,
 299         '{',   '[',  ']', '}', '\\',    0,    0,    0,
 300           0,    0,    0,    0,    0,    0,    0,    0,
 301           0,    0,    0,  '~',   13,    0,    0,    0,
 302           0,    0,    0,    0,    0,    0,    0,    0,
 303           0,    0,    0,    0,    0,    0,    0,    0,
 304           0,    0,    0,    0,    0,    0,    0,    0,
 305           0,    0,    0,    0,    0,    0,    0,    0,
 306           0,    0,    0,    0,    0,    0,    0,    0,
 307           0,    0,    0,    0,    0,    0,    0,    0,
 308           0,    0,    0,    0,    0,    0,  '|',    0,
 309           0,    0,    0,    0,    0,    0,    0,    0,
 310           0 };
 311 
 312 #elif defined KBD_FINNISH_LATIN1
 313 
 314 static unsigned char key_map[] = {
 315           0,   27,  '1',  '2',  '3',  '4',  '5',  '6',
 316         '7',  '8',  '9',  '0',  '+',  180,  127,    9,
 317         'q',  'w',  'e',  'r',  't',  'y',  'u',  'i',
 318         'o',  'p',  229,  168,   13,    0,  'a',  's',
 319         'd',  'f',  'g',  'h',  'j',  'k',  'l',  246,
 320         228,  167,    0, '\'',  'z',  'x',  'c',  'v',
 321         'b',  'n',  'm',  ',',  '.',  '-',    0,  '*',
 322           0,   32,    0,    0,    0,    0,    0,    0,
 323           0,    0,    0,    0,    0,    0,    0,    0,
 324           0,    0,  '-',    0,    0,    0,  '+',    0,
 325           0,    0,    0,    0,    0,    0,  '<',    0,
 326           0,    0,    0,    0,    0,    0,    0,    0,
 327           0 };
 328 
 329 static unsigned char shift_map[] = {
 330           0,   27,  '!',  '"',  '#',  '$',  '%',  '&',
 331         '/',  '(',  ')',  '=',  '?',  '`',  127,    9,
 332         'Q',  'W',  'E',  'R',  'T',  'Y',  'U',  'I',
 333         'O',  'P',  197,  '^',   13,    0,  'A',  'S',
 334         'D',  'F',  'G',  'H',  'J',  'K',  'L',  214,
 335         196,  189,    0,  '*',  'Z',  'X',  'C',  'V',
 336         'B',  'N',  'M',  ';',  ':',  '_',    0,  '*',
 337           0,   32,    0,    0,    0,    0,    0,    0,
 338           0,    0,    0,    0,    0,    0,    0,    0,
 339           0,    0,  '-',    0,    0,    0,  '+',    0,
 340           0,    0,    0,    0,    0,    0,  '>',    0,
 341           0,    0,    0,    0,    0,    0,    0,    0,
 342           0 };
 343 
 344 static unsigned char alt_map[] = {
 345           0,    0,    0,  '@',  163,  '$',    0,    0,
 346         '{',  '[',  ']',  '}', '\\',    0,    0,    0,
 347           0,    0,    0,    0,    0,    0,    0,    0,
 348           0,    0,    0,  '~',   13,    0,    0,    0,
 349           0,    0,    0,    0,    0,    0,    0,    0,
 350           0,    0,    0,    0,    0,    0,    0,    0,
 351           0,    0,    0,    0,    0,    0,    0,    0,
 352           0,    0,    0,    0,    0,    0,    0,    0,
 353           0,    0,    0,    0,    0,    0,    0,    0,
 354           0,    0,    0,    0,    0,    0,    0,    0,
 355           0,    0,    0,    0,    0,    0,  '|',    0,
 356           0,    0,    0,    0,    0,    0,    0,    0,
 357           0 };
 358 
 359 #elif defined KBD_US
 360 
 361 static unsigned char key_map[] = {
 362           0,   27,  '1',  '2',  '3',  '4',  '5',  '6',
 363         '7',  '8',  '9',  '0',  '-',  '=',  127,    9,
 364         'q',  'w',  'e',  'r',  't',  'y',  'u',  'i',
 365         'o',  'p',  '[',  ']',   13,    0,  'a',  's',
 366         'd',  'f',  'g',  'h',  'j',  'k',  'l',  ';',
 367         '\'', '`',    0, '\\',  'z',  'x',  'c',  'v',
 368         'b',  'n',  'm',  ',',  '.',  '/',    0,  '*',
 369           0,   32,    0,    0,    0,    0,    0,    0,
 370           0,    0,    0,    0,    0,    0,    0,    0,
 371           0,    0,  '-',    0,    0,    0,  '+',    0,
 372           0,    0,    0,    0,    0,    0,  '<',    0,
 373           0,    0,    0,    0,    0,    0,    0,    0,
 374           0 };
 375 
 376 static unsigned char shift_map[] = {
 377           0,   27,  '!',  '@',  '#',  '$',  '%',  '^',
 378         '&',  '*',  '(',  ')',  '_',  '+',  127,    9,
 379         'Q',  'W',  'E',  'R',  'T',  'Y',  'U',  'I',
 380         'O',  'P',  '{',  '}',   13,    0,  'A',  'S',
 381         'D',  'F',  'G',  'H',  'J',  'K',  'L',  ':',
 382         '"',  '~',  '0',  '|',  'Z',  'X',  'C',  'V',
 383         'B',  'N',  'M',  '<',  '>',  '?',    0,  '*',
 384           0,   32,    0,    0,    0,    0,    0,    0,
 385           0,    0,    0,    0,    0,    0,    0,    0,
 386           0,    0,  '-',    0,    0,    0,  '+',    0,
 387           0,    0,    0,    0,    0,    0,  '>',    0,
 388           0,    0,    0,    0,    0,    0,    0,    0,
 389           0 };
 390 
 391 static unsigned char alt_map[] = {
 392           0,    0,    0,  '@',    0,  '$',    0,    0,
 393         '{',   '[',  ']', '}', '\\',    0,    0,    0,
 394           0,    0,    0,    0,    0,    0,    0,    0,
 395           0,    0,    0,  '~',   13,    0,    0,    0,
 396           0,    0,    0,    0,    0,    0,    0,    0,
 397           0,    0,    0,    0,    0,    0,    0,    0,
 398           0,    0,    0,    0,    0,    0,    0,    0,
 399           0,    0,    0,    0,    0,    0,    0,    0,
 400           0,    0,    0,    0,    0,    0,    0,    0,
 401           0,    0,    0,    0,    0,    0,    0,    0,
 402           0,    0,    0,    0,    0,    0,  '|',    0,
 403           0,    0,    0,    0,    0,    0,    0,    0,
 404           0 };
 405 
 406 #elif defined KBD_UK
 407 
 408 static unsigned char key_map[] = {
 409           0,   27,  '1',  '2',  '3',  '4',  '5',  '6',
 410         '7',  '8',  '9',  '0',  '-',  '=',  127,    9,
 411         'q',  'w',  'e',  'r',  't',  'y',  'u',  'i',
 412         'o',  'p',  '[',  ']',   13,    0,  'a',  's',
 413         'd',  'f',  'g',  'h',  'j',  'k',  'l',  ';',
 414         '\'', '`',    0,  '#',  'z',  'x',  'c',  'v',
 415         'b',  'n',  'm',  ',',  '.',  '/',    0,  '*',
 416           0,   32,    0,    0,    0,    0,    0,    0,
 417           0,    0,    0,    0,    0,    0,    0,    0,
 418           0,    0,  '-',    0,    0,    0,  '+',    0,
 419           0,    0,    0,    0,    0,    0, '\\',    0,
 420           0,    0,    0,    0,    0,    0,    0,    0,
 421           0 };
 422 
 423 static unsigned char shift_map[] = {
 424           0,   27,  '!',  '"',  163,  '$',  '%',  '^',
 425         '&',  '*',  '(',  ')',  '_',  '+',  127,    9,
 426         'Q',  'W',  'E',  'R',  'T',  'Y',  'U',  'I',
 427         'O',  'P',  '{',  '}',   13,    0,  'A',  'S',
 428         'D',  'F',  'G',  'H',  'J',  'K',  'L',  ':',
 429         '@',  '~',  '0',  '~',  'Z',  'X',  'C',  'V',
 430         'B',  'N',  'M',  '<',  '>',  '?',    0,  '*',
 431           0,   32,    0,    0,    0,    0,    0,    0,
 432           0,    0,    0,    0,    0,    0,    0,    0,
 433           0,    0,  '-',    0,    0,    0,  '+',    0,
 434           0,    0,    0,    0,    0,    0,  '|',    0,
 435           0,    0,    0,    0,    0,    0,    0,    0,
 436           0 };
 437 
 438 static unsigned char alt_map[] = {
 439           0,    0,    0,  '@',    0,  '$',    0,    0,
 440         '{',   '[',  ']', '}', '\\',    0,    0,    0,
 441           0,    0,    0,    0,    0,    0,    0,    0,
 442           0,    0,    0,  '~',   13,    0,    0,    0,
 443           0,    0,    0,    0,    0,    0,    0,    0,
 444           0,    0,    0,    0,    0,    0,    0,    0,
 445           0,    0,    0,    0,    0,    0,    0,    0,
 446           0,    0,    0,    0,    0,    0,    0,    0,
 447           0,    0,    0,    0,    0,    0,    0,    0,
 448           0,    0,    0,    0,    0,    0,    0,    0,
 449           0,    0,    0,    0,    0,    0,  '|',    0,
 450           0,    0,    0,    0,    0,    0,    0,    0,
 451           0 };
 452 
 453 #elif defined KBD_GR
 454 
 455 static unsigned char key_map[] = {
 456           0,   27,  '1',  '2',  '3',  '4',  '5',  '6',
 457         '7',  '8',  '9',  '0', '\\', '\'',  127,    9,
 458         'q',  'w',  'e',  'r',  't',  'z',  'u',  'i',
 459         'o',  'p',  '@',  '+',   13,    0,  'a',  's',
 460         'd',  'f',  'g',  'h',  'j',  'k',  'l',  '[',
 461         ']',  '^',    0,  '#',  'y',  'x',  'c',  'v',
 462         'b',  'n',  'm',  ',',  '.',  '-',    0,  '*',
 463           0,   32,    0,    0,    0,    0,    0,    0,
 464           0,    0,    0,    0,    0,    0,    0,    0,
 465           0,    0,  '-',    0,    0,    0,  '+',    0,
 466           0,    0,    0,    0,    0,    0,  '<',    0,
 467           0,    0,    0,    0,    0,    0,    0,    0,
 468           0 };
 469 
 470 static unsigned char shift_map[] = {
 471           0,   27,  '!',  '"',  '#',  '$',  '%',  '&',
 472         '/',  '(',  ')',  '=',  '?',  '`',  127,    9,
 473         'Q',  'W',  'E',  'R',  'T',  'Z',  'U',  'I',
 474         'O',  'P', '\\',  '*',   13,    0,  'A',  'S',
 475         'D',  'F',  'G',  'H',  'J',  'K',  'L',  '{',
 476         '}',  '~',    0, '\'',  'Y',  'X',  'C',  'V',
 477         'B',  'N',  'M',  ';',  ':',  '_',    0,  '*',
 478           0,   32,    0,    0,    0,    0,    0,    0,
 479           0,    0,    0,    0,    0,    0,    0,    0,
 480           0,    0,  '-',    0,    0,    0,  '+',    0,
 481           0,    0,    0,    0,    0,    0,  '>',    0,
 482           0,    0,    0,    0,    0,    0,    0,    0,
 483           0 };
 484 
 485 static unsigned char alt_map[] = {
 486           0,    0,    0,  '@',    0,  '$',    0,    0,
 487         '{',   '[',  ']', '}', '\\',    0,    0,    0,
 488         '@',    0,    0,    0,    0,    0,    0,    0,
 489           0,    0,    0,  '~',   13,    0,    0,    0,
 490           0,    0,    0,    0,    0,    0,    0,    0,
 491           0,    0,    0,    0,    0,    0,    0,    0,
 492           0,    0,    0,    0,    0,    0,    0,    0,
 493           0,    0,    0,    0,    0,    0,    0,    0,
 494           0,    0,    0,    0,    0,    0,    0,    0,
 495           0,    0,    0,    0,    0,    0,    0,    0,
 496           0,    0,    0,    0,    0,    0,  '|',    0,
 497           0,    0,    0,    0,    0,    0,    0,    0,
 498           0 };
 499 
 500 #elif defined KBD_GR_LATIN1
 501 
 502 static unsigned char key_map[] = {
 503           0,   27,  '1',  '2',  '3',  '4',  '5',  '6',
 504         '7',  '8',  '9',  '0', 223,  180,  127,    9,
 505         'q',  'w',  'e',  'r',  't',  'z',  'u',  'i',
 506         'o',  'p',  252,  '+',   13,    0,  'a',  's',
 507         'd',  'f',  'g',  'h',  'j',  'k',  'l', 246,
 508         228,   94,    0,  '#',  'y',  'x',  'c',  'v',
 509         'b',  'n',  'm',  ',',  '.',  '-',    0,  '*',
 510           0,   32,    0,    0,    0,    0,    0,    0,
 511           0,    0,    0,    0,    0,    0,    0,    0,
 512           0,    0,  '-',    0,    0,    0,  '+',    0,
 513           0,    0,    0,    0,    0,    0,  '<',    0,
 514           0,    0,    0,    0,    0,    0,    0,    0,
 515           0 };
 516 
 517 static unsigned char shift_map[] = {
 518           0,   27,  '!',  '"',  167,  '$',  '%',  '&',
 519         '/',  '(',  ')',  '=',  '?',  '`',  127,    9,
 520         'Q',  'W',  'E',  'R',  'T',  'Z',  'U',  'I',
 521         'O',  'P',  220,  '*',   13,    0,  'A',  'S',
 522         'D',  'F',  'G',  'H',  'J',  'K',  'L',  214,
 523         196,  176,    0, '\'',  'Y',  'X',  'C',  'V',
 524         'B',  'N',  'M',  ';',  ':',  '_',    0,  '*',
 525           0,   32,    0,    0,    0,    0,    0,    0,
 526           0,    0,    0,    0,    0,    0,    0,    0,
 527           0,    0,  '-',    0,    0,    0,  '+',    0,
 528           0,    0,    0,    0,    0,    0,  '>',    0,
 529           0,    0,    0,    0,    0,    0,    0,    0,
 530           0 };
 531 
 532 static unsigned char alt_map[] = {
 533           0,    0,    0,  178,  179,  '$',    0,    0,
 534         '{',   '[',  ']', '}', '\\',    0,    0,    0,
 535         '@',    0,    0,    0,    0,    0,    0,    0,
 536           0,    0,    0,  '~',   13,    0,    0,    0,
 537           0,    0,    0,    0,    0,    0,    0,    0,
 538           0,    0,    0,    0,    0,    0,    0,    0,
 539           0,    0,  181,    0,    0,    0,    0,    0,
 540           0,    0,    0,    0,    0,    0,    0,    0,
 541           0,    0,    0,    0,    0,    0,    0,    0,
 542           0,    0,    0,    0,    0,    0,    0,    0,
 543           0,    0,    0,    0,    0,    0,  '|',    0,
 544           0,    0,    0,    0,    0,    0,    0,    0,
 545           0 };
 546 
 547 #elif defined KBD_FR
 548 
 549 static unsigned char key_map[] = {
 550           0,   27,  '&',  '{',  '"', '\'',  '(',  '-',
 551         '}',  '_',  '/',  '@',  ')',  '=',  127,    9,
 552         'a',  'z',  'e',  'r',  't',  'y',  'u',  'i',
 553         'o',  'p',  '^',  '$',   13,    0,  'q',  's',
 554         'd',  'f',  'g',  'h',  'j',  'k',  'l',  'm',
 555         '|',  '`',    0,   42,  'w',  'x',  'c',  'v',
 556         'b',  'n',  ',',  ';',  ':',  '!',    0,  '*',
 557           0,   32,    0,    0,    0,    0,    0,    0,
 558           0,    0,    0,    0,    0,    0,    0,    0,
 559           0,    0,  '-',    0,    0,    0,  '+',    0,
 560           0,    0,    0,    0,    0,    0,  '<',    0,
 561           0,    0,    0,    0,    0,    0,    0,    0,
 562           0 };
 563 
 564 static unsigned char shift_map[] = {
 565           0,   27,  '1',  '2',  '3',  '4',  '5',  '6',
 566         '7',  '8',  '9',  '0',  ']',  '+',  127,    9,
 567         'A',  'Z',  'E',  'R',  'T',  'Y',  'U',  'I',
 568         'O',  'P',  '<',  '>',   13,    0,  'Q',  'S',
 569         'D',  'F',  'G',  'H',  'J',  'K',  'L',  'M',
 570         '%',  '~',    0,  '#',  'W',  'X',  'C',  'V',
 571         'B',  'N',  '?',  '.',  '/', '\\',    0,  '*',
 572           0,   32,    0,    0,    0,    0,    0,    0,
 573           0,    0,    0,    0,    0,    0,    0,    0,
 574           0,    0,  '-',    0,    0,    0,  '+',    0,
 575           0,    0,    0,    0,    0,    0,  '>',    0,
 576           0,    0,    0,    0,    0,    0,    0,    0,
 577           0 };
 578 
 579 static unsigned char alt_map[] = {
 580           0,    0,    0,  '~',  '#',  '{',  '[',  '|',
 581         '`', '\\',   '^',  '@', ']',  '}',    0,    0,
 582         '@',    0,    0,    0,    0,    0,    0,    0,
 583           0,    0,    0,  '~',   13,    0,    0,    0,
 584           0,    0,    0,    0,    0,    0,    0,    0,
 585           0,    0,    0,    0,    0,    0,    0,    0,
 586           0,    0,    0,    0,    0,    0,    0,    0,
 587           0,    0,    0,    0,    0,    0,    0,    0,
 588           0,    0,    0,    0,    0,    0,    0,    0,
 589           0,    0,    0,    0,    0,    0,    0,    0,
 590           0,    0,    0,    0,    0,    0,  '|',    0,
 591           0,    0,    0,    0,    0,    0,    0,    0,
 592           0 };
 593 
 594 #elif defined KBD_FR_LATIN1
 595 
 596 static unsigned char key_map[] = {
 597           0,   27,  '&',  233,  '"', '\'',  '(',  '-',
 598         232,  '_',  231,  224,  ')',  '=',  127,    9,
 599         'a',  'z',  'e',  'r',  't',  'y',  'u',  'i',
 600         'o',  'p',  '^',  '$',   13,    0,  'q',  's',
 601         'd',  'f',  'g',  'h',  'j',  'k',  'l',  'm',
 602         249,  178,    0,   42,  'w',  'x',  'c',  'v',
 603         'b',  'n',  ',',  ';',  ':',  '!',    0,  '*',
 604           0,   32,    0,    0,    0,    0,    0,    0,
 605           0,    0,    0,    0,    0,    0,    0,    0,
 606           0,    0,  '-',    0,    0,    0,  '+',    0,
 607           0,    0,    0,    0,    0,    0,  '<',    0,
 608           0,    0,    0,    0,    0,    0,    0,    0,
 609           0 };
 610 
 611 static unsigned char shift_map[] = {
 612           0,   27,  '1',  '2',  '3',  '4',  '5',  '6',
 613         '7',  '8',  '9',  '0',  176,  '+',  127,    9,
 614         'A',  'Z',  'E',  'R',  'T',  'Y',  'U',  'I',
 615         'O',  'P',  168,  163,   13,    0,  'Q',  'S',
 616         'D',  'F',  'G',  'H',  'J',  'K',  'L',  'M',
 617         '%',    0,    0,  181,  'W',  'X',  'C',  'V',
 618         'B',  'N',  '?',  '.',  '/',  167,    0,  '*',
 619           0,   32,    0,    0,    0,    0,    0,    0,
 620           0,    0,    0,    0,    0,    0,    0,    0,
 621           0,    0,  '-',    0,    0,    0,  '+',    0,
 622           0,    0,    0,    0,    0,    0,  '>',    0,
 623           0,    0,    0,    0,    0,    0,    0,    0,
 624           0 };
 625 
 626 static unsigned char alt_map[] = {
 627           0,    0,    0,  '~',  '#',  '{',  '[',  '|',
 628         '`', '\\',   '^',  '@', ']',  '}',    0,    0,
 629         '@',    0,    0,    0,    0,    0,    0,    0,
 630           0,    0,    0,  164,   13,    0,    0,    0,
 631           0,    0,    0,    0,    0,    0,    0,    0,
 632           0,    0,    0,    0,    0,    0,    0,    0,
 633           0,    0,    0,    0,    0,    0,    0,    0,
 634           0,    0,    0,    0,    0,    0,    0,    0,
 635           0,    0,    0,    0,    0,    0,    0,    0,
 636           0,    0,    0,    0,    0,    0,    0,    0,
 637           0,    0,    0,    0,    0,    0,  '|',    0,
 638           0,    0,    0,    0,    0,    0,    0,    0,
 639           0 };
 640 
 641 #elif defined KBD_DK
 642 
 643 static unsigned char key_map[] = {
 644           0,   27,  '1',  '2',  '3',  '4',  '5',  '6',
 645         '7',  '8',  '9',  '0',  '+', '\'',  127,    9,
 646         'q',  'w',  'e',  'r',  't',  'y',  'u',  'i',
 647         'o',  'p',  229,    0,   13,    0,  'a',  's',
 648         'd',  'f',  'g',  'h',  'j',  'k',  'l',  230,
 649         162,    0,    0, '\'',  'z',  'x',  'c',  'v',
 650         'b',  'n',  'm',  ',',  '.',  '-',    0,  '*',
 651           0,   32,    0,    0,    0,    0,    0,    0,
 652           0,    0,    0,    0,    0,    0,    0,    0,
 653           0,    0,  '-',    0,    0,    0,  '+',    0,
 654           0,    0,    0,    0,    0,    0,  '<',    0,
 655           0,    0,    0,    0,    0,    0,    0,    0,
 656           0 };
 657 
 658 static unsigned char shift_map[] = {
 659           0,   27,  '!', '\"',  '#',  '$',  '%',  '&',
 660         '/',  '(',  ')',  '=',  '?',  '`',  127,    9,
 661         'Q',  'W',  'E',  'R',  'T',  'Y',  'U',  'I',
 662         'O',  'P',  197,  '^',   13,    0,  'A',  'S',
 663         'D',  'F',  'G',  'H',  'J',  'K',  'L',  198,
 664         165,    0,    0,  '*',  'Z',  'X',  'C',  'V',
 665         'B',  'N',  'M',  ';',  ':',  '_',    0,  '*',
 666           0,   32,    0,    0,    0,    0,    0,    0,
 667           0,    0,    0,    0,    0,    0,    0,    0,
 668           0,    0,  '-',    0,    0,    0,  '+',    0,
 669           0,    0,    0,    0,    0,    0,  '>',    0,
 670           0,    0,    0,    0,    0,    0,    0,    0,
 671           0 };
 672 
 673 static unsigned char alt_map[] = {
 674           0,    0,    0,  '@',  163,  '$',    0,    0,
 675         '{',   '[',  ']', '}',    0,  '|',    0,    0,
 676           0,    0,    0,    0,    0,    0,    0,    0,
 677           0,    0,    0,  '~',   13,    0,    0,    0,
 678           0,    0,    0,    0,    0,    0,    0,    0,
 679           0,    0,    0,    0,    0,    0,    0,    0,
 680           0,    0,    0,    0,    0,    0,    0,    0,
 681           0,    0,    0,    0,    0,    0,    0,    0,
 682           0,    0,    0,    0,    0,    0,    0,    0,
 683           0,    0,    0,    0,    0,    0,    0,    0,
 684           0,    0,    0,    0,    0,    0,  '\\',    0,
 685           0,    0,    0,    0,    0,    0,    0,    0,
 686           0 };
 687 
 688 #elif defined KBD_DK_LATIN1
 689 
 690 static unsigned char key_map[] = {
 691           0,   27,  '1',  '2',  '3',  '4',  '5',  '6',
 692         '7',  '8',  '9',  '0',  '+',  180,  127,    9,
 693         'q',  'w',  'e',  'r',  't',  'y',  'u',  'i',
 694         'o',  'p',  229,  168,   13,    0,  'a',  's',
 695         'd',  'f',  'g',  'h',  'j',  'k',  'l',  230,
 696         162,  189,    0, '\'',  'z',  'x',  'c',  'v',
 697         'b',  'n',  'm',  ',',  '.',  '-',    0,  '*',
 698           0,   32,    0,    0,    0,    0,    0,    0,
 699           0,    0,    0,    0,    0,    0,    0,    0,
 700           0,    0,  '-',    0,    0,    0,  '+',    0,
 701           0,    0,    0,    0,    0,    0,  '<',    0,
 702           0,    0,    0,    0,    0,    0,    0,    0,
 703           0 };
 704 
 705 static unsigned char shift_map[] = {
 706           0,   27,  '!', '\"',  '#',  '$',  '%',  '&',
 707         '/',  '(',  ')',  '=',  '?',  '`',  127,    9,
 708         'Q',  'W',  'E',  'R',  'T',  'Y',  'U',  'I',
 709         'O',  'P',  197,  '^',   13,    0,  'A',  'S',
 710         'D',  'F',  'G',  'H',  'J',  'K',  'L',  198,
 711         165,  167,    0,  '*',  'Z',  'X',  'C',  'V',
 712         'B',  'N',  'M',  ';',  ':',  '_',    0,  '*',
 713           0,   32,    0,    0,    0,    0,    0,    0,
 714           0,    0,    0,    0,    0,    0,    0,    0,
 715           0,    0,  '-',    0,    0,    0,  '+',    0,
 716           0,    0,    0,    0,    0,    0,  '>',    0,
 717           0,    0,    0,    0,    0,    0,    0,    0,
 718           0 };
 719 
 720 static unsigned char alt_map[] = {
 721           0,    0,    0,  '@',  163,  '$',    0,    0,
 722         '{',   '[',  ']', '}',    0,  '|',    0,    0,
 723           0,    0,    0,    0,    0,    0,    0,    0,
 724           0,    0,    0,  '~',   13,    0,    0,    0,
 725           0,    0,    0,    0,    0,    0,    0,    0,
 726           0,    0,    0,    0,    0,    0,    0,    0,
 727           0,    0,    0,    0,    0,    0,    0,    0,
 728           0,    0,    0,    0,    0,    0,    0,    0,
 729           0,    0,    0,    0,    0,    0,    0,    0,
 730           0,    0,    0,    0,    0,    0,    0,    0,
 731           0,    0,    0,    0,    0,    0, '\\',    0,
 732           0,    0,    0,    0,    0,    0,    0,    0,
 733           0 };
 734 
 735 #elif defined KBD_DVORAK
 736 
 737 static unsigned char key_map[] = {
 738           0,   27,  '1',  '2',  '3',  '4',  '5',  '6',
 739         '7',  '8',  '9',  '0', '\\',  '=',  127,    9,
 740         '\'', ',',  '.',  'p',  'y',  'f',  'g',  'c',
 741         'r',  'l',  '/',  ']',   13,    0,  'a',  'o',
 742         'e',  'u',  'i',  'd',  'h',  't',  'n',  's',
 743         '-',  '`',    0,  '[',  ';',  'q',  'j',  'k',
 744         'x',  'b',  'm',  'w',  'v',  'z',    0,  '*',
 745           0,   32,    0,    0,    0,    0,    0,    0,
 746           0,    0,    0,    0,    0,    0,    0,    0,
 747           0,    0,  '-',    0,    0,    0,  '+',    0,
 748           0,    0,    0,    0,    0,    0,  '<',    0,
 749           0,    0,    0,    0,    0,    0,    0,    0,
 750           0 };
 751 
 752 static unsigned char shift_map[] = {
 753           0,   27,  '!',  '@',  '#',  '$',  '%',  '^',
 754         '&',  '*',  '(',  ')',  '|',  '+',  127,    9,
 755         '"',  '<',  '>',  'P',  'Y',  'F',  'G',  'C',
 756         'R',  'L',  '?',  '}',   13,    0,  'A',  'O',
 757         'E',  'U',  'I',  'D',  'H',  'T',  'N',  'S',
 758         '_',  '~',    0,  '{',  ':',  'Q',  'J',  'K',
 759         'X',  'B',  'M',  'W',  'V',  'Z',    0,  '*',
 760           0,   32,    0,    0,    0,    0,    0,    0,
 761           0,    0,    0,    0,    0,    0,    0,    0,
 762           0,    0,  '-',    0,    0,    0,  '+',    0,
 763           0,    0,    0,    0,    0,    0,  '<',    0,
 764           0,    0,    0,    0,    0,    0,    0,    0,
 765           0 };
 766 
 767 static unsigned char alt_map[] = {
 768           0,    0,    0,  '@',    0,  '$',    0,    0,
 769         '{',   '[',  ']', '}', '\\',    0,    0,    0,
 770           0,    0,    0,    0,    0,    0,    0,    0,
 771           0,    0,    0,  '~',   13,    0,    0,    0,
 772           0,    0,    0,    0,    0,    0,    0,    0,
 773           0,    0,    0,    0,    0,    0,    0,    0,
 774           0,    0,    0,    0,    0,    0,    0,    0,
 775           0,    0,    0,    0,    0,    0,    0,    0,
 776           0,    0,    0,    0,    0,    0,    0,    0,
 777           0,    0,    0,    0,    0,    0,    0,    0,
 778           0,    0,    0,    0,    0,    0,  '|',    0,
 779           0,    0,    0,    0,    0,    0,    0,    0,
 780           0 };
 781 
 782 #elif defined KBD_SG
 783 
 784 static unsigned char key_map[] = {
 785           0,   27,  '1',  '2',  '3',  '4',  '5',  '6',
 786         '7',  '8',  '9',  '0', '\'',  '^',  127,    9,
 787         'q',  'w',  'e',  'r',  't',  'z',  'u',  'i',
 788         'o',  'p',    0,    0,   13,    0,  'a',  's',
 789         'd',  'f',  'g',  'h',  'j',  'k',  'l',    0,
 790           0,    0,    0,  '$',  'y',  'x',  'c',  'v',
 791         'b',  'n',  'm',  ',',  '.',  '-',    0,  '*',
 792           0,   32,    0,    0,    0,    0,    0,    0,
 793           0,    0,    0,    0,    0,    0,    0,    0,
 794           0,    0,  '-',    0,    0,    0,  '+',    0,
 795           0,    0,    0,    0,    0,    0,  '<',    0,
 796           0,    0,    0,    0,    0,    0,    0,    0,
 797           0 };
 798 
 799 static unsigned char shift_map[] = {
 800           0,   27,  '+',  '"',  '*',    0,  '%',  '&',
 801         '/',  '(',  ')',  '=',  '?',  '`',  127,    9,
 802         'Q',  'W',  'E',  'R',  'T',  'Z',  'U',  'I',
 803         'O',  'P',    0,  '!',   13,    0,  'A',  'S',
 804         'D',  'F',  'G',  'H',  'J',  'K',  'L',    0,
 805           0,    0,    0,    0,  'Y',  'X',  'C',  'V',
 806         'B',  'N',  'M',  ';',  ':',  '_',    0,  '*',
 807           0,   32,    0,    0,    0,    0,    0,    0,
 808           0,    0,    0,    0,    0,    0,    0,    0,
 809           0,    0,  '-',    0,    0,    0,  '+',    0,
 810           0,    0,    0,    0,    0,    0,  '>',    0,
 811           0,    0,    0,    0,    0,    0,    0,    0,
 812           0 };
 813 
 814 static unsigned char alt_map[] = {
 815           0,    0,    0,  '@',  '#',    0,    0,    0,
 816         '|',    0,    0,    0, '\'',  '~',    0,    0,
 817         '@',    0,    0,    0,    0,    0,    0,    0,
 818           0,    0,   '[',  ']',  13,    0,    0,    0,
 819           0,    0,    0,    0,    0,    0,    0,    0,
 820         '{',    0,    0,  '}',    0,    0,    0,    0,
 821           0,    0,    0,    0,    0,    0,    0,    0,
 822           0,    0,    0,    0,    0,    0,    0,    0,
 823           0,    0,    0,    0,    0,    0,    0,    0,
 824           0,    0,    0,    0,    0,    0,    0,    0,
 825           0,    0,    0,    0,    0,    0, '\\',    0,
 826           0,    0,    0,    0,    0,    0,    0,    0,
 827           0 };
 828 
 829 #elif defined KBD_SG_LATIN1
 830 
 831 static unsigned char key_map[] = {
 832           0,   27,  '1',  '2',  '3',  '4',  '5',  '6',
 833         '7',  '8',  '9',  '0', '\'',  '^',  127,    9,
 834         'q',  'w',  'e',  'r',  't',  'z',  'u',  'i',
 835         'o',  'p',  252,    0,   13,    0,  'a',  's',
 836         'd',  'f',  'g',  'h',  'j',  'k',  'l',  246,
 837         228,  167,    0,  '$',  'y',  'x',  'c',  'v',
 838         'b',  'n',  'm',  ',',  '.',  '-',    0,  '*',
 839           0,   32,    0,    0,    0,    0,    0,    0,
 840           0,    0,    0,    0,    0,    0,    0,    0,
 841           0,    0,  '-',    0,    0,    0,  '+',    0,
 842           0,    0,    0,    0,    0,    0,  '<',    0,
 843           0,    0,    0,    0,    0,    0,    0,    0,
 844           0 };
 845 
 846 static unsigned char shift_map[] = {
 847           0,   27,  '+',  '"',  '*',  231,  '%',  '&',
 848         '/',  '(',  ')',  '=',  '?',  '`',  127,    9,
 849         'Q',  'W',  'E',  'R',  'T',  'Z',  'U',  'I',
 850         'O',  'P',  220,  '!',   13,    0,  'A',  'S',
 851         'D',  'F',  'G',  'H',  'J',  'K',  'L',  214,
 852         196,  176,    0,  163,  'Y',  'X',  'C',  'V',
 853         'B',  'N',  'M',  ';',  ':',  '_',    0,  '*',
 854           0,   32,    0,    0,    0,    0,    0,    0,
 855           0,    0,    0,    0,    0,    0,    0,    0,
 856           0,    0,  '-',    0,    0,    0,  '+',    0,
 857           0,    0,    0,    0,    0,    0,  '>',    0,
 858           0,    0,    0,    0,    0,    0,    0,    0,
 859           0 };
 860 
 861 static unsigned char alt_map[] = {
 862           0,    0,    0,  '@',  '#',    0,    0,  172,
 863         '|',  162,    0,    0, '\'',  '~',    0,    0,
 864         '@',    0,    0,    0,    0,    0,    0,    0,
 865           0,    0,  '[',  ']',   13,    0,    0,    0,
 866           0,    0,    0,    0,    0,    0,    0,  233,
 867         '{',    0,    0,  '}',    0,    0,    0,    0,
 868           0,    0,    0,    0,    0,    0,    0,    0,
 869           0,    0,    0,    0,    0,    0,    0,    0,
 870           0,    0,    0,    0,    0,    0,    0,    0,
 871           0,    0,    0,    0,    0,    0,    0,    0,
 872           0,    0,    0,    0,    0,    0, '\\',    0,
 873           0,    0,    0,    0,    0,    0,    0,    0,
 874           0 };
 875 
 876 #elif defined KBD_NO
 877 
 878 static unsigned char key_map[] = {
 879           0,   27,  '1',  '2',  '3',  '4',  '5',  '6',
 880         '7',  '8',  '9',  '0',  '+', '\\',  127,    9,
 881         'q',  'w',  'e',  'r',  't',  'y',  'u',  'i',
 882         'o',  'p',  '}',  '~',   13,    0,  'a',  's',
 883         'd',  'f',  'g',  'h',  'j',  'k',  'l',  '|',
 884         '{',  '|',    0, '\'',  'z',  'x',  'c',  'v',
 885         'b',  'n',  'm',  ',',  '.',  '-',    0,  '*',
 886           0,   32,    0,    0,    0,    0,    0,    0,
 887           0,    0,    0,    0,    0,    0,    0,    0,
 888           0,    0,  '-',    0,    0,    0,  '+',    0,
 889           0,    0,    0,    0,    0,    0,  '<',    0,
 890           0,    0,    0,    0,    0,    0,    0,    0,
 891           0 };
 892 
 893 static unsigned char shift_map[] = {
 894           0,   27,  '!', '\"',  '#',  '$',  '%',  '&',
 895         '/',  '(',  ')',  '=',  '?',  '`',  127,    9,
 896         'Q',  'W',  'E',  'R',  'T',  'Y',  'U',  'I',
 897         'O',  'P',  ']',  '^',   13,    0,  'A',  'S',
 898         'D',  'F',  'G',  'H',  'J',  'K',  'L', '\\',
 899         '[',    0,    0,  '*',  'Z',  'X',  'C',  'V',
 900         'B',  'N',  'M',  ';',  ':',  '_',    0,  '*',
 901           0,   32,    0,    0,    0,    0,    0,    0,
 902           0,    0,    0,    0,    0,    0,    0,    0,
 903           0,    0,  '-',    0,    0,    0,  '+',    0,
 904           0,    0,    0,    0,    0,    0,  '>',    0,
 905           0,    0,    0,    0,    0,    0,    0,    0,
 906           0 };
 907 
 908 static unsigned char alt_map[] = {
 909           0,    0,    0,  '@',    0,  '$',    0,    0,
 910         '{',   '[',  ']', '}',    0, '\'',    0,    0,
 911           0,    0,    0,    0,    0,    0,    0,    0,
 912           0,    0,    0,  '~',   13,    0,    0,    0,
 913           0,    0,    0,    0,    0,    0,    0,    0,
 914           0,    0,    0,    0,    0,    0,    0,    0,
 915           0,    0,    0,    0,    0,    0,    0,    0,
 916           0,    0,    0,    0,    0,    0,    0,    0,
 917           0,    0,    0,    0,    0,    0,    0,    0,
 918           0,    0,    0,    0,    0,    0,    0,    0,
 919           0,    0,    0,    0,    0,    0,    0,    0,
 920           0,    0,    0,    0,    0,    0,    0,    0,
 921           0 };
 922 
 923 #elif defined KBD_SF
 924 
 925 static unsigned char key_map[] = {
 926           0,   27,  '1',  '2',  '3',  '4',  '5',  '6',
 927         '7',  '8',  '9',  '0', '\'',  '^',  127,    9,
 928         'q',  'w',  'e',  'r',  't',  'z',  'u',  'i',
 929         'o',  'p',    0,    0,   13,    0,  'a',  's',
 930         'd',  'f',  'g',  'h',  'j',  'k',  'l',    0,
 931           0,    0,   0,   '$',  'y',  'x',  'c',  'v',
 932         'b',  'n',  'm',  ',',  '.',  '-',    0,  '*',
 933           0,   32,    0,    0,    0,    0,    0,    0,
 934           0,    0,    0,    0,    0,    0,    0,    0,
 935           0,    0,  '-',    0,    0,    0,  '+',    0,
 936           0,    0,    0,    0,    0,    0,  '<',    0,
 937           0,    0,    0,    0,    0,    0,    0,    0,
 938           0 };
 939 static unsigned char shift_map[] = {
 940           0,   27,  '+',  '"',  '*',    0,  '%',  '&',
 941         '/',  '(',  ')',  '=',  '?',  '`',  127,    9,
 942         'Q',  'W',  'E',  'R',  'T',  'Z',  'U',  'I',
 943         'O',  'P',    0,  '!',   13,    0,  'A',  'S',
 944         'D',  'F',  'G',  'H',  'J',  'K',  'L',    0,
 945           0,    0,    0,    0,  'Y',  'X',  'C',  'V',
 946         'B',  'N',  'M',  ';',  ':',  '_',    0,  '*',
 947           0,   32,    0,    0,    0,    0,    0,    0,
 948           0,    0,    0,    0,    0,    0,    0,    0,
 949           0,    0,  '-',    0,    0,    0,  '+',    0,
 950           0,    0,    0,    0,    0,    0,  '>',    0,
 951           0,    0,    0,    0,    0,    0,    0,    0,
 952           0 };
 953 static unsigned char alt_map[] = {
 954           0,    0,    0,  '@',  '#',    0,    0,    0,
 955         '|',    0,    0,    0,  '\'', '~',    0,    0,
 956           0,    0,    0,    0,    0,    0,    0,    0,
 957           0,    0,   '[',  ']',  13,    0,    0,    0,
 958           0,    0,    0,    0,    0,    0,    0,    0,
 959          '{',   0,    0,   '}',   0,    0,    0,    0,
 960           0,    0,    0,    0,    0,    0,    0,    0,
 961           0,    0,    0,    0,    0,    0,    0,    0,
 962           0,    0,    0,    0,    0,    0,    0,    0,
 963           0,    0,    0,    0,    0,    0,    0,    0,
 964           0,    0,    0,    0,    0,    0,  '\\',   0,
 965           0,    0,    0,    0,    0,    0,    0,    0,
 966           0 };
 967 
 968 #elif defined KBD_SF_LATIN1
 969 
 970 static unsigned char key_map[] = {
 971           0,   27,  '1',  '2',  '3',  '4',  '5',  '6',
 972         '7',  '8',  '9',  '0', '\'',  '^',  127,    9,
 973         'q',  'w',  'e',  'r',  't',  'z',  'u',  'i',
 974         'o',  'p',  232,  168,   13,    0,  'a',  's',
 975         'd',  'f',  'g',  'h',  'j',  'k',  'l',  233,
 976         224,  167,    0,  '$',  'y',  'x',  'c',  'v',
 977         'b',  'n',  'm',  ',',  '.',  '-',    0,  '*',
 978           0,   32,    0,    0,    0,    0,    0,    0,
 979           0,    0,    0,    0,    0,    0,    0,    0,
 980           0,    0,  '-',    0,    0,    0,  '+',    0,
 981           0,    0,    0,    0,    0,    0,  '<',    0,
 982           0,    0,    0,    0,    0,    0,    0,    0,
 983           0 };
 984 static unsigned char shift_map[] = {
 985           0,   27,  '+',  '"',  '*',  231,  '%',  '&',
 986         '/',  '(',  ')',  '=',  '?',  '`',  127,    9,
 987         'Q',  'W',  'E',  'R',  'T',  'Z',  'U',  'I',
 988         'O',  'P',  252,  '!',   13,    0,  'A',  'S',
 989         'D',  'F',  'G',  'H',  'J',  'K',  'L',  246,
 990         228,  176,    0,  163,  'Y',  'X',  'C',  'V',
 991         'B',  'N',  'M',  ';',  ':',  '_',    0,  '*',
 992           0,   32,    0,    0,    0,    0,    0,    0,
 993           0,    0,    0,    0,    0,    0,    0,    0,
 994           0,    0,  '-',    0,    0,    0,  '+',    0,
 995           0,    0,    0,    0,    0,    0,  '>',    0,
 996           0,    0,    0,    0,    0,    0,    0,    0,
 997           0 };
 998 static unsigned char alt_map[] = {
 999           0,    0,    0,  '@',  '#',    0,    0,  172,
1000         '|',   162,   0,    0,  180,  '~',    0,    0,
1001           0,    0,    0,    0,    0,    0,    0,    0,
1002           0,    0,   '[',  ']',  13,    0,    0,    0,
1003           0,    0,    0,    0,    0,    0,    0,    0,
1004          '{',   0,    0,   '}',   0,    0,    0,    0,
1005           0,    0,    0,    0,    0,    0,    0,    0,
1006           0,    0,    0,    0,    0,    0,    0,    0,
1007           0,    0,    0,    0,    0,    0,    0,    0,
1008           0,    0,    0,    0,    0,    0,    0,    0,
1009           0,    0,    0,    0,    0,    0,  '\\',   0,
1010           0,    0,    0,    0,    0,    0,    0,    0,
1011           0 };
1012 #else
1013 #error "KBD-type not defined"
1014 #endif
1015 
1016 static void do_self(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
1017 {
1018         unsigned char ch;
1019 
1020         if (kbd_flag(KG_ALTGR))
1021                 ch = alt_map[sc];
1022         else if (kbd_flag(KG_LSHIFT) || kbd_flag(KG_RSHIFT) ||
1023                  kbd_flag(KG_LCTRL) || kbd_flag(KG_RCTRL))
1024                 ch = shift_map[sc];
1025         else
1026                 ch = key_map[sc];
1027 
1028         if (ch == 0)
1029                 return;
1030 
1031         if ((ch = handle_diacr(ch)) == 0)
1032                 return;
1033 
1034         if (kbd_flag(KG_LCTRL) || kbd_flag(KG_RCTRL) ||
1035             vc_kbd_flag(kbd,VC_CAPSLOCK))       /* ctrl or caps */
1036                 if ((ch >= 'a' && ch <= 'z') || (ch >= 224 && ch <= 254))
1037                         ch -= 32;
1038         if (kbd_flag(KG_LCTRL) || kbd_flag(KG_RCTRL))   /* ctrl */
1039                 ch &= 0x1f;
1040 
1041         if (kbd_flag(KG_ALT))
1042                 if (vc_kbd_flag(kbd,VC_META)) {
1043                         put_queue('\033');
1044                         put_queue(ch);
1045                 } else
1046                         put_queue(ch|0x80);
1047         else
1048                 put_queue(ch);
1049 }
1050 
1051 unsigned char accent_table[5][64] = {
1052         " \300BCD\310FGH\314JKLMN\322PQRST\331VWXYZ[\\]^_"
1053         "`\340bcd\350fgh\354jklmn\362pqrst\371vwxyz{|}~",   /* accent grave */
1054 
1055         " \301BCD\311FGH\315JKLMN\323PQRST\332VWX\335Z[\\]^_"
1056         "`\341bcd\351fgh\355jklmn\363pqrst\372vwxyz{|}~",   /* accent acute */
1057 
1058         " \302BCD\312FGH\316JKLMN\324PQRST\333VWXYZ[\\]^_"
1059         "`\342bcd\352fgh\356jklmn\364pqrst\373vwxyz{|}~",   /* circumflex */
1060 
1061         " \303BCDEFGHIJKLMN\325PQRSTUVWXYZ[\\]^_"
1062         "`\343bcdefghijklm\361\365pqrstuvwxyz{|}~",         /* tilde */
1063 
1064         " \304BCD\313FGH\316JKLMN\326PQRST\334VWXYZ[\\]^_"
1065         "`\344bcd\353fgh\357jklmn\366pqrst\374vwx\377z{|}~" /* dieresis */
1066 };
1067 
1068 /*
1069  * Check if dead key pressed. If so, check if same key pressed twice;
1070  * in that case return the char, otherwise store char and return 0.
1071  * If dead key not pressed, check if accented character pending. If
1072  * not: return the char, otherwise check if char is a space. If it is
1073  * a space return the diacritical. Else combine char with diacritical
1074  * mark and return.
1075  */
1076 
1077 unsigned int handle_diacr(unsigned int ch)
     /* [previous][next][first][last][top][bottom][index][help] */
1078 {
1079         static unsigned char diacr_table[] =
1080                 {'`', 180, '^', '~', 168, 0};           /* Must end with 0 */
1081         int i;
1082 
1083         for(i=0; diacr_table[i]; i++)
1084                 if (ch==diacr_table[i] && ((1<<i)&kbd->kbd_flags)) {
1085                         if (diacr == i) {
1086                                 diacr=-1;
1087                                 return ch;              /* pressed twice */
1088                         } else {
1089                                 diacr=i;                /* key is dead */
1090                                 return 0;
1091                         }
1092                 }
1093         if (diacr == -1)
1094                 return ch;
1095         else if (ch == ' ') {
1096                 ch=diacr_table[diacr];
1097                 diacr=-1;
1098                 return ch;
1099         } else if (ch<64 || ch>122) {
1100                 diacr=-1;
1101                 return ch;
1102         } else {
1103                 ch=accent_table[diacr][ch-64];
1104                 diacr=-1;
1105                 return ch;
1106         }
1107 }
1108 
1109 #if defined KBD_FR || defined KBD_US || defined KBD_UK || defined KBD_FR_LATIN1
1110 static unsigned char num_table[] = "789-456+1230.";
1111 #else
1112 static unsigned char num_table[] = "789-456+1230,";
1113 #endif
1114 
1115 static unsigned char cur_table[] = "1A5-DGC+4B623";
1116 static unsigned int pad_table[] = { 7,8,9,0,4,5,6,0,1,2,3,0,0 };
1117 
1118 /*
1119     Keypad /                    35      B7      Q
1120     Keypad *  (PrtSc)           37      B7      R
1121     Keypad NumLock              45      ??      P
1122     Keypad 7  (Home)            47      C7      w
1123     Keypad 8  (Up arrow)        48      C8      x
1124     Keypad 9  (PgUp)            49      C9      y
1125     Keypad -                    4A      CA      S
1126     Keypad 4  (Left arrow)      4B      CB      t
1127     Keypad 5                    4C      CC      u
1128     Keypad 6  (Right arrow)     4D      CD      v
1129     Keypad +                    4E      CE      l
1130     Keypad 1  (End)             4F      CF      q
1131     Keypad 2  (Down arrow)      50      D0      r
1132     Keypad 3  (PgDn)            51      D1      s
1133     Keypad 0  (Ins)             52      D2      p
1134     Keypad .  (Del)             53      D3      n
1135 */
1136 
1137 static unsigned char appl_table[] = "wxyStuvlqrspn";
1138 
1139 /*
1140   Set up keyboard to generate DEC VT200 F-keys.
1141   DEC F1  - F5  not implemented (DEC HOLD, LOCAL PRINT, SETUP, SW SESS, BREAK)
1142   DEC F6  - F10 are mapped to F6 - F10
1143   DEC F11 - F20 are mapped to Shift-F1 - Shift-F10
1144   DEC HELP and DEC DO are mapped to F11, F12 or Shift- F11, F12.
1145   Regular (?) Linux F1-F5 remain the same.
1146 */
1147 
1148 static char *func_table[2][12] = { /* DEC F1 - F10 */ {
1149         "\033[[A",  "\033[[B",  "\033[[C",  "\033[[D",
1150         "\033[[E",  "\033[17~", "\033[18~", "\033[19~",
1151         "\033[20~", "\033[21~", "\033[28~", "\033[29~"
1152 }, /* DEC F11 - F20 */ {
1153         "\033[23~", "\033[24~", "\033[25~", "\033[26~",
1154         "\033[28~", "\033[29~", "\033[31~", "\033[32~",
1155         "\033[33~", "\033[34~", "\033[28~", "\033[29~"
1156 }};
1157 
1158 static void cursor(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
1159 {
1160         if (sc < 0x47 || sc > 0x53)
1161                 return;
1162         sc -= 0x47;
1163         if (sc == 12 &&
1164             (kbd_flag(KG_LCTRL) || kbd_flag(KG_RCTRL)) &&
1165             (kbd_flag(KG_ALT) || kbd_flag(KG_ALTGR))) {
1166                 ctrl_alt_del();
1167                 return;
1168         }
1169         if (kbd_dead(KGD_E0)) {
1170                 cur(sc);
1171                 return;
1172         }
1173 
1174         if (kbd_flag(KG_ALT) && sc != 12) {                     /* Alt-numpad */
1175                 npadch=npadch*10+pad_table[sc];
1176                 return;
1177         }
1178 
1179         if (vc_kbd_flag(kbd,VC_APPLIC) &&
1180             !kbd_flag(KG_LSHIFT) &&     /* shift forces cursor */
1181             !kbd_flag(KG_RSHIFT)) {
1182                 applkey(appl_table[sc]);
1183                 return;
1184         }
1185 
1186         if (vc_kbd_flag(kbd,VC_NUMLOCK)) {
1187                 put_queue(num_table[sc]);
1188         } else
1189                 cur(sc);
1190 }
1191 
1192 static void cur(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
1193 {
1194         char buf[] = { 0x1b, '[', 0, 0, 0 };            /* must not be static */
1195 
1196         buf[2]=cur_table[sc];
1197         if (buf[2] < '9')
1198                 buf[3]='~';
1199         else
1200                 if ((buf[2] >= 'A' && buf[2] <= 'D') ?
1201                     vc_kbd_flag(kbd,VC_CKMODE) :
1202                     vc_kbd_flag(kbd,VC_APPLIC))
1203                         buf[1]='O';
1204         puts_queue(buf);
1205 }
1206 
1207 static void func(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
1208 {
1209         if (sc < 0x3b)
1210                 return;
1211         sc-=0x3b;
1212         if (sc > 9) {
1213                 sc-=18;
1214                 if (sc < 10 || sc > 11)
1215                         return;
1216         }
1217         if (kbd_flag(KG_ALT))
1218                 change_console(sc);
1219         else
1220                 if (kbd_flag(KG_LSHIFT) || kbd_flag(KG_RSHIFT)) /* DEC F11 - F20 */
1221                         puts_queue(func_table[1][sc]);
1222                 else                                    /* DEC F1 - F10 */
1223                         puts_queue(func_table[0][sc]);
1224 }
1225 
1226 static void slash(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
1227 {
1228         if (!kbd_dead(KGD_E0))
1229                 do_self(sc);
1230         else if (vc_kbd_flag(kbd,VC_APPLIC))
1231                 applkey('Q');
1232         else
1233                 put_queue('/');
1234 }
1235 
1236 static void star(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
1237 {
1238         if (vc_kbd_flag(kbd,VC_APPLIC))
1239                 applkey('R');
1240         else
1241                 do_self(sc);
1242 }
1243 
1244 static void enter(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
1245 {
1246         if (kbd_dead(KGD_E0) && vc_kbd_flag(kbd,VC_APPLIC))
1247                 applkey('M');
1248         else {
1249                 put_queue(13);
1250                 if (vc_kbd_flag(kbd,VC_CRLF))
1251                         put_queue(10);
1252         }
1253 }
1254 
1255 static void minus(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
1256 {
1257         if (vc_kbd_flag(kbd,VC_APPLIC))
1258                 applkey('S');
1259         else
1260                 do_self(sc);
1261 }
1262 
1263 static void plus(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
1264 {
1265         if (vc_kbd_flag(kbd,VC_APPLIC))
1266                 applkey('l');
1267         else
1268                 do_self(sc);
1269 }
1270 
1271 static void none(int sc)
     /* [previous][next][first][last][top][bottom][index][help] */
1272 {
1273 }
1274 
1275 /*
1276  * kb_wait waits for the keyboard controller buffer to empty.
1277  */
1278 static void kb_wait(void)
     /* [previous][next][first][last][top][bottom][index][help] */
1279 {
1280         int i;
1281 
1282         for (i=0; i<0x10000; i++)
1283                 if ((inb(0x64)&0x02) == 0)
1284                         break;
1285 }
1286 
1287 /*
1288  * kb_ack waits for 0xfa to appear in port 0x60
1289  *
1290  * Suggested by Bruce Evans
1291  * Added by Niels Skou Olsen [NSO]
1292  * April 21, 1992
1293  *
1294  * Heavily inspired by kb_wait :-)
1295  * I don't know how much waiting actually is required,
1296  * but this seems to work
1297  */
1298 static void kb_ack(void)
     /* [previous][next][first][last][top][bottom][index][help] */
1299 {
1300         int i;
1301 
1302         for(i=0; i<0x10000; i++)
1303                 if (inb(0x60) == 0xfa)
1304                         break;
1305 }
1306 
1307 void set_leds(void)
     /* [previous][next][first][last][top][bottom][index][help] */
1308 {
1309         static unsigned char old_leds = -1;
1310         unsigned char leds = kbd_table[fg_console].flags & LED_MASK;
1311 
1312         if (leds != old_leds) {
1313                 old_leds = leds;
1314                 kb_wait();
1315                 outb(0xed, 0x60);       /* set leds command */
1316                 kb_ack();
1317                 kb_wait();
1318                 outb(leds, 0x60);
1319                 kb_ack();
1320         }
1321 }
1322 
1323 long no_idt[2] = {0, 0};
1324 
1325 /*
1326  * This routine reboots the machine by asking the keyboard
1327  * controller to pulse the reset-line low. We try that for a while,
1328  * and if it doesn't work, we do some other stupid things.
1329  */
1330 void hard_reset_now(void)
     /* [previous][next][first][last][top][bottom][index][help] */
1331 {
1332         int i, j;
1333         extern unsigned long pg0[1024];
1334 
1335         sti();
1336 /* rebooting needs to touch the page at absolute addr 0 */
1337         pg0[0] = 7;
1338         *((unsigned short *)0x472) = 0x1234;
1339         for (;;) {
1340                 for (i=0; i<100; i++) {
1341                         kb_wait();
1342                         for(j = 0; j < 100000 ; j++)
1343                                 /* nothing */;
1344                         outb(0xfe,0x64);         /* pulse reset low */
1345                 }
1346                 __asm__("\tlidt _no_idt"::);
1347         }
1348 }
1349 
1350 static fptr key_table[] = {
1351         none,do_self,do_self,do_self,           /* 00-03 s0 esc 1 2 */
1352         do_self,do_self,do_self,do_self,        /* 04-07 3 4 5 6 */
1353         do_self,do_self,do_self,do_self,        /* 08-0B 7 8 9 0 */
1354         do_self,do_self,do_self,do_self,        /* 0C-0F + ' bs tab */
1355         do_self,do_self,do_self,do_self,        /* 10-13 q w e r */
1356         do_self,do_self,do_self,do_self,        /* 14-17 t y u i */
1357         do_self,do_self,do_self,do_self,        /* 18-1B o p } ^ */
1358         enter,ctrl,do_self,do_self,             /* 1C-1F enter ctrl a s */
1359         do_self,do_self,do_self,do_self,        /* 20-23 d f g h */
1360         do_self,do_self,do_self,do_self,        /* 24-27 j k l | */
1361         do_self,do_self,lshift,do_self,         /* 28-2B { para lshift , */
1362         do_self,do_self,do_self,do_self,        /* 2C-2F z x c v */
1363         do_self,do_self,do_self,do_self,        /* 30-33 b n m , */
1364         do_self,slash,rshift,star,              /* 34-37 . - rshift * */
1365         alt,do_self,caps,func,                  /* 38-3B alt sp caps f1 */
1366         func,func,func,func,                    /* 3C-3F f2 f3 f4 f5 */
1367         func,func,func,func,                    /* 40-43 f6 f7 f8 f9 */
1368         func,num,scroll,cursor,                 /* 44-47 f10 num scr home */
1369         cursor,cursor,minus,cursor,             /* 48-4B up pgup - left */
1370         cursor,cursor,plus,cursor,              /* 4C-4F n5 right + end */
1371         cursor,cursor,cursor,cursor,            /* 50-53 dn pgdn ins del */
1372         none,none,do_self,func,                 /* 54-57 sysreq ? < f11 */
1373         func,none,none,none,                    /* 58-5B f12 ? ? ? */
1374         none,none,none,none,                    /* 5C-5F ? ? ? ? */
1375         none,none,none,none,                    /* 60-63 ? ? ? ? */
1376         none,none,none,none,                    /* 64-67 ? ? ? ? */
1377         none,none,none,none,                    /* 68-6B ? ? ? ? */
1378         none,none,none,none,                    /* 6C-6F ? ? ? ? */
1379         none,none,none,none,                    /* 70-73 ? ? ? ? */
1380         none,none,none,none,                    /* 74-77 ? ? ? ? */
1381         none,none,none,none,                    /* 78-7B ? ? ? ? */
1382         none,none,none,none,                    /* 7C-7F ? ? ? ? */
1383         none,none,none,none,                    /* 80-83 ? br br br */
1384         none,none,none,none,                    /* 84-87 br br br br */
1385         none,none,none,none,                    /* 88-8B br br br br */
1386         none,none,none,none,                    /* 8C-8F br br br br */
1387         none,none,none,none,                    /* 90-93 br br br br */
1388         none,none,none,none,                    /* 94-97 br br br br */
1389         none,none,none,none,                    /* 98-9B br br br br */
1390         none,unctrl,none,none,                  /* 9C-9F br unctrl br br */
1391         none,none,none,none,                    /* A0-A3 br br br br */
1392         none,none,none,none,                    /* A4-A7 br br br br */
1393         none,none,unlshift,none,                /* A8-AB br br unlshift br */
1394         none,none,none,none,                    /* AC-AF br br br br */
1395         none,none,none,none,                    /* B0-B3 br br br br */
1396         none,none,unrshift,none,                /* B4-B7 br br unrshift br */
1397         unalt,none,uncaps,none,                 /* B8-BB unalt br uncaps br */
1398         none,none,none,none,                    /* BC-BF br br br br */
1399         none,none,none,none,                    /* C0-C3 br br br br */
1400         none,none,none,none,                    /* C4-C7 br br br br */
1401         none,none,none,none,                    /* C8-CB br br br br */
1402         none,none,none,none,                    /* CC-CF br br br br */
1403         none,none,none,none,                    /* D0-D3 br br br br */
1404         none,none,none,none,                    /* D4-D7 br br br br */
1405         none,none,none,none,                    /* D8-DB br ? ? ? */
1406         none,none,none,none,                    /* DC-DF ? ? ? ? */
1407         none,none,none,none,                    /* E0-E3 e0 e1 ? ? */
1408         none,none,none,none,                    /* E4-E7 ? ? ? ? */
1409         none,none,none,none,                    /* E8-EB ? ? ? ? */
1410         none,none,none,none,                    /* EC-EF ? ? ? ? */
1411         none,none,none,none,                    /* F0-F3 ? ? ? ? */
1412         none,none,none,none,                    /* F4-F7 ? ? ? ? */
1413         none,none,none,none,                    /* F8-FB ? ? ? ? */
1414         none,none,none,none                     /* FC-FF ? ? ? ? */
1415 };
1416 
1417 unsigned long kbd_init(unsigned long kmem_start)
     /* [previous][next][first][last][top][bottom][index][help] */
1418 {
1419         int i;
1420         struct kbd_struct * kbd;
1421 
1422         kbd = kbd_table + 0;
1423         for (i = 0 ; i < NR_CONSOLES ; i++,kbd++) {
1424                 kbd->flags = KBD_DEFFLAGS;
1425                 kbd->default_flags = KBD_DEFFLAGS;
1426                 kbd->kbd_flags = KBDFLAGS;
1427         }
1428         request_irq(KEYBOARD_IRQ,keyboard_interrupt);
1429         keyboard_interrupt(0);
1430         return kmem_start;
1431 }

/* [previous][next][first][last][top][bottom][index][help] */