summaryrefslogtreecommitdiff
path: root/usb_keycodes.h
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2011-05-31 21:17:56 +0900
committertmk <nobody@nowhere>2011-05-31 21:25:16 +0900
commit6d45e05ede8ea1a96df9a04d58a7d7ede51afd9b (patch)
treeafad53a7fc2ca86b290af403cf7a2048d02bd526 /usb_keycodes.h
parentaf85b6bba6744573f1edecd26fb504c31094414f (diff)
Added PS/2 multimeda key support.
HID Consumer page and System control are also supported now. merged mediakey branch: d53a356cd2011b461843a5c7c1527a61692893c1
Diffstat (limited to 'usb_keycodes.h')
-rw-r--r--usb_keycodes.h211
1 files changed, 107 insertions, 104 deletions
diff --git a/usb_keycodes.h b/usb_keycodes.h
index dc6f2693b6..bdec953910 100644
--- a/usb_keycodes.h
+++ b/usb_keycodes.h
@@ -1,43 +1,13 @@
/*
* Key codes from HID Keyboard/Keypad Page
* http://www.usb.org/developers/devclass_docs/Hut1_12.pdf
- *
- * Based on Keyboard Upgrade v0.3.0 http://github.com/rhomann/kbupgrade
- */
-/*
- * Keyboard Upgrade -- Firmware for homebrew computer keyboard controllers.
- * Copyright (C) 2009 Robert Homann
- *
- * Based on RUMP (http://mg8.org/rump/), Copyright (C) 2008 Chris Lee
- *
- * Based on c64key (http://symlink.dk/projects/c64key/),
- * Copyright (C) 2006-2007 Mikkel Holm Olsen
- *
- * Based on HID-Test by Christian Starkjohann, Objective Development
- *
- * This file is part of the Keyboard Upgrade package.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with the Keyboard Upgrade package; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
*/
#ifndef USB_KEYCODES_H
#define USB_KEYCODES_H
#define IS_ERROR(code) (KB_ROLL_OVER <= (code) && (code) <= KB_UNDEFINED)
-#define IS_KEY(code) (KB_A <= (code) && (code) <= KB_KP_HEXADECIMAL)
+#define IS_KEY(code) (KB_A <= (code) && (code) <= KB_EXSEL)
#define IS_MOD(code) (KB_LCTRL <= (code) && (code) <= KB_RGUI)
#define IS_FN(code) (KB_FN0 <= (code) && (code) <= KB_FN7)
#define IS_MOUSEKEY(code) (KB_MS_UP <= (code) && (code) <= KB_MS_WH_RIGHT)
@@ -49,9 +19,7 @@
#define FN_BIT(code) (1<<((code) - KB_FN0))
-//
-// Short names
-//
+/* Short names */
#define KB_LCTL KB_LCTRL
#define KB_RCTL KB_RCTRL
#define KB_LSFT KB_LSHIFT
@@ -79,20 +47,17 @@
#define KB_SLSH KB_SLASH
#define KB_SCLN KB_SCOLON
#define KB_QUOT KB_QUOTE
-#define KB_PWR KB_POWER
-#define KB_VOLU KB_VOLUP
-#define KB_VOLD KB_VOLDOWN
#define KB_APP KB_APPLICATION
#define KB_NUHS KB_NONUS_HASH
#define KB_NUBS KB_NONUS_BSLASH
-// for Japanese
+/* for Japanese */
#define KB_RO KB_INT1
#define KB_KANA KB_INT2
#define KB_JYEN KB_INT3
#define KB_HENK KB_INT4
#define KB_MHEN KB_INT5
#define KB_ZEHA KB_GRAVE
-// Keypad
+/* Keypad */
#define KB_P1 KB_KP_1
#define KB_P2 KB_KP_2
#define KB_P3 KB_KP_3
@@ -110,7 +75,7 @@
#define KB_PPLS KB_KP_PLUS
#define KB_PEQL KB_KP_EQUAL
#define KB_PENT KB_KP_ENTER
-// Mousekey
+/* Mousekey */
#define KB_MS_U KB_MS_UP
#define KB_MS_D KB_MS_DOWN
#define KB_MS_L KB_MS_LEFT
@@ -124,7 +89,68 @@
#define KB_WH_D KB_MS_WH_DOWN
#define KB_WH_L KB_MS_WH_LEFT
#define KB_WH_R KB_MS_WH_RIGHT
+/* Sytem Control & Consumer usage */
+#define KB_PWR KB_SYSTEM_POWER
+#define KB_MUTE KB_AUDIO_MUTE
+#define KB_VOLU KB_AUDIO_VOL_UP
+#define KB_VOLD KB_AUDIO_VOL_DOWN
+
+
+/* Special keycode */
+enum special_keycodes {
+ /* System Control */
+ KB_SYSTEM_POWER = 0xB0,
+ KB_SYSTEM_SLEEP,
+ KB_SYSTEM_WAKE,
+ /* Consumer Page */
+ KB_AUDIO_MUTE,
+ KB_AUDIO_VOL_UP,
+ KB_AUDIO_VOL_DOWN,
+ KB_MEDIA_NEXT_TRACK,
+ KB_MEDIA_PREV_TRACK,
+ KB_MEDIA_STOP,
+ KB_MEDIA_PLAY_PAUSE,
+ KB_MEDIA_SELECT,
+ KB_MAIL,
+ KB_CALCULATOR,
+ KB_MY_COMPUTER,
+ KB_WWW_SEARCH,
+ KB_WWW_HOME,
+ KB_WWW_BACK, /* 0xC0 */
+ KB_WWW_FORWARD,
+ KB_WWW_STOP,
+ KB_WWW_REFRESH,
+ KB_WWW_FAVORITES,
+
+ /* reserve 0xE0-E7 for Modifiers */
+
+ /* Layer Switching */
+ KB_FN0 = 0xE8,
+ KB_FN1,
+ KB_FN2,
+ KB_FN3,
+ KB_FN4,
+ KB_FN5,
+ KB_FN6,
+ KB_FN7,
+
+ /* Mousekey */
+ KB_MS_UP = 0xF0,
+ KB_MS_DOWN,
+ KB_MS_LEFT,
+ KB_MS_RIGHT,
+ KB_MS_BTN1,
+ KB_MS_BTN2,
+ KB_MS_BTN3,
+ KB_MS_BTN4,
+ KB_MS_BTN5,
+ /* Mousekey wheel */
+ KB_MS_WH_UP,
+ KB_MS_WH_DOWN,
+ KB_MS_WH_LEFT,
+ KB_MS_WH_RIGHT,
+};
enum keycodes {
KB_NO = 0,
@@ -143,7 +169,7 @@ enum keycodes {
KB_J,
KB_K,
KB_L,
- KB_M, /* 0x10 */
+ KB_M, /* 0x10 */
KB_N,
KB_O,
KB_P,
@@ -159,7 +185,7 @@ enum keycodes {
KB_Z,
KB_1,
KB_2,
- KB_3, /* 0x20 */
+ KB_3, /* 0x20 */
KB_4,
KB_5,
KB_6,
@@ -174,16 +200,16 @@ enum keycodes {
KB_SPACE,
KB_MINUS,
KB_EQUAL,
- KB_LBRACKET, /* [ */
- KB_RBRACKET, /* ] */
- KB_BSLASH, /* \ (and |) */
- KB_NONUS_HASH, /* Non-US # and ~ */
- KB_SCOLON, /* ; (and :) */
- KB_QUOTE, /* ' and " */
- KB_GRAVE, /* Grave accent and tilde */
- KB_COMMA, /* , and < */
- KB_DOT, /* . and > */
- KB_SLASH, /* / and ? */
+ KB_LBRACKET,
+ KB_RBRACKET, /* 0x30 */
+ KB_BSLASH, /* \ (and |) */
+ KB_NONUS_HASH, /* Non-US # and ~ */
+ KB_SCOLON, /* ; (and :) */
+ KB_QUOTE, /* ' and " */
+ KB_GRAVE, /* Grave accent and tilde */
+ KB_COMMA, /* , and < */
+ KB_DOT, /* . and > */
+ KB_SLASH, /* / and ? */
KB_CAPSLOCK,
KB_F1,
KB_F2,
@@ -191,7 +217,7 @@ enum keycodes {
KB_F4,
KB_F5,
KB_F6,
- KB_F7, /* 0x40 */
+ KB_F7, /* 0x40 */
KB_F8,
KB_F9,
KB_F10,
@@ -207,7 +233,7 @@ enum keycodes {
KB_END,
KB_PGDOWN,
KB_RIGHT,
- KB_LEFT, /* 0x50 */
+ KB_LEFT, /* 0x50 */
KB_DOWN,
KB_UP,
KB_NUMLOCK,
@@ -223,11 +249,11 @@ enum keycodes {
KB_KP_5,
KB_KP_6,
KB_KP_7,
- KB_KP_8, /* 0x60 */
+ KB_KP_8, /* 0x60 */
KB_KP_9,
KB_KP_0,
KB_KP_DOT,
- KB_NONUS_BSLASH, /* Non-US \ and | */
+ KB_NONUS_BSLASH, /* Non-US \ and | */
KB_APPLICATION,
KB_POWER,
KB_KP_EQUAL,
@@ -239,7 +265,7 @@ enum keycodes {
KB_F18,
KB_F19,
KB_F20,
- KB_F21, /* 0x70 */
+ KB_F21, /* 0x70 */
KB_F22,
KB_F23,
KB_F24,
@@ -254,14 +280,14 @@ enum keycodes {
KB_COPY,
KB_PASTE,
KB_FIND,
- KB_MUTE,
- KB_VOLUP, /* 0x80 */
- KB_VOLDOWN,
- KB_LOCKING_CAPS, /* locking Caps Lock */
- KB_LOCKING_NUM, /* locking Num Lock */
- KB_LOCKING_SCROLL, /* locking Scroll Lock */
+ KB__MUTE,
+ KB__VOLUP, /* 0x80 */
+ KB__VOLDOWN,
+ KB_LOCKING_CAPS, /* locking Caps Lock */
+ KB_LOCKING_NUM, /* locking Num Lock */
+ KB_LOCKING_SCROLL, /* locking Scroll Lock */
KB_KP_COMMA,
- KB_KP_EQUAL_AS400, /* equal sign on AS/400 */
+ KB_KP_EQUAL_AS400, /* equal sign on AS/400 */
KB_INT1,
KB_INT2,
KB_INT3,
@@ -271,7 +297,7 @@ enum keycodes {
KB_INT7,
KB_INT8,
KB_INT9,
- KB_LANG1, /* 0x90 */
+ KB_LANG1, /* 0x90 */
KB_LANG2,
KB_LANG3,
KB_LANG4,
@@ -287,12 +313,13 @@ enum keycodes {
KB_PRIOR,
KB_RETURN,
KB_SEPARATOR,
- KB_OUT,
+ KB_OUT, /* 0xA0 */
KB_OPER,
KB_CLEAR_AGAIN,
KB_CRSEL,
KB_EXSEL,
+ /* NOTE: uses 0xB0-DF for special keycodes */
KB_KP_00 = 0xB0,
KB_KP_000,
KB_THOUSANDS_SEPARATOR,
@@ -301,15 +328,15 @@ enum keycodes {
KB_CURRENCY_SUB_UNIT,
KB_KP_LPAREN,
KB_KP_RPAREN,
- KB_KP_LCBRACKET, /* { */
- KB_KP_RCBRACKET, /* } */
+ KB_KP_LCBRACKET, /* { */
+ KB_KP_RCBRACKET, /* } */
KB_KP_TAB,
KB_KP_BSPACE,
KB_KP_A,
KB_KP_B,
KB_KP_C,
KB_KP_D,
- KB_KP_E,
+ KB_KP_E, /* 0xC0 */
KB_KP_F,
KB_KP_XOR,
KB_KP_HAT,
@@ -325,7 +352,7 @@ enum keycodes {
KB_KP_SPACE,
KB_KP_ATMARK,
KB_KP_EXCLAMATION,
- KB_KP_MEM_STORE,
+ KB_KP_MEM_STORE, /* 0xD0 */
KB_KP_MEM_RECALL,
KB_KP_MEM_CLEAR,
KB_KP_MEM_ADD,
@@ -340,41 +367,17 @@ enum keycodes {
KB_KP_DECIMAL,
KB_KP_HEXADECIMAL,
- /* modifiers */
- KB_LCTRL = 0xE0, /* 0x01 */
- KB_LSHIFT, /* 0x02 */
- KB_LALT, /* 0x04 */
- KB_LGUI, /* 0x08 */
- KB_RCTRL, /* 0x10 */
- KB_RSHIFT, /* 0x20 */
- KB_RALT, /* 0x40 */
- KB_RGUI, /* 0x80 */
+ /* Modifiers */
+ KB_LCTRL = 0xE0,
+ KB_LSHIFT,
+ KB_LALT,
+ KB_LGUI,
+ KB_RCTRL,
+ KB_RSHIFT,
+ KB_RALT,
+ KB_RGUI,
- /* extensions for internal use */
- KB_FN0 = 0xE8,
- KB_FN1,
- KB_FN2,
- KB_FN3,
- KB_FN4,
- KB_FN5,
- KB_FN6,
- KB_FN7,
- // Mousekey move
- KB_MS_UP = 0xF0,
- KB_MS_DOWN,
- KB_MS_LEFT,
- KB_MS_RIGHT,
- // Mousekey buttons
- KB_MS_BTN1 = 0xF4,
- KB_MS_BTN2,
- KB_MS_BTN3,
- KB_MS_BTN4,
- KB_MS_BTN5,
- // Mousekey wheel
- KB_MS_WH_UP,
- KB_MS_WH_DOWN,
- KB_MS_WH_LEFT,
- KB_MS_WH_RIGHT,
+ /* NOTE: uses 0xE8-FF for special keycodes */
};
#endif /* USB_KEYCODES_H */