Rev 4153 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4153 | Rev 4581 | ||
|---|---|---|---|
| Line 34... | Line 34... | ||
| 34 | * @file |
34 | * @file |
| 35 | * @brief Sun keyboard controller driver. |
35 | * @brief Sun keyboard controller driver. |
| 36 | */ |
36 | */ |
| 37 | 37 | ||
| 38 | #include <kbd.h> |
38 | #include <kbd.h> |
| 39 | #include <kbd/kbd.h> |
39 | #include <io/console.h> |
| 40 | #include <kbd/keycode.h> |
40 | #include <io/keycode.h> |
| 41 | #include <kbd_ctl.h> |
41 | #include <kbd_ctl.h> |
| 42 | 42 | ||
| 43 | #define KBD_KEY_RELEASE 0x80 |
43 | #define KBD_KEY_RELEASE 0x80 |
| 44 | #define KBD_ALL_KEYS_UP 0x7f |
44 | #define KBD_ALL_KEYS_UP 0x7f |
| 45 | 45 | ||
| Line 50... | Line 50... | ||
| 50 | return 0; |
50 | return 0; |
| 51 | } |
51 | } |
| 52 | 52 | ||
| 53 | void kbd_ctl_parse_scancode(int scancode) |
53 | void kbd_ctl_parse_scancode(int scancode) |
| 54 | { |
54 | { |
| 55 | kbd_ev_type_t type; |
55 | console_ev_type_t type; |
| 56 | unsigned int key; |
56 | unsigned int key; |
| 57 | 57 | ||
| 58 | if (scancode < 0 || scancode >= 0x100) |
58 | if (scancode < 0 || scancode >= 0x100) |
| 59 | return; |
59 | return; |
| 60 | 60 | ||
| 61 | if (scancode == KBD_ALL_KEYS_UP) |
61 | if (scancode == KBD_ALL_KEYS_UP) |
| 62 | return; |
62 | return; |
| 63 | 63 | ||
| 64 | if (scancode & KBD_KEY_RELEASE) { |
64 | if (scancode & KBD_KEY_RELEASE) { |
| 65 | scancode &= ~KBD_KEY_RELEASE; |
65 | scancode &= ~KBD_KEY_RELEASE; |
| 66 | type = KE_RELEASE; |
66 | type = KEY_RELEASE; |
| 67 | } else { |
67 | } else { |
| 68 | type = KE_PRESS; |
68 | type = KEY_PRESS; |
| 69 | } |
69 | } |
| 70 | 70 | ||
| 71 | key = scanmap_simple[scancode]; |
71 | key = scanmap_simple[scancode]; |
| 72 | if (key != 0) |
72 | if (key != 0) |
| 73 | kbd_push_ev(type, key); |
73 | kbd_push_ev(type, key); |