1 /* Scancode conversion tables from PC keyboard scan codes to USB HID codes. */
3 * The contents of this file are based on the Microsoft "USB HID to PS/2 Scan
4 * Code Translation Table" document, of which the purpose is to provide a
5 * translation the other way around. Therefore, some codes might be missing.
7 #include <minix/input.h>
11 const struct scanmap scanmap_normal
[KBD_SCAN_CODES
] = {
12 [0x01] = { INPUT_PAGE_KEY
, INPUT_KEY_ESCAPE
},
13 [0x02] = { INPUT_PAGE_KEY
, INPUT_KEY_1
},
14 [0x03] = { INPUT_PAGE_KEY
, INPUT_KEY_2
},
15 [0x04] = { INPUT_PAGE_KEY
, INPUT_KEY_3
},
16 [0x05] = { INPUT_PAGE_KEY
, INPUT_KEY_4
},
17 [0x06] = { INPUT_PAGE_KEY
, INPUT_KEY_5
},
18 [0x07] = { INPUT_PAGE_KEY
, INPUT_KEY_6
},
19 [0x08] = { INPUT_PAGE_KEY
, INPUT_KEY_7
},
20 [0x09] = { INPUT_PAGE_KEY
, INPUT_KEY_8
},
21 [0x0A] = { INPUT_PAGE_KEY
, INPUT_KEY_9
},
22 [0x0B] = { INPUT_PAGE_KEY
, INPUT_KEY_0
},
23 [0x0C] = { INPUT_PAGE_KEY
, INPUT_KEY_DASH
},
24 [0x0D] = { INPUT_PAGE_KEY
, INPUT_KEY_EQUAL
},
25 [0x0E] = { INPUT_PAGE_KEY
, INPUT_KEY_BACKSPACE
},
26 [0x0F] = { INPUT_PAGE_KEY
, INPUT_KEY_TAB
},
27 [0x10] = { INPUT_PAGE_KEY
, INPUT_KEY_Q
},
28 [0x11] = { INPUT_PAGE_KEY
, INPUT_KEY_W
},
29 [0x12] = { INPUT_PAGE_KEY
, INPUT_KEY_E
},
30 [0x13] = { INPUT_PAGE_KEY
, INPUT_KEY_R
},
31 [0x14] = { INPUT_PAGE_KEY
, INPUT_KEY_T
},
32 [0x15] = { INPUT_PAGE_KEY
, INPUT_KEY_Y
},
33 [0x16] = { INPUT_PAGE_KEY
, INPUT_KEY_U
},
34 [0x17] = { INPUT_PAGE_KEY
, INPUT_KEY_I
},
35 [0x18] = { INPUT_PAGE_KEY
, INPUT_KEY_O
},
36 [0x19] = { INPUT_PAGE_KEY
, INPUT_KEY_P
},
37 [0x1A] = { INPUT_PAGE_KEY
, INPUT_KEY_OPEN_BRACKET
},
38 [0x1B] = { INPUT_PAGE_KEY
, INPUT_KEY_CLOSE_BRACKET
},
39 [0x1C] = { INPUT_PAGE_KEY
, INPUT_KEY_ENTER
},
40 [0x1D] = { INPUT_PAGE_KEY
, INPUT_KEY_LEFT_CTRL
},
41 [0x1E] = { INPUT_PAGE_KEY
, INPUT_KEY_A
},
42 [0x1F] = { INPUT_PAGE_KEY
, INPUT_KEY_S
},
43 [0x20] = { INPUT_PAGE_KEY
, INPUT_KEY_D
},
44 [0x21] = { INPUT_PAGE_KEY
, INPUT_KEY_F
},
45 [0x22] = { INPUT_PAGE_KEY
, INPUT_KEY_G
},
46 [0x23] = { INPUT_PAGE_KEY
, INPUT_KEY_H
},
47 [0x24] = { INPUT_PAGE_KEY
, INPUT_KEY_J
},
48 [0x25] = { INPUT_PAGE_KEY
, INPUT_KEY_K
},
49 [0x26] = { INPUT_PAGE_KEY
, INPUT_KEY_L
},
50 [0x27] = { INPUT_PAGE_KEY
, INPUT_KEY_SEMICOLON
},
51 [0x28] = { INPUT_PAGE_KEY
, INPUT_KEY_APOSTROPH
},
52 [0x29] = { INPUT_PAGE_KEY
, INPUT_KEY_GRAVE_ACCENT
},
53 [0x2A] = { INPUT_PAGE_KEY
, INPUT_KEY_LEFT_SHIFT
},
54 [0x2B] = { INPUT_PAGE_KEY
, INPUT_KEY_BACKSLASH
},
55 [0x2C] = { INPUT_PAGE_KEY
, INPUT_KEY_Z
},
56 [0x2D] = { INPUT_PAGE_KEY
, INPUT_KEY_X
},
57 [0x2E] = { INPUT_PAGE_KEY
, INPUT_KEY_C
},
58 [0x2F] = { INPUT_PAGE_KEY
, INPUT_KEY_V
},
59 [0x30] = { INPUT_PAGE_KEY
, INPUT_KEY_B
},
60 [0x31] = { INPUT_PAGE_KEY
, INPUT_KEY_N
},
61 [0x32] = { INPUT_PAGE_KEY
, INPUT_KEY_M
},
62 [0x33] = { INPUT_PAGE_KEY
, INPUT_KEY_COMMA
},
63 [0x34] = { INPUT_PAGE_KEY
, INPUT_KEY_PERIOD
},
64 [0x35] = { INPUT_PAGE_KEY
, INPUT_KEY_SLASH
},
65 [0x36] = { INPUT_PAGE_KEY
, INPUT_KEY_RIGHT_SHIFT
},
66 [0x37] = { INPUT_PAGE_KEY
, INPUT_KEY_KP_STAR
},
67 [0x38] = { INPUT_PAGE_KEY
, INPUT_KEY_LEFT_ALT
},
68 [0x39] = { INPUT_PAGE_KEY
, INPUT_KEY_SPACEBAR
},
69 [0x3A] = { INPUT_PAGE_KEY
, INPUT_KEY_CAPS_LOCK
},
70 [0x3B] = { INPUT_PAGE_KEY
, INPUT_KEY_F1
},
71 [0x3C] = { INPUT_PAGE_KEY
, INPUT_KEY_F2
},
72 [0x3D] = { INPUT_PAGE_KEY
, INPUT_KEY_F3
},
73 [0x3E] = { INPUT_PAGE_KEY
, INPUT_KEY_F4
},
74 [0x3F] = { INPUT_PAGE_KEY
, INPUT_KEY_F5
},
75 [0x40] = { INPUT_PAGE_KEY
, INPUT_KEY_F6
},
76 [0x41] = { INPUT_PAGE_KEY
, INPUT_KEY_F7
},
77 [0x42] = { INPUT_PAGE_KEY
, INPUT_KEY_F8
},
78 [0x43] = { INPUT_PAGE_KEY
, INPUT_KEY_F9
},
79 [0x44] = { INPUT_PAGE_KEY
, INPUT_KEY_F10
},
80 [0x45] = { INPUT_PAGE_KEY
, INPUT_KEY_NUM_LOCK
},
81 [0x46] = { INPUT_PAGE_KEY
, INPUT_KEY_SCROLL_LOCK
},
82 [0x47] = { INPUT_PAGE_KEY
, INPUT_KEY_KP_7
},
83 [0x48] = { INPUT_PAGE_KEY
, INPUT_KEY_KP_8
},
84 [0x49] = { INPUT_PAGE_KEY
, INPUT_KEY_KP_9
},
85 [0x4A] = { INPUT_PAGE_KEY
, INPUT_KEY_KP_DASH
},
86 [0x4B] = { INPUT_PAGE_KEY
, INPUT_KEY_KP_4
},
87 [0x4C] = { INPUT_PAGE_KEY
, INPUT_KEY_KP_5
},
88 [0x4D] = { INPUT_PAGE_KEY
, INPUT_KEY_KP_6
},
89 [0x4E] = { INPUT_PAGE_KEY
, INPUT_KEY_KP_PLUS
},
90 [0x4F] = { INPUT_PAGE_KEY
, INPUT_KEY_KP_1
},
91 [0x50] = { INPUT_PAGE_KEY
, INPUT_KEY_KP_2
},
92 [0x51] = { INPUT_PAGE_KEY
, INPUT_KEY_KP_3
},
93 [0x52] = { INPUT_PAGE_KEY
, INPUT_KEY_KP_0
},
94 [0x53] = { INPUT_PAGE_KEY
, INPUT_KEY_KP_PERIOD
},
95 [0x54] = { INPUT_PAGE_KEY
, INPUT_KEY_SYSREQ
},
96 [0x56] = { INPUT_PAGE_KEY
, INPUT_KEY_EUROPE_2
},
97 [0x57] = { INPUT_PAGE_KEY
, INPUT_KEY_F11
},
98 [0x58] = { INPUT_PAGE_KEY
, INPUT_KEY_F12
},
99 [0x59] = { INPUT_PAGE_KEY
, INPUT_KEY_KP_EQUAL
},
100 [0x5C] = { INPUT_PAGE_KEY
, INPUT_KEY_I10L_6
},
101 [0x64] = { INPUT_PAGE_KEY
, INPUT_KEY_F13
},
102 [0x65] = { INPUT_PAGE_KEY
, INPUT_KEY_F14
},
103 [0x66] = { INPUT_PAGE_KEY
, INPUT_KEY_F15
},
104 [0x67] = { INPUT_PAGE_KEY
, INPUT_KEY_F16
},
105 [0x68] = { INPUT_PAGE_KEY
, INPUT_KEY_F17
},
106 [0x69] = { INPUT_PAGE_KEY
, INPUT_KEY_F18
},
107 [0x6A] = { INPUT_PAGE_KEY
, INPUT_KEY_F19
},
108 [0x6B] = { INPUT_PAGE_KEY
, INPUT_KEY_F20
},
109 [0x6C] = { INPUT_PAGE_KEY
, INPUT_KEY_F21
},
110 [0x6D] = { INPUT_PAGE_KEY
, INPUT_KEY_F22
},
111 [0x6E] = { INPUT_PAGE_KEY
, INPUT_KEY_F23
},
112 [0x70] = { INPUT_PAGE_KEY
, INPUT_KEY_I10L_2
},
113 /* The following two keys (0x71, 0x72) are release-only. */
114 [0x71] = { INPUT_PAGE_KEY
, INPUT_KEY_LANG_2
},
115 [0x72] = { INPUT_PAGE_KEY
, INPUT_KEY_LANG_1
},
116 [0x73] = { INPUT_PAGE_KEY
, INPUT_KEY_I10L_1
},
117 /* The following key (0x76) can be either F24 or LANG_5. */
118 [0x76] = { INPUT_PAGE_KEY
, INPUT_KEY_F24
},
119 [0x77] = { INPUT_PAGE_KEY
, INPUT_KEY_LANG_4
},
120 [0x78] = { INPUT_PAGE_KEY
, INPUT_KEY_LANG_3
},
121 [0x79] = { INPUT_PAGE_KEY
, INPUT_KEY_I10L_4
},
122 [0x7B] = { INPUT_PAGE_KEY
, INPUT_KEY_I10L_5
},
123 [0x7D] = { INPUT_PAGE_KEY
, INPUT_KEY_I10L_3
},
124 [0x7E] = { INPUT_PAGE_KEY
, INPUT_KEY_EQUAL_SIGN
},
127 const struct scanmap scanmap_escaped
[KBD_SCAN_CODES
] = {
128 [0x10] = { INPUT_PAGE_CONS
, INPUT_CONS_SCAN_PREVIOUS_TRACK
},
129 [0x19] = { INPUT_PAGE_CONS
, INPUT_CONS_SCAN_NEXT_TRACK
},
130 [0x1C] = { INPUT_PAGE_KEY
, INPUT_KEY_KP_ENTER
},
131 [0x1D] = { INPUT_PAGE_KEY
, INPUT_KEY_RIGHT_CTRL
},
132 [0x20] = { INPUT_PAGE_CONS
, INPUT_CONS_MUTE
},
133 [0x21] = { INPUT_PAGE_CONS
, INPUT_CONS_AL_CALCULATOR
},
134 [0x22] = { INPUT_PAGE_CONS
, INPUT_CONS_PLAY_PAUSE
},
135 [0x24] = { INPUT_PAGE_CONS
, INPUT_CONS_STOP
},
136 [0x2E] = { INPUT_PAGE_CONS
, INPUT_CONS_VOLUME_DOWN
},
137 [0x30] = { INPUT_PAGE_CONS
, INPUT_CONS_VOLUME_UP
},
138 [0x32] = { INPUT_PAGE_CONS
, INPUT_CONS_AC_HOME
},
139 [0x35] = { INPUT_PAGE_KEY
, INPUT_KEY_KP_SLASH
},
140 [0x37] = { INPUT_PAGE_KEY
, INPUT_KEY_PRINT_SCREEN
},
141 [0x38] = { INPUT_PAGE_KEY
, INPUT_KEY_RIGHT_ALT
},
142 [0x46] = { INPUT_PAGE_KEY
, INPUT_KEY_PAUSE
},
143 [0x47] = { INPUT_PAGE_KEY
, INPUT_KEY_HOME
},
144 [0x48] = { INPUT_PAGE_KEY
, INPUT_KEY_UP_ARROW
},
145 [0x49] = { INPUT_PAGE_KEY
, INPUT_KEY_PAGE_UP
},
146 [0x4B] = { INPUT_PAGE_KEY
, INPUT_KEY_LEFT_ARROW
},
147 [0x4D] = { INPUT_PAGE_KEY
, INPUT_KEY_RIGHT_ARROW
},
148 [0x4F] = { INPUT_PAGE_KEY
, INPUT_KEY_END
},
149 [0x50] = { INPUT_PAGE_KEY
, INPUT_KEY_DOWN_ARROW
},
150 [0x51] = { INPUT_PAGE_KEY
, INPUT_KEY_PAGE_DOWN
},
151 [0x52] = { INPUT_PAGE_KEY
, INPUT_KEY_INSERT
},
152 [0x53] = { INPUT_PAGE_KEY
, INPUT_KEY_DELETE
},
153 [0x5B] = { INPUT_PAGE_KEY
, INPUT_KEY_LEFT_GUI
},
154 [0x5C] = { INPUT_PAGE_KEY
, INPUT_KEY_RIGHT_GUI
},
155 [0x5D] = { INPUT_PAGE_KEY
, INPUT_KEY_APPLICATION
},
156 /* The following extended key (0x5E) may also be INPUT_KEY_POWER. */
157 [0x5E] = { INPUT_PAGE_GD
, INPUT_GD_SYSTEM_POWER_DOWN
},
158 [0x5F] = { INPUT_PAGE_GD
, INPUT_GD_SYSTEM_SLEEP
},
159 [0x63] = { INPUT_PAGE_GD
, INPUT_GD_SYSTEM_WAKE_UP
},
160 [0x65] = { INPUT_PAGE_CONS
, INPUT_CONS_AC_SEARCH
},
161 [0x66] = { INPUT_PAGE_CONS
, INPUT_CONS_AC_BOOKMARKS
},
162 [0x67] = { INPUT_PAGE_CONS
, INPUT_CONS_AC_REFRESH
},
163 [0x68] = { INPUT_PAGE_CONS
, INPUT_CONS_AC_STOP
},
164 [0x69] = { INPUT_PAGE_CONS
, INPUT_CONS_AC_FORWARD
},
165 [0x6A] = { INPUT_PAGE_CONS
, INPUT_CONS_AC_BACK
},
166 [0x6B] = { INPUT_PAGE_CONS
, INPUT_CONS_AL_LOCAL_BROWSER
},
167 [0x6C] = { INPUT_PAGE_CONS
, INPUT_CONS_AL_EMAIL_READER
},
168 [0x6D] = { INPUT_PAGE_CONS
, INPUT_CONS_AL_MEDIA_SELECT
},