hp_keyb.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:15k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * linux/drivers/char/hp_keyb.c
  3.  * helper-functions for the keyboard/psaux driver for HP-PARISC workstations
  4.  *
  5.  * based on pc_keyb.c by Geert Uytterhoeven & Martin Mares
  6.  *
  7.  * 2000/10/26 Debacker Xavier <debackex@esiee.fr>
  8.  * Marteau Thomas <marteaut@esiee.fr>
  9.  * Djoudi Malek <djoudim@esiee.fr>
  10.  * - fixed some keysym defines 
  11.  *
  12.  * 2001/04/28 Debacker Xavier <debackex@esiee.fr>
  13.  * - scancode translation rewritten in handle_at_scancode()
  14.  */  
  15. #include <linux/config.h>
  16. #include <linux/sched.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/tty.h>
  19. #include <linux/tty_flip.h>
  20. #include <linux/mm.h>
  21. #include <linux/slab.h>
  22. #include <linux/ptrace.h>
  23. #include <linux/signal.h>
  24. #include <linux/timer.h>
  25. #include <linux/random.h>
  26. #include <linux/ctype.h>
  27. #include <linux/kbd_ll.h>
  28. #include <linux/init.h>
  29. #include <asm/bitops.h>
  30. #include <asm/irq.h>
  31. #include <asm/hardware.h>
  32. #include <asm/io.h>
  33. #include <asm/system.h>
  34. #define KBD_REPORT_ERR
  35. #define KBD_REPORT_UNKN
  36. #define KBD_ESCAPEE0 0xe0 /* in */
  37. #define KBD_ESCAPEE1 0xe1 /* in */
  38. #define ESCE0(x) (0xe000|(x))
  39. #define ESCE1(x) (0xe100|(x))
  40. #define KBD_BAT 0xaa /* in */
  41. #define KBD_SETLEDS 0xed /* out */
  42. #define KBD_ECHO 0xee /* in/out */
  43. #define KBD_BREAK 0xf0 /* in */
  44. #define KBD_TYPRATEDLY 0xf3 /* out */
  45. #define KBD_SCANENABLE 0xf4 /* out */
  46. #define KBD_DEFDISABLE 0xf5 /* out */
  47. #define KBD_DEFAULT 0xf6 /* out */
  48. #define KBD_ACK 0xfa /* in */
  49. #define KBD_DIAGFAIL 0xfd /* in */
  50. #define KBD_RESEND 0xfe /* in/out */
  51. #define KBD_RESET 0xff /* out */
  52. #define CODE_BREAK 1
  53. #define CODE_ESCAPEE0 2
  54. #define CODE_ESCAPEE1 4
  55. #define CODE_ESCAPE12 8
  56. #define K_NONE 0x7f
  57. #define K_ESC 0x01
  58. #define K_F1 0x3b
  59. #define K_F2 0x3c
  60. #define K_F3 0x3d
  61. #define K_F4 0x3e
  62. #define K_F5 0x3f
  63. #define K_F6 0x40
  64. #define K_F7 0x41
  65. #define K_F8 0x42
  66. #define K_F9 0x43
  67. #define K_F10 0x44
  68. #define K_F11 0x57
  69. #define K_F12 0x58
  70. #define K_PRNT 0x54
  71. #define K_SCRL 0x46
  72. #define K_BRK 0x77
  73. #define K_AGR 0x29
  74. #define K_1 0x02
  75. #define K_2 0x03
  76. #define K_3 0x04
  77. #define K_4 0x05
  78. #define K_5 0x06
  79. #define K_6 0x07
  80. #define K_7 0x08
  81. #define K_8 0x09
  82. #define K_9 0x0a
  83. #define K_0 0x0b
  84. #define K_MINS 0x0c
  85. #define K_EQLS 0x0d
  86. #define K_BKSP 0x0e
  87. #define K_INS 0x6e
  88. #define K_HOME 0x66
  89. #define K_PGUP 0x68
  90. #define K_NUML 0x45
  91. #define KP_SLH 0x62
  92. #define KP_STR 0x37
  93. #define KP_MNS 0x4a
  94. #define K_TAB 0x0f
  95. #define K_Q 0x10
  96. #define K_W 0x11
  97. #define K_E 0x12
  98. #define K_R 0x13
  99. #define K_T 0x14
  100. #define K_Y 0x15
  101. #define K_U 0x16
  102. #define K_I 0x17
  103. #define K_O 0x18
  104. #define K_P 0x19
  105. #define K_LSBK 0x1a
  106. #define K_RSBK 0x1b
  107. #define K_ENTR 0x1c
  108. #define K_DEL 111
  109. #define K_END 0x6b
  110. #define K_PGDN 0x6d
  111. #define KP_7 0x47
  112. #define KP_8 0x48
  113. #define KP_9 0x49
  114. #define KP_PLS 0x4e
  115. #define K_CAPS 0x3a
  116. #define K_A 0x1e
  117. #define K_S 0x1f
  118. #define K_D 0x20
  119. #define K_F 0x21
  120. #define K_G 0x22
  121. #define K_H 0x23
  122. #define K_J 0x24
  123. #define K_K 0x25
  124. #define K_L 0x26
  125. #define K_SEMI 0x27
  126. #define K_SQOT 0x28
  127. #define K_HASH K_NONE
  128. #define KP_4 0x4b
  129. #define KP_5 0x4c
  130. #define KP_6 0x4d
  131. #define K_LSFT 0x2a
  132. #define K_BSLH 0x2b
  133. #define K_Z 0x2c
  134. #define K_X 0x2d
  135. #define K_C 0x2e
  136. #define K_V 0x2f
  137. #define K_B 0x30
  138. #define K_N 0x31
  139. #define K_M 0x32
  140. #define K_COMA 0x33
  141. #define K_DOT 0x34
  142. #define K_FSLH 0x35
  143. #define K_RSFT 0x36
  144. #define K_UP 0x67
  145. #define KP_1 0x4f
  146. #define KP_2 0x50
  147. #define KP_3 0x51
  148. #define KP_ENT 0x60
  149. #define K_LCTL 0x1d
  150. #define K_LALT 0x38
  151. #define K_SPCE 0x39
  152. #define K_RALT 0x64
  153. #define K_RCTL 0x61
  154. #define K_LEFT 0x69
  155. #define K_DOWN 0x6c
  156. #define K_RGHT 0x6a
  157. #define KP_0 0x52
  158. #define KP_DOT 0x53
  159. static unsigned char keycode_translate[256] =
  160. {
  161. /* 00 */  K_NONE, K_F9  , K_NONE, K_F5  , K_F3  , K_F1  , K_F2  , K_F12 ,
  162. /* 08 */  K_NONE, K_F10 , K_F8  , K_F6  , K_F4  , K_TAB , K_AGR , K_NONE,
  163. /* 10 */  K_NONE, K_LALT, K_LSFT, K_NONE, K_LCTL, K_Q   , K_1   , K_NONE,
  164. /* 18 */  K_NONE, K_NONE, K_Z   , K_S   , K_A   , K_W   , K_2   , K_NONE,
  165. /* 20 */  K_NONE, K_C   , K_X   , K_D   , K_E   , K_4   , K_3   , K_NONE,
  166. /* 28 */  K_NONE, K_SPCE, K_V   , K_F   , K_T   , K_R   , K_5   , K_NONE,
  167. /* 30 */  K_NONE, K_N   , K_B   , K_H   , K_G   , K_Y   , K_6   , K_NONE,
  168. /* 38 */  K_NONE, K_NONE, K_M   , K_J   , K_U   , K_7   , K_8   , K_NONE,
  169. /* 40 */  K_NONE, K_COMA, K_K   , K_I   , K_O   , K_0   , K_9   , K_NONE,
  170. /* 48 */  K_PGUP, K_DOT , K_FSLH, K_L   , K_SEMI, K_P   , K_MINS, K_NONE,
  171. /* 50 */  K_NONE, K_NONE, K_SQOT, K_NONE, K_LSBK, K_EQLS, K_NONE, K_NONE,
  172. /* 58 */  K_CAPS, K_RSFT, K_ENTR, K_RSBK, K_NONE, K_BSLH, K_NONE, K_NONE,
  173. /* 60 */  K_NONE, K_HASH, K_NONE, K_NONE, K_NONE, K_NONE, K_BKSP, K_NONE,
  174. /* 68 */  K_NONE, KP_1  , K_NONE, KP_4  , KP_7  , K_NONE, K_NONE, K_NONE,
  175. /* 70 */  KP_0  , KP_DOT, KP_2  , KP_5  , KP_6  , KP_8  , K_ESC , K_NUML,
  176. /* 78 */  K_F11 , KP_PLS, KP_3  , KP_MNS, KP_STR, KP_9  , K_SCRL, K_PRNT,
  177. /* 80 */  K_NONE, K_NONE, K_NONE, K_F7  , K_NONE, K_NONE, K_NONE, K_NONE,
  178. /* 88 */  K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE,
  179. /* 90 */  K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE,
  180. /* 98 */  K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE,
  181. /* a0 */  K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE,
  182. /* a8 */  K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE,
  183. /* b0 */  K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE,
  184. /* b8 */  K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE,
  185. /* c0 */  K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE,
  186. /* c8 */  K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE,
  187. /* d0 */  K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE,
  188. /* d8 */  K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE,
  189. /* e0 */  K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE,
  190. /* e8 */  K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE,
  191. /* f0 */  K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE,
  192. /* f8 */  K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, K_NONE, KBD_RESEND, K_NONE
  193. };
  194. /* ----- the following code stolen from pc_keyb.c */
  195. #ifdef CONFIG_MAGIC_SYSRQ
  196. unsigned char hp_ps2kbd_sysrq_xlate[128] =
  197. "00331234567890-=177t" /* 0x00 - 0x0f */
  198. "qwertyuiop[]r00as" /* 0x10 - 0x1f */
  199. "dfghjkl;'`00\zxcv" /* 0x20 - 0x2f */
  200. "bnm,./00*00 00201202203204205" /* 0x30 - 0x3f */
  201. "2062072102112120000789-456+1" /* 0x40 - 0x4f */
  202. "230177000021321400000000000000000000" /* 0x50 - 0x5f */
  203. "r00/"; /* 0x60 - 0x6f */
  204. #endif
  205. /*
  206.  * Translation of escaped scancodes to keycodes.
  207.  * This is now user-settable.
  208.  * The keycodes 1-88,96-111,119 are fairly standard, and
  209.  * should probably not be changed - changing might confuse X.
  210.  * X also interprets scancode 0x5d (KEY_Begin).
  211.  *
  212.  * For 1-88 keycode equals scancode.
  213.  */
  214. #define E0_KPENTER 96
  215. #define E0_RCTRL   97
  216. #define E0_KPSLASH 98
  217. #define E0_PRSCR   99
  218. #define E0_RALT    100
  219. #define E0_BREAK   101 /* (control-pause) */
  220. #define E0_HOME    102
  221. #define E0_UP      103
  222. #define E0_PGUP    104
  223. #define E0_LEFT    105
  224. #define E0_RIGHT   106
  225. #define E0_END     107
  226. #define E0_DOWN    108
  227. #define E0_PGDN    109
  228. #define E0_INS     110
  229. #define E0_DEL     111
  230. #define E1_PAUSE   119
  231. /*
  232.  * The keycodes below are randomly located in 89-95,112-118,120-127.
  233.  * They could be thrown away (and all occurrences below replaced by 0),
  234.  * but that would force many users to use the `setkeycodes' utility, where
  235.  * they needed not before. It does not matter that there are duplicates, as
  236.  * long as no duplication occurs for any single keyboard.
  237.  */
  238. #define SC_LIM 89 /* 0x59 == 89 */
  239. #define FOCUS_PF1 85 /* actual code! */
  240. #define FOCUS_PF2 89
  241. #define FOCUS_PF3 90
  242. #define FOCUS_PF4 91
  243. #define FOCUS_PF5 92
  244. #define FOCUS_PF6 93
  245. #define FOCUS_PF7 94
  246. #define FOCUS_PF8 95
  247. #define FOCUS_PF9 120
  248. #define FOCUS_PF10 121
  249. #define FOCUS_PF11 122
  250. #define FOCUS_PF12 123
  251. #define JAP_86     124
  252. /* On one Compaq UK keyboard, at least, bar/backslash generates scancode
  253.  * 0x7f.  0x7f generated on some .de and .no keyboards also.
  254.  */
  255. #define UK_86    86
  256. /* tfj@olivia.ping.dk:
  257.  * The four keys are located over the numeric keypad, and are
  258.  * labelled A1-A4. It's an rc930 keyboard, from
  259.  * Regnecentralen/RC International, Now ICL.
  260.  * Scancodes: 59, 5a, 5b, 5c.
  261.  */
  262. #define RGN1 124
  263. #define RGN2 125
  264. #define RGN3 126
  265. #define RGN4 127
  266. static unsigned char high_keys[128 - SC_LIM] = {
  267.   RGN1, RGN2, RGN3, RGN4, 0, 0, 0,                   /* 0x59-0x5f */
  268.   0, 0, 0, 0, 0, 0, 0, 0,                            /* 0x60-0x67 */
  269.   0, 0, 0, 0, 0, FOCUS_PF11, 0, FOCUS_PF12,          /* 0x68-0x6f */
  270.   0, 0, 0, FOCUS_PF2, FOCUS_PF9, 0, 0, FOCUS_PF3,    /* 0x70-0x77 */
  271.   FOCUS_PF4, FOCUS_PF5, FOCUS_PF6, FOCUS_PF7,        /* 0x78-0x7b */
  272.   FOCUS_PF8, JAP_86, FOCUS_PF10, UK_86               /* 0x7c-0x7f */
  273. };
  274. /* BTC */
  275. #define E0_MACRO   112
  276. /* LK450 */
  277. #define E0_F13     113
  278. #define E0_F14     114
  279. #define E0_HELP    115
  280. #define E0_DO      116
  281. #define E0_F17     117
  282. #define E0_KPMINPLUS 118
  283. /*
  284.  * My OmniKey generates e0 4c for  the "OMNI" key and the
  285.  * right alt key does nada. [kkoller@nyx10.cs.du.edu]
  286.  */
  287. #define E0_OK 124
  288. /*
  289.  * New microsoft keyboard is rumoured to have
  290.  * e0 5b (left window button), e0 5c (right window button),
  291.  * e0 5d (menu button). [or: LBANNER, RBANNER, RMENU]
  292.  * [or: Windows_L, Windows_R, TaskMan]
  293.  */
  294. #define E0_MSLW 125
  295. #define E0_MSRW 126
  296. #define E0_MSTM 127
  297. static unsigned char e0_keys[128] = {
  298.   0, 0, 0, 0, 0, 0, 0, 0,       /* 0x00-0x07 */
  299.   0, 0, 0, 0, 0, 0, 0, 0,       /* 0x08-0x0f */
  300.   0, 0, 0, 0, 0, 0, 0, 0,       /* 0x10-0x17 */
  301.   0, 0, 0, 0, E0_KPENTER, E0_RCTRL, 0, 0,       /* 0x18-0x1f */
  302.   0, 0, 0, 0, 0, 0, 0, 0,       /* 0x20-0x27 */
  303.   0, 0, 0, 0, 0, 0, 0, 0,       /* 0x28-0x2f */
  304.   0, 0, 0, 0, 0, E0_KPSLASH, 0, E0_PRSCR,       /* 0x30-0x37 */
  305.   E0_RALT, 0, 0, 0, 0, E0_F13, E0_F14, E0_HELP,       /* 0x38-0x3f */
  306.   E0_DO, E0_F17, 0, 0, 0, 0, E0_BREAK, E0_HOME,       /* 0x40-0x47 */
  307.   E0_UP, E0_PGUP, 0, E0_LEFT, E0_OK, E0_RIGHT, E0_KPMINPLUS, E0_END,/* 0x48-0x4f */
  308.   E0_DOWN, E0_PGDN, E0_INS, E0_DEL, 0, 0, 0, 0,       /* 0x50-0x57 */
  309.   0, 0, 0, E0_MSLW, E0_MSRW, E0_MSTM, 0, 0,       /* 0x58-0x5f */
  310.   0, 0, 0, 0, 0, 0, 0, 0,       /* 0x60-0x67 */
  311.   0, 0, 0, 0, 0, 0, 0, E0_MACRO,       /* 0x68-0x6f */
  312.   0, 0, 0, 0, 0, 0, 0, 0,       /* 0x70-0x77 */
  313.   0, 0, 0, 0, 0, 0, 0, E0_MSLW       /* 0x78-0x7f */
  314. };
  315. int pckbd_setkeycode(unsigned int scancode, unsigned int keycode)
  316. {
  317. if (scancode < SC_LIM || scancode > 255 || keycode > 127)
  318.   return -EINVAL;
  319. if (scancode < 128)
  320.   high_keys[scancode - SC_LIM] = keycode;
  321. else
  322.   e0_keys[scancode - 128] = keycode;
  323. return 0;
  324. }
  325. int pckbd_getkeycode(unsigned int scancode)
  326. {
  327. return
  328.   (scancode < SC_LIM || scancode > 255) ? -EINVAL :
  329.   (scancode < 128) ? high_keys[scancode - SC_LIM] :
  330.     e0_keys[scancode - 128];
  331. }
  332. int pckbd_translate(unsigned char scancode, unsigned char *keycode,
  333.     char raw_mode)
  334. {
  335. static int prev_scancode;
  336. /* special prefix scancodes.. */
  337. if (scancode == 0xe0 || scancode == 0xe1) {
  338. prev_scancode = scancode;
  339. return 0;
  340. }
  341. /* 0xFF is sent by a few keyboards, ignore it. 0x00 is error */
  342. if (scancode == 0x00 || scancode == 0xff) {
  343. prev_scancode = 0;
  344. return 0;
  345. }
  346. scancode &= 0x7f;
  347. if (prev_scancode) {
  348.   /*
  349.    * usually it will be 0xe0, but a Pause key generates
  350.    * e1 1d 45 e1 9d c5 when pressed, and nothing when released
  351.    */
  352.   if (prev_scancode != 0xe0) {
  353.       if (prev_scancode == 0xe1 && scancode == 0x1d) {
  354.   prev_scancode = 0x100;
  355.   return 0;
  356.       } else if (prev_scancode == 0x100 && scancode == 0x45) {
  357.   *keycode = E1_PAUSE;
  358.   prev_scancode = 0;
  359.       } else {
  360. #ifdef KBD_REPORT_UNKN
  361.   if (!raw_mode)
  362.     printk(KERN_INFO "keyboard: unknown e1 escape sequencen");
  363. #endif
  364.   prev_scancode = 0;
  365.   return 0;
  366.       }
  367.   } else {
  368.       prev_scancode = 0;
  369.       /*
  370.        *  The keyboard maintains its own internal caps lock and
  371.        *  num lock statuses. In caps lock mode E0 AA precedes make
  372.        *  code and E0 2A follows break code. In num lock mode,
  373.        *  E0 2A precedes make code and E0 AA follows break code.
  374.        *  We do our own book-keeping, so we will just ignore these.
  375.        */
  376.       /*
  377.        *  For my keyboard there is no caps lock mode, but there are
  378.        *  both Shift-L and Shift-R modes. The former mode generates
  379.        *  E0 2A / E0 AA pairs, the latter E0 B6 / E0 36 pairs.
  380.        *  So, we should also ignore the latter. - aeb@cwi.nl
  381.        */
  382.       if (scancode == 0x2a || scancode == 0x36)
  383. return 0;
  384.       if (e0_keys[scancode])
  385. *keycode = e0_keys[scancode];
  386.       else {
  387. #ifdef KBD_REPORT_UNKN
  388.   if (!raw_mode)
  389.     printk(KERN_INFO "keyboard: unknown scancode e0 %02xn",
  390.    scancode);
  391. #endif
  392.   return 0;
  393.       }
  394.   }
  395. } else if (scancode >= SC_LIM) {
  396.     /* This happens with the FOCUS 9000 keyboard
  397.        Its keys PF1..PF12 are reported to generate
  398.        55 73 77 78 79 7a 7b 7c 74 7e 6d 6f
  399.        Moreover, unless repeated, they do not generate
  400.        key-down events, so we have to zero up_flag below */
  401.     /* Also, Japanese 86/106 keyboards are reported to
  402.        generate 0x73 and 0x7d for  - and  | respectively. */
  403.     /* Also, some Brazilian keyboard is reported to produce
  404.        0x73 and 0x7e for  ? and KP-dot, respectively. */
  405.   *keycode = high_keys[scancode - SC_LIM];
  406.   if (!*keycode) {
  407.       if (!raw_mode) {
  408. #ifdef KBD_REPORT_UNKN
  409.   printk(KERN_INFO "keyboard: unrecognized scancode (%02x)"
  410.  " - ignoredn", scancode);
  411. #endif
  412.       }
  413.       return 0;
  414.   }
  415.   } else
  416.   *keycode = scancode;
  417.   return 1;
  418. }
  419. /* ----- end of stolen part ------ */
  420. void kbd_reset_setup(void) 
  421. }
  422. void handle_at_scancode(int keyval)
  423. {
  424. static int brk;
  425. static int esc0;
  426. static int esc1;
  427. int scancode = 0;
  428. switch (keyval) {
  429. case KBD_BREAK :  
  430. /* sets the "release_key" bit when a key is 
  431.    released. HP keyboard send f0 followed by 
  432.    the keycode while AT keyboard send the keycode
  433.    with this bit set. */
  434. brk = 0x80;
  435. return;
  436. case KBD_ESCAPEE0 :
  437. /* 2chars sequence, commonly used to differenciate 
  438.    the two ALT keys and the two ENTER keys and so 
  439.    on... */
  440. esc0 = 2; /* e0-xx are 2 chars */
  441. scancode = keyval;
  442. break;
  443. case KBD_ESCAPEE1 :  
  444. /* 3chars sequence, only used by the Pause key. */
  445. esc1 = 3; /* e1-xx-xx are 3 chars */
  446. scancode = keyval;
  447. break;
  448. #if 0
  449. case KBD_RESEND :
  450. /* dunno what to do when it happens. RFC */
  451. printk(KERN_INFO "keyboard: KBD_RESEND received.n");
  452. return;
  453. #endif
  454. case 0x14 : 
  455. /* translate e1-14-77-e1-f0-14-f0-77 to 
  456.    e1-1d-45-e1-9d-c5 (the Pause key) */
  457. if (esc1==2) scancode = brk | 0x1d;
  458. break;
  459. case 0x77 :
  460. if (esc1==1) scancode = brk | 0x45;
  461. break;
  462. case 0x12 :
  463. /* an extended key is e0-12-e0-xx e0-f0-xx-e0-f0-12
  464.    on HP, while it is e0-2a-e0-xx e0-(xx|80)-f0-aa 
  465.    on AT. */
  466. if (esc0==1) scancode = brk | 0x2a;
  467. break;
  468. }
  469. /* translates HP scancodes to AT scancodes */
  470. if (!scancode) scancode = brk | keycode_translate[keyval];
  471. if (!scancode) printk(KERN_INFO "keyboard: unexpected key code %02xn",keyval);
  472. /* now behave like an AT keyboard */
  473. handle_scancode(scancode,!(scancode&0x80));
  474. if (esc0) esc0--;
  475. if (esc1) esc1--;
  476. /* release key bit must be unset for the next key */
  477. brk = 0;
  478. }