Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
Это архивный репозиторий. Вы можете его клонировать или просматривать файлы, но не вносить изменения или открывать задачи/запросы на слияние.

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