root/kernel/chr_drv/keyboard.c

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

DEFINITIONS

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

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