]> git.gir.st - tmk_keyboard.git/blob - usb_keycodes.h
added SONY NEWS keyboard NWP-5461 support.
[tmk_keyboard.git] / usb_keycodes.h
1 /*
2 Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 /*
19 * Key codes: HID Keyboard/Keypad Page(0x07)
20 * http://www.usb.org/developers/devclass_docs/Hut1_12.pdf
21 */
22 #ifndef USB_KEYCODES_H
23 #define USB_KEYCODES_H
24
25
26 #define IS_ERROR(code) (KB_ROLL_OVER <= (code) && (code) <= KB_UNDEFINED)
27 #define IS_KEY(code) (KB_A <= (code) && (code) <= KB_EXSEL)
28 #define IS_MOD(code) (KB_LCTRL <= (code) && (code) <= KB_RGUI)
29 #define IS_FN(code) (KB_FN0 <= (code) && (code) <= KB_FN7)
30 #define IS_MOUSEKEY(code) (KB_MS_UP <= (code) && (code) <= KB_MS_WH_RIGHT)
31 #define IS_MOUSEKEY_MOVE(code) (KB_MS_UP <= (code) && (code) <= KB_MS_RIGHT)
32 #define IS_MOUSEKEY_BUTTON(code) (KB_MS_BTN1 <= (code) && (code) <= KB_MS_BTN5)
33 #define IS_MOUSEKEY_WHEEL(code) (KB_MS_WH_UP <= (code) && (code) <= KB_MS_WH_RIGHT)
34
35 #define MOD_BIT(code) (1<<((code) & 0x07))
36 #define FN_BIT(code) (1<<((code) - KB_FN0))
37
38
39 /* Short names */
40 #define KB_LCTL KB_LCTRL
41 #define KB_RCTL KB_RCTRL
42 #define KB_LSFT KB_LSHIFT
43 #define KB_RSFT KB_RSHIFT
44 #define KB_ESC KB_ESCAPE
45 #define KB_BSPC KB_BSPACE
46 #define KB_ENT KB_ENTER
47 #define KB_DEL KB_DELETE
48 #define KB_INS KB_INSERT
49 #define KB_CAPS KB_CAPSLOCK
50 #define KB_RGHT KB_RIGHT
51 #define KB_PGDN KB_PGDOWN
52 #define KB_PSCR KB_PSCREEN
53 #define KB_SLCK KB_SCKLOCK
54 #define KB_BRK KB_BREAK
55 #define KB_NLCK KB_NUMLOCK
56 #define KB_SPC KB_SPACE
57 #define KB_MINS KB_MINUS
58 #define KB_EQL KB_EQUAL
59 #define KB_GRV KB_GRAVE
60 #define KB_RBRC KB_RBRACKET
61 #define KB_LBRC KB_LBRACKET
62 #define KB_COMM KB_COMMA
63 #define KB_BSLS KB_BSLASH
64 #define KB_SLSH KB_SLASH
65 #define KB_SCLN KB_SCOLON
66 #define KB_QUOT KB_QUOTE
67 #define KB_APP KB_APPLICATION
68 #define KB_NUHS KB_NONUS_HASH
69 #define KB_NUBS KB_NONUS_BSLASH
70 #define KB_ERAS KB_ALT_ERASE,
71 #define KB_CLR KB_CLEAR
72 /* for Japanese */
73 #define KB_ZKHK KB_GRAVE
74 #define KB_RO KB_INT1
75 #define KB_KANA KB_INT2
76 #define KB_JYEN KB_INT3
77 #define KB_HENK KB_INT4
78 #define KB_MHEN KB_INT5
79 /* Keypad */
80 #define KB_P1 KB_KP_1
81 #define KB_P2 KB_KP_2
82 #define KB_P3 KB_KP_3
83 #define KB_P4 KB_KP_4
84 #define KB_P5 KB_KP_5
85 #define KB_P6 KB_KP_6
86 #define KB_P7 KB_KP_7
87 #define KB_P8 KB_KP_8
88 #define KB_P9 KB_KP_9
89 #define KB_P0 KB_KP_0
90 #define KB_PDOT KB_KP_DOT
91 #define KB_PCMM KB_KP_COMMA
92 #define KB_PSLS KB_KP_SLASH
93 #define KB_PAST KB_KP_ASTERISK
94 #define KB_PMNS KB_KP_MINUS
95 #define KB_PPLS KB_KP_PLUS
96 #define KB_PEQL KB_KP_EQUAL
97 #define KB_PENT KB_KP_ENTER
98 /* Mousekey */
99 #define KB_MS_U KB_MS_UP
100 #define KB_MS_D KB_MS_DOWN
101 #define KB_MS_L KB_MS_LEFT
102 #define KB_MS_R KB_MS_RIGHT
103 #define KB_BTN1 KB_MS_BTN1
104 #define KB_BTN2 KB_MS_BTN2
105 #define KB_BTN3 KB_MS_BTN3
106 #define KB_BTN4 KB_MS_BTN4
107 #define KB_BTN5 KB_MS_BTN5
108 #define KB_WH_U KB_MS_WH_UP
109 #define KB_WH_D KB_MS_WH_DOWN
110 #define KB_WH_L KB_MS_WH_LEFT
111 #define KB_WH_R KB_MS_WH_RIGHT
112 /* Sytem Control & Consumer usage */
113 #define KB_PWR KB_SYSTEM_POWER
114 #define KB_SLEP KB_SYSTEM_SLEEP
115 #define KB_WAKE KB_SYSTEM_WAKE
116 #define KB_MUTE KB_AUDIO_MUTE
117 #define KB_VOLU KB_AUDIO_VOL_UP
118 #define KB_VOLD KB_AUDIO_VOL_DOWN
119 #define KB_MNXT KB_MEDIA_NEXT_TRACK
120 #define KB_MPRV KB_MEDIA_PREV_TRACK
121 #define KB_MSTP KB_MEDIA_STOP
122 #define KB_MPLY KB_MEDIA_PLAY_PAUSE
123 #define KB_MSEL KB_MEDIA_SELECT
124 #define KB_MAIL KB_MAIL
125 #define KB_CALC KB_CALCULATOR
126 #define KB_MYCM KB_MY_COMPUTER
127 #define KB_WSCH KB_WWW_SEARCH
128 #define KB_WHOM KB_WWW_HOME
129 #define KB_WBAK KB_WWW_BACK
130 #define KB_WFWD KB_WWW_FORWARD
131 #define KB_WSTP KB_WWW_STOP
132 #define KB_WREF KB_WWW_REFRESH
133 #define KB_WFAV KB_WWW_FAVORITES
134
135
136 /* Special keycode */
137 enum special_keycodes {
138 /* System Control */
139 KB_SYSTEM_POWER = 0xB0,
140 KB_SYSTEM_SLEEP,
141 KB_SYSTEM_WAKE,
142
143 /* Consumer Page */
144 KB_AUDIO_MUTE,
145 KB_AUDIO_VOL_UP,
146 KB_AUDIO_VOL_DOWN,
147 KB_MEDIA_NEXT_TRACK,
148 KB_MEDIA_PREV_TRACK,
149 KB_MEDIA_STOP,
150 KB_MEDIA_PLAY_PAUSE,
151 KB_MEDIA_SELECT,
152 KB_MAIL,
153 KB_CALCULATOR,
154 KB_MY_COMPUTER,
155 KB_WWW_SEARCH,
156 KB_WWW_HOME,
157 KB_WWW_BACK, /* 0xC0 */
158 KB_WWW_FORWARD,
159 KB_WWW_STOP,
160 KB_WWW_REFRESH,
161 KB_WWW_FAVORITES,
162
163 /* reserve 0xE0-E7 for Modifiers */
164
165 /* Layer Switching */
166 KB_FN0 = 0xE8,
167 KB_FN1,
168 KB_FN2,
169 KB_FN3,
170 KB_FN4,
171 KB_FN5,
172 KB_FN6,
173 KB_FN7,
174
175 /* Mousekey */
176 KB_MS_UP = 0xF0,
177 KB_MS_DOWN,
178 KB_MS_LEFT,
179 KB_MS_RIGHT,
180 KB_MS_BTN1,
181 KB_MS_BTN2,
182 KB_MS_BTN3,
183 KB_MS_BTN4,
184 KB_MS_BTN5,
185 /* Mousekey wheel */
186 KB_MS_WH_UP,
187 KB_MS_WH_DOWN,
188 KB_MS_WH_LEFT,
189 KB_MS_WH_RIGHT,
190 };
191
192 enum keycodes {
193 KB_NO = 0,
194 KB_ROLL_OVER,
195 KB_POST_FAIL,
196 KB_UNDEFINED,
197 KB_A,
198 KB_B,
199 KB_C,
200 KB_D,
201 KB_E,
202 KB_F,
203 KB_G,
204 KB_H,
205 KB_I,
206 KB_J,
207 KB_K,
208 KB_L,
209 KB_M, /* 0x10 */
210 KB_N,
211 KB_O,
212 KB_P,
213 KB_Q,
214 KB_R,
215 KB_S,
216 KB_T,
217 KB_U,
218 KB_V,
219 KB_W,
220 KB_X,
221 KB_Y,
222 KB_Z,
223 KB_1,
224 KB_2,
225 KB_3, /* 0x20 */
226 KB_4,
227 KB_5,
228 KB_6,
229 KB_7,
230 KB_8,
231 KB_9,
232 KB_0,
233 KB_ENTER,
234 KB_ESCAPE,
235 KB_BSPACE,
236 KB_TAB,
237 KB_SPACE,
238 KB_MINUS,
239 KB_EQUAL,
240 KB_LBRACKET,
241 KB_RBRACKET, /* 0x30 */
242 KB_BSLASH, /* \ (and |) */
243 KB_NONUS_HASH, /* Non-US # and ~ */
244 KB_SCOLON, /* ; (and :) */
245 KB_QUOTE, /* ' and " */
246 KB_GRAVE, /* Grave accent and tilde */
247 KB_COMMA, /* , and < */
248 KB_DOT, /* . and > */
249 KB_SLASH, /* / and ? */
250 KB_CAPSLOCK,
251 KB_F1,
252 KB_F2,
253 KB_F3,
254 KB_F4,
255 KB_F5,
256 KB_F6,
257 KB_F7, /* 0x40 */
258 KB_F8,
259 KB_F9,
260 KB_F10,
261 KB_F11,
262 KB_F12,
263 KB_PSCREEN,
264 KB_SCKLOCK,
265 KB_BREAK,
266 KB_INSERT,
267 KB_HOME,
268 KB_PGUP,
269 KB_DELETE,
270 KB_END,
271 KB_PGDOWN,
272 KB_RIGHT,
273 KB_LEFT, /* 0x50 */
274 KB_DOWN,
275 KB_UP,
276 KB_NUMLOCK,
277 KB_KP_SLASH,
278 KB_KP_ASTERISK,
279 KB_KP_MINUS,
280 KB_KP_PLUS,
281 KB_KP_ENTER,
282 KB_KP_1,
283 KB_KP_2,
284 KB_KP_3,
285 KB_KP_4,
286 KB_KP_5,
287 KB_KP_6,
288 KB_KP_7,
289 KB_KP_8, /* 0x60 */
290 KB_KP_9,
291 KB_KP_0,
292 KB_KP_DOT,
293 KB_NONUS_BSLASH, /* Non-US \ and | */
294 KB_APPLICATION,
295 KB_POWER,
296 KB_KP_EQUAL,
297 KB_F13,
298 KB_F14,
299 KB_F15,
300 KB_F16,
301 KB_F17,
302 KB_F18,
303 KB_F19,
304 KB_F20,
305 KB_F21, /* 0x70 */
306 KB_F22,
307 KB_F23,
308 KB_F24,
309 KB_EXECUTE,
310 KB_HELP,
311 KB_MENU,
312 KB_SELECT,
313 KB_STOP,
314 KB_AGAIN,
315 KB_UNDO,
316 KB_CUT,
317 KB_COPY,
318 KB_PASTE,
319 KB_FIND,
320 KB__MUTE,
321 KB__VOLUP, /* 0x80 */
322 KB__VOLDOWN,
323 KB_LOCKING_CAPS, /* locking Caps Lock */
324 KB_LOCKING_NUM, /* locking Num Lock */
325 KB_LOCKING_SCROLL, /* locking Scroll Lock */
326 KB_KP_COMMA,
327 KB_KP_EQUAL_AS400, /* equal sign on AS/400 */
328 KB_INT1,
329 KB_INT2,
330 KB_INT3,
331 KB_INT4,
332 KB_INT5,
333 KB_INT6,
334 KB_INT7,
335 KB_INT8,
336 KB_INT9,
337 KB_LANG1, /* 0x90 */
338 KB_LANG2,
339 KB_LANG3,
340 KB_LANG4,
341 KB_LANG5,
342 KB_LANG6,
343 KB_LANG7,
344 KB_LANG8,
345 KB_LANG9,
346 KB_ALT_ERASE,
347 KB_SYSREQ,
348 KB_CANCEL,
349 KB_CLEAR,
350 KB_PRIOR,
351 KB_RETURN,
352 KB_SEPARATOR,
353 KB_OUT, /* 0xA0 */
354 KB_OPER,
355 KB_CLEAR_AGAIN,
356 KB_CRSEL,
357 KB_EXSEL,
358
359 /* NOTE: 0xB0-DF are used as special_keycodes */
360 #if 0
361 KB_KP_00 = 0xB0,
362 KB_KP_000,
363 KB_THOUSANDS_SEPARATOR,
364 KB_DECIMAL_SEPARATOR,
365 KB_CURRENCY_UNIT,
366 KB_CURRENCY_SUB_UNIT,
367 KB_KP_LPAREN,
368 KB_KP_RPAREN,
369 KB_KP_LCBRACKET, /* { */
370 KB_KP_RCBRACKET, /* } */
371 KB_KP_TAB,
372 KB_KP_BSPACE,
373 KB_KP_A,
374 KB_KP_B,
375 KB_KP_C,
376 KB_KP_D,
377 KB_KP_E, /* 0xC0 */
378 KB_KP_F,
379 KB_KP_XOR,
380 KB_KP_HAT,
381 KB_KP_PERC,
382 KB_KP_LT,
383 KB_KP_GT,
384 KB_KP_AND,
385 KB_KP_LAZYAND,
386 KB_KP_OR,
387 KB_KP_LAZYOR,
388 KB_KP_COLON,
389 KB_KP_HASH,
390 KB_KP_SPACE,
391 KB_KP_ATMARK,
392 KB_KP_EXCLAMATION,
393 KB_KP_MEM_STORE, /* 0xD0 */
394 KB_KP_MEM_RECALL,
395 KB_KP_MEM_CLEAR,
396 KB_KP_MEM_ADD,
397 KB_KP_MEM_SUB,
398 KB_KP_MEM_MUL,
399 KB_KP_MEM_DIV,
400 KB_KP_PLUS_MINUS,
401 KB_KP_CLEAR,
402 KB_KP_CLEAR_ENTRY,
403 KB_KP_BINARY,
404 KB_KP_OCTAL,
405 KB_KP_DECIMAL,
406 KB_KP_HEXADECIMAL,
407 #endif
408
409 /* Modifiers */
410 KB_LCTRL = 0xE0,
411 KB_LSHIFT,
412 KB_LALT,
413 KB_LGUI,
414 KB_RCTRL,
415 KB_RSHIFT,
416 KB_RALT,
417 KB_RGUI,
418
419 /* NOTE: 0xE8-FF are used as special_keycodes */
420 };
421
422 #endif /* USB_KEYCODES_H */
Imprint / Impressum