summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2009-07-18 12:58:29 +0000
committerFrank Gevaerts <frank@gevaerts.be>2009-07-18 12:58:29 +0000
commite409fba7f85e9ddf51e2d6a3342dbca6f667e280 (patch)
tree63d0e5689658f3a439459611a31462b1cba9fa55
parent06bb5ea004dacfa81e3c8e192ad2c1f95d2ad18e (diff)
downloadrockbox-e409fba7f85e9ddf51e2d6a3342dbca6f667e280.tar.gz
rockbox-e409fba7f85e9ddf51e2d6a3342dbca6f667e280.zip
Flyspray: FS#10326
Author: Tomer Shalev Adds a USB HID sample application, a plugin tha allows to send HID commands while connected in non-storage mode. This also removes the HID stuff in the debug menu. Testing is now easily doable from the plugin Also general HID updates git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21953 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/debug_menu.c60
-rw-r--r--apps/plugin.c8
-rw-r--r--apps/plugin.h10
-rw-r--r--apps/plugins/CATEGORIES1
-rw-r--r--apps/plugins/SOURCES3
-rw-r--r--apps/plugins/remote_control.c231
-rw-r--r--apps/screens.c20
-rw-r--r--firmware/usbstack/usb_hid.c424
-rw-r--r--firmware/usbstack/usb_hid.h3
-rw-r--r--firmware/usbstack/usb_hid_usage_tables.h1045
10 files changed, 1288 insertions, 517 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 648a7e6cae..6a40d4b54a 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -112,13 +112,6 @@
112#include "as3514.h" 112#include "as3514.h"
113#endif 113#endif
114 114
115#ifdef HAVE_USBSTACK
116#include "usb_core.h"
117#ifdef USB_ENABLE_HID
118#include "usbstack/usb_hid.h"
119#endif
120#endif
121
122/*---------------------------------------------------*/ 115/*---------------------------------------------------*/
123/* SPECIAL DEBUG STUFF */ 116/* SPECIAL DEBUG STUFF */
124/*---------------------------------------------------*/ 117/*---------------------------------------------------*/
@@ -2635,50 +2628,6 @@ static bool toggle_usb_serial(void)
2635} 2628}
2636#endif 2629#endif
2637 2630
2638#ifdef USB_ENABLE_HID
2639static bool hid_send_cmd(consumer_usage_page_t cmd, char *msg)
2640{
2641 (void)msg;
2642
2643 if (!usb_core_driver_enabled(USB_DRIVER_HID)) {
2644 splashf(HZ, "Send failed. Driver is disabled");
2645 return false;
2646 }
2647
2648 usb_hid_send_consumer_usage(cmd);
2649 logf("Sent %s command", msg);
2650
2651 return false;
2652}
2653static bool usb_hid_send_play_pause(void)
2654{
2655 return hid_send_cmd(PLAY_PAUSE, "Play/Pause");
2656}
2657static bool usb_hid_send_stop(void)
2658{
2659 return hid_send_cmd(STOP, "Stop");
2660}
2661static bool usb_hid_send_scan_previous_track(void)
2662{
2663 return hid_send_cmd(SCAN_PREVIOUS_TRACK, "Scan previous track");
2664}
2665static bool usb_hid_send_scan_next_track(void)
2666{
2667 return hid_send_cmd(SCAN_NEXT_TRACK, "Scan next track");
2668}
2669static bool usb_hid_send_mute(void)
2670{
2671 return hid_send_cmd(MUTE, "Mute");
2672}
2673static bool usb_hid_send_volume_decrement(void)
2674{
2675 return hid_send_cmd(VOLUME_DECREMENT, "Vol Down");
2676}
2677static bool usb_hid_send_volume_increment(void)
2678{
2679 return hid_send_cmd(VOLUME_INCREMENT, "Vol Up");
2680}
2681#endif
2682#endif 2631#endif
2683 2632
2684#if CONFIG_USBOTG == USBOTG_ISP1583 2633#if CONFIG_USBOTG == USBOTG_ISP1583
@@ -2819,15 +2768,6 @@ static const struct the_menu_item menuitems[] = {
2819#if defined(ROCKBOX_HAS_LOGF) && defined(USB_ENABLE_SERIAL) 2768#if defined(ROCKBOX_HAS_LOGF) && defined(USB_ENABLE_SERIAL)
2820 {"USB Serial driver (logf)", toggle_usb_serial }, 2769 {"USB Serial driver (logf)", toggle_usb_serial },
2821#endif 2770#endif
2822#if defined(USB_ENABLE_HID)
2823 {"USB HID play/pause", usb_hid_send_play_pause },
2824 {"USB HID stop", usb_hid_send_stop },
2825 {"USB HID prev track", usb_hid_send_scan_previous_track },
2826 {"USB HID next track", usb_hid_send_scan_next_track },
2827 {"USB HID mute", usb_hid_send_mute },
2828 {"USB HID vol down", usb_hid_send_volume_decrement },
2829 {"USB HID vol up", usb_hid_send_volume_increment },
2830#endif
2831#endif /* HAVE_USBSTACK */ 2771#endif /* HAVE_USBSTACK */
2832#ifdef CPU_BOOST_LOGGING 2772#ifdef CPU_BOOST_LOGGING
2833 {"cpu_boost log",cpu_boost_log}, 2773 {"cpu_boost log",cpu_boost_log},
diff --git a/apps/plugin.c b/apps/plugin.c
index 84200bbf05..35b4179949 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -51,6 +51,10 @@
51#include "bidi.h" 51#include "bidi.h"
52#endif 52#endif
53 53
54#if defined(HAVE_USBSTACK) && defined(USB_ENABLE_HID)
55#include "usbstack/usb_hid.h"
56#endif
57
54#ifdef SIMULATOR 58#ifdef SIMULATOR
55#define PREFIX(_x_) sim_ ## _x_ 59#define PREFIX(_x_) sim_ ## _x_
56#else 60#else
@@ -660,6 +664,10 @@ static const struct plugin_api rockbox_api = {
660 appsversion, 664 appsversion,
661 /* new stuff at the end, sort into place next time 665 /* new stuff at the end, sort into place next time
662 the API gets incompatible */ 666 the API gets incompatible */
667
668#if defined(HAVE_USBSTACK) && defined(USB_ENABLE_HID)
669 usb_hid_send,
670#endif
663}; 671};
664 672
665int plugin_load(const char* plugin, const void* parameter) 673int plugin_load(const char* plugin, const void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index a946f42a14..3809486d0a 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -105,6 +105,10 @@ void* plugin_get_buffer(size_t *buffer_size);
105 105
106#include "yesno.h" 106#include "yesno.h"
107 107
108#if defined(HAVE_USBSTACK) && defined(USB_ENABLE_HID)
109#include "usbstack/usb_hid_usage_tables.h"
110#endif
111
108#ifdef PLUGIN 112#ifdef PLUGIN
109 113
110#if defined(DEBUG) || defined(SIMULATOR) 114#if defined(DEBUG) || defined(SIMULATOR)
@@ -129,7 +133,7 @@ void* plugin_get_buffer(size_t *buffer_size);
129#define PLUGIN_MAGIC 0x526F634B /* RocK */ 133#define PLUGIN_MAGIC 0x526F634B /* RocK */
130 134
131/* increase this every time the api struct changes */ 135/* increase this every time the api struct changes */
132#define PLUGIN_API_VERSION 164 136#define PLUGIN_API_VERSION 165
133 137
134/* update this to latest version if a change to the api struct breaks 138/* update this to latest version if a change to the api struct breaks
135 backwards compatibility (and please take the opportunity to sort in any 139 backwards compatibility (and please take the opportunity to sort in any
@@ -828,6 +832,10 @@ struct plugin_api {
828 const char *appsversion; 832 const char *appsversion;
829 /* new stuff at the end, sort into place next time 833 /* new stuff at the end, sort into place next time
830 the API gets incompatible */ 834 the API gets incompatible */
835
836#if defined(HAVE_USBSTACK) && defined(USB_ENABLE_HID)
837 void (*usb_hid_send)(usage_page_t usage_page, int id);
838#endif
831}; 839};
832 840
833/* plugin header */ 841/* plugin header */
diff --git a/apps/plugins/CATEGORIES b/apps/plugins/CATEGORIES
index ab441f53a7..5d6570a9a4 100644
--- a/apps/plugins/CATEGORIES
+++ b/apps/plugins/CATEGORIES
@@ -63,6 +63,7 @@ pong,games
63ppmviewer,viewers 63ppmviewer,viewers
64properties,viewers 64properties,viewers
65random_folder_advance_config,apps 65random_folder_advance_config,apps
66remote_control,apps
66reversi,games 67reversi,games
67robotfindskitten,games 68robotfindskitten,games
68rockblox,games 69rockblox,games
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES
index 92d1ae6ef6..95ffb1c9de 100644
--- a/apps/plugins/SOURCES
+++ b/apps/plugins/SOURCES
@@ -165,3 +165,6 @@ md5sum.c
165lua.c 165lua.c
166#endif 166#endif
167 167
168#if defined(HAVE_USBSTACK) && defined(USB_ENABLE_HID)
169remote_control.c
170#endif
diff --git a/apps/plugins/remote_control.c b/apps/plugins/remote_control.c
new file mode 100644
index 0000000000..8e05c67283
--- /dev/null
+++ b/apps/plugins/remote_control.c
@@ -0,0 +1,231 @@
1/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id$
9*
10* Copyright (C) 2009 Tomer Shalev
11*
12* This program is free software; you can redistribute it and/or
13* modify it under the terms of the GNU General Public License
14* as published by the Free Software Foundation; either version 2
15* of the License, or (at your option) any later version.
16*
17* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18* KIND, either express or implied.
19*
20****************************************************************************/
21
22#include "plugin.h"
23
24#include "lib/pluginlib_actions.h"
25
26PLUGIN_HEADER
27
28static void remote_control_setcolors(void);
29
30/*****************************************************************************
31* remote_control_setcolors() set the foreground and background colors.
32******************************************************************************/
33static inline void remote_control_setcolors(void)
34{
35#ifdef HAVE_LCD_COLOR
36 rb->lcd_set_background(LCD_RGBPACK(181, 181, 222));
37 rb->lcd_set_foreground(LCD_BLACK);
38#endif
39}
40
41static int menu_desktop(void)
42{
43 int selection = 0;
44
45 MENUITEM_STRINGLIST(menu, "Desktop", NULL, "Escape", "Windows", "F10",
46 "Page Up", "Page Down");
47 while(1)
48 {
49 int id = HID_GENERIC_DESKTOP_UNDEFINED;
50
51 selection = rb->do_menu(&menu, &selection, NULL, false);
52
53 switch (selection)
54 {
55 case 0: /* Escape */
56 id = HID_KEYBOARD_ESCAPE;
57 break;
58 case 1: /* Windows */
59 /* Not sure whether this is the right key */
60 id = HID_KEYBOARD_LEFT_GUI;
61 break;
62 case 2: /* F10 */
63 id = HID_KEYBOARD_F10;
64 break;
65 case 3: /* Page Up */
66 id = HID_KEYBOARD_PAGE_UP;
67 break;
68 case 4: /* Page Down */
69 id = HID_KEYBOARD_PAGE_DOWN;
70 break;
71 case MENU_ATTACHED_USB:
72 return PLUGIN_USB_CONNECTED;
73 case GO_TO_PREVIOUS:
74 return 0;
75 default:
76 break;
77 }
78
79 if (id != HID_GENERIC_DESKTOP_UNDEFINED)
80 rb->usb_hid_send(HID_USAGE_PAGE_KEYBOARD_KEYPAD, id);
81 }
82}
83
84static int menu_presentation(void)
85{
86 int selection = 0;
87
88 MENUITEM_STRINGLIST(menu, "Presentation", NULL, "Next Slide", "Prev Slide",
89 "Start Slideshow", "Leave Slideshow", "Black Screen",
90 "White Screen");
91 while(1)
92 {
93 int id = HID_GENERIC_DESKTOP_UNDEFINED;
94
95 selection = rb->do_menu(&menu, &selection, NULL, false);
96
97 switch (selection)
98 {
99 case 0: /* Next Slide */
100 id = HID_KEYBOARD_N;
101 break;
102 case 1: /* Prev Slide */
103 id = HID_KEYBOARD_P;
104 break;
105 case 2: /* Start Slideshow */
106 id = HID_KEYBOARD_F5;
107 break;
108 case 3: /* Leave Slideshow */
109 id = HID_KEYBOARD_ESCAPE;
110 break;
111 case 4: /* Black Screen */
112 id = HID_KEYBOARD_DOT;
113 break;
114 case 5: /* White Screen */
115 id = HID_KEYBOARD_COMMA;
116 break;
117 case MENU_ATTACHED_USB:
118 return PLUGIN_USB_CONNECTED;
119 case GO_TO_PREVIOUS:
120 return 0;
121 default:
122 break;
123 }
124
125 if (id != HID_GENERIC_DESKTOP_UNDEFINED)
126 rb->usb_hid_send(HID_USAGE_PAGE_KEYBOARD_KEYPAD, id);
127 }
128}
129
130static int menu_media_player(void)
131{
132 int selection = 0;
133
134 MENUITEM_STRINGLIST(menu, "Media Player", NULL, "Play", "Stop", "Next",
135 "Previous", "Volume Up", "Volume Down", "Mute");
136 while(1)
137 {
138 int id = HID_CONSUMER_USAGE_UNASSIGNED;
139
140 selection = rb->do_menu(&menu, &selection, NULL, false);
141
142 switch (selection)
143 {
144 case 0: /* Play */
145 id = HID_CONSUMER_USAGE_PLAY_PAUSE;
146 break;
147 case 1: /* Stop */
148 id = HID_CONSUMER_USAGE_STOP;
149 break;
150 case 2: /* Next */
151 id = HID_CONSUMER_USAGE_SCAN_NEXT_TRACK;
152 break;
153 case 3: /* Previous */
154 id = HID_CONSUMER_USAGE_SCAN_PREVIOUS_TRACK;
155 break;
156 case 4: /* Volume Up */
157 id = HID_CONSUMER_USAGE_VOLUME_INCREMENT;
158 break;
159 case 5: /* Volume Down */
160 id = HID_CONSUMER_USAGE_VOLUME_DECREMENT;
161 break;
162 case 6: /* Mute */
163 id = HID_CONSUMER_USAGE_MUTE;
164 break;
165 case MENU_ATTACHED_USB:
166 return PLUGIN_USB_CONNECTED;
167 case GO_TO_PREVIOUS:
168 return 0;
169 default:
170 break;
171 }
172
173 if (id != HID_CONSUMER_USAGE_UNASSIGNED)
174 rb->usb_hid_send(HID_USAGE_PAGE_CONSUMER, id);
175 }
176}
177
178/*****************************************************************************
179* plugin entry point.
180******************************************************************************/
181enum plugin_status plugin_start(const void* parameter)
182{
183 enum plugin_status rc = PLUGIN_USB_CONNECTED;
184 int selection = 0;
185
186 (void)parameter;
187
188 rb->lcd_clear_display();
189
190#if LCD_DEPTH > 1
191 rb->lcd_set_backdrop(NULL);
192#endif
193 rb->lcd_setfont(FONT_SYSFIXED);
194
195 remote_control_setcolors();
196
197 MENUITEM_STRINGLIST(menu, "Remote Control", NULL, "Desktop", "Presentation",
198 "Media Player", "Quit");
199 while(1)
200 {
201 selection = rb->do_menu(&menu, &selection, NULL, false);
202 switch (selection)
203 {
204 case 0: /* Desktop */
205 if (menu_desktop() == PLUGIN_USB_CONNECTED)
206 goto Exit;
207 break;
208 case 1: /* Presentation */
209 if (menu_presentation() == PLUGIN_USB_CONNECTED)
210 goto Exit;
211 break;
212 case 2: /* Media Player */
213 if (menu_media_player() == PLUGIN_USB_CONNECTED)
214 goto Exit;
215 break;
216 case 3: /* Quit */
217 case GO_TO_PREVIOUS:
218 rc = PLUGIN_OK;
219 goto Exit;
220 case MENU_ATTACHED_USB:
221 goto Exit;
222 default:
223 break;
224 }
225 }
226Exit:
227 rb->lcd_setfont(FONT_UI);
228
229 return rc;
230}
231
diff --git a/apps/screens.c b/apps/screens.c
index 829aa191e1..a19614dcd9 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -116,36 +116,36 @@ static int handle_usb_events(void)
116 116
117 if (hid_enabled) 117 if (hid_enabled)
118 { 118 {
119 consumer_usage_page_t cmd = UNASSIGNED; 119 int id = HID_CONSUMER_USAGE_UNASSIGNED;
120 button = get_action(CONTEXT_USB_HID, HZ/4); 120 button = get_action(CONTEXT_USB_HID, HZ/4);
121 121
122 switch (button) 122 switch (button)
123 { 123 {
124 case ACTION_USB_HID_PLAY: 124 case ACTION_USB_HID_PLAY:
125 cmd = PLAY_PAUSE; 125 id = HID_CONSUMER_USAGE_PLAY_PAUSE;
126 break; 126 break;
127 case ACTION_USB_HID_STOP: 127 case ACTION_USB_HID_STOP:
128 cmd = STOP; 128 id = HID_CONSUMER_USAGE_STOP;
129 break; 129 break;
130 case ACTION_USB_HID_SKIPPREV: 130 case ACTION_USB_HID_SKIPPREV:
131 cmd = SCAN_PREVIOUS_TRACK; 131 id = HID_CONSUMER_USAGE_SCAN_PREVIOUS_TRACK;
132 break; 132 break;
133 case ACTION_USB_HID_SKIPNEXT: 133 case ACTION_USB_HID_SKIPNEXT:
134 cmd = SCAN_NEXT_TRACK; 134 id = HID_CONSUMER_USAGE_SCAN_NEXT_TRACK;
135 break; 135 break;
136 case ACTION_USB_HID_VOLDOWN: 136 case ACTION_USB_HID_VOLDOWN:
137 cmd = VOLUME_DECREMENT; 137 id = HID_CONSUMER_USAGE_VOLUME_DECREMENT;
138 break; 138 break;
139 case ACTION_USB_HID_VOLUP: 139 case ACTION_USB_HID_VOLUP:
140 cmd = VOLUME_INCREMENT; 140 id = HID_CONSUMER_USAGE_VOLUME_INCREMENT;
141 break; 141 break;
142 case ACTION_USB_HID_MUTE: 142 case ACTION_USB_HID_MUTE:
143 cmd = MUTE; 143 id = HID_CONSUMER_USAGE_MUTE;
144 break; 144 break;
145 } 145 }
146 146
147 if (cmd != UNASSIGNED) 147 if (id != HID_CONSUMER_USAGE_UNASSIGNED)
148 usb_hid_send_consumer_usage(cmd); 148 usb_hid_send(HID_USAGE_PAGE_CONSUMER, id);
149 } 149 }
150 else 150 else
151#endif 151#endif
diff --git a/firmware/usbstack/usb_hid.c b/firmware/usbstack/usb_hid.c
index 31554eed48..e1ae75c0f9 100644
--- a/firmware/usbstack/usb_hid.c
+++ b/firmware/usbstack/usb_hid.c
@@ -37,17 +37,28 @@
37 37
38#define HID_VER 0x0110 /* 1.1 */ 38#define HID_VER 0x0110 /* 1.1 */
39/* Subclass Codes (HID1_11.pdf, page 18) */ 39/* Subclass Codes (HID1_11.pdf, page 18) */
40#define SUBCLASS_NONE 0
40#define SUBCLASS_BOOT_INTERFACE 1 41#define SUBCLASS_BOOT_INTERFACE 1
41/* Protocol Codes (HID1_11.pdf, page 19) */ 42/* Protocol Codes (HID1_11.pdf, page 19) */
43#define PROTOCOL_CODE_NONE 0
44#define PROTOCOL_CODE_KEYBOARD 1
42#define PROTOCOL_CODE_MOUSE 2 45#define PROTOCOL_CODE_MOUSE 2
43/* HID main items (HID1_11.pdf, page 38) */ 46/* HID main items (HID1_11.pdf, page 38) */
44#define INPUT 0x80 47#define INPUT 0x80
45#define COLLECTION 0xa0 48#define OUTPUT 0x90
49#define COLLECTION 0xA0
46#define COLLECTION_APPLICATION 0x01 50#define COLLECTION_APPLICATION 0x01
47#define END_COLLECTION 0xc0 51#define END_COLLECTION 0xC0
48/* Parts (HID1_11.pdf, page 40) */ 52/* Parts (HID1_11.pdf, page 40) */
49#define PREFERERD (1 << 5) 53#define MAIN_ITEM_CONSTANT BIT_N(0) /* 0x01 */
50#define NULL_STATE (1 << 6) 54#define MAIN_ITEM_VARIABLE BIT_N(1) /* 0x02 */
55#define MAIN_ITEM_RELATIVE BIT_N(2) /* 0x04 */
56#define MAIN_ITEM_WRAP BIT_N(3) /* 0x08 */
57#define MAIN_ITEM_NONLINEAR BIT_N(4) /* 0x10 */
58#define MAIN_ITEM_NO_PREFERRED BIT_N(5) /* 0x20 */
59#define MAIN_ITEM_NULL_STATE BIT_N(6) /* 0x40 */
60#define MAIN_ITEM_VOLATILE BIT_N(7) /* 0x80 */
61#define MAIN_ITEM_BUFFERED_BYTES BIT_N(8) /* 0x0100 */
51/* HID global items (HID1_11.pdf, page 45) */ 62/* HID global items (HID1_11.pdf, page 45) */
52#define USAGE_PAGE 0x04 63#define USAGE_PAGE 0x04
53#define LOGICAL_MINIMUM 0x14 64#define LOGICAL_MINIMUM 0x14
@@ -62,26 +73,44 @@
62#define USB_DT_HID 0x21 73#define USB_DT_HID 0x21
63#define USB_DT_REPORT 0x22 74#define USB_DT_REPORT 0x22
64 75
65/* (Hut1_12.pdf, Table 1, page 14) */
66#define USAGE_PAGE_CONSUMER 0x0c
67
68#define CONSUMER_USAGE 0x09 76#define CONSUMER_USAGE 0x09
69 77
70/* HID-only class specific requests */ 78/* HID-only class specific requests (HID1_11.pdf, page 61) */
71#define USB_HID_GET_REPORT 0x01 79#define USB_HID_GET_REPORT 0x01
72#define USB_HID_GET_IDLE 0x02 80#define USB_HID_GET_IDLE 0x02
73#define USB_HID_GET_PROTOCOL 0x03 81#define USB_HID_GET_PROTOCOL 0x03
74#define USB_HID_SET_REPORT 0x09 82#define USB_HID_SET_REPORT 0x09
75#define USB_HID_SET_IDLE 0x0a 83#define USB_HID_SET_IDLE 0x0A
76#define USB_HID_SET_PROTOCOL 0x0b 84#define USB_HID_SET_PROTOCOL 0x0B
85
86/* Get_Report and Set_Report Report Type field (HID1_11.pdf, page 61) */
87#define REPORT_TYPE_INPUT 0x01
88#define REPORT_TYPE_OUTPUT 0x02
89#define REPORT_TYPE_FEATURE 0x03
77 90
78#define HID_BUF_SIZE_MSG 16 91#define HID_BUF_SIZE_MSG 16
79#define HID_BUF_SIZE_CMD 5 92#define HID_BUF_SIZE_CMD 16
80#define HID_BUG_SIZE_REPORT 32 93#define HID_BUF_SIZE_REPORT 96
81#define HID_NUM_BUFFERS 5 94#define HID_NUM_BUFFERS 5
95#define SET_REPORT_BUF_LEN 2
96
97#ifdef LOGF_ENABLE
98#define BUF_DUMP_BUF_LEN HID_BUF_SIZE_REPORT
99#define BUF_DUMP_PREFIX_SIZE 5
100#define BUF_DUMP_LINE_SIZE (MAX_LOGF_ENTRY - BUF_DUMP_PREFIX_SIZE)
101#define BUF_DUMP_ITEMS_IN_LINE (BUF_DUMP_LINE_SIZE / 3)
102#define BUF_DUMP_NUM_LINES (BUF_DUMP_BUF_LEN / (BUF_DUMP_LINE_SIZE / 3))
103#endif
82 104
83#define HID_BUF_INC(i) do { (i) = ((i) + 1) % HID_NUM_BUFFERS; } while (0) 105#define HID_BUF_INC(i) do { (i) = ((i) + 1) % HID_NUM_BUFFERS; } while (0)
84 106
107typedef enum
108{
109 REPORT_ID_KEYBOARD = 1,
110 REPORT_ID_CONSUMER,
111 REPORT_ID_COUNT,
112} report_id_t;
113
85/* hid interface */ 114/* hid interface */
86static struct usb_interface_descriptor __attribute__((aligned(2))) 115static struct usb_interface_descriptor __attribute__((aligned(2)))
87 interface_descriptor = 116 interface_descriptor =
@@ -93,7 +122,7 @@ static struct usb_interface_descriptor __attribute__((aligned(2)))
93 .bNumEndpoints = 1, 122 .bNumEndpoints = 1,
94 .bInterfaceClass = USB_CLASS_HID, 123 .bInterfaceClass = USB_CLASS_HID,
95 .bInterfaceSubClass = SUBCLASS_BOOT_INTERFACE, 124 .bInterfaceSubClass = SUBCLASS_BOOT_INTERFACE,
96 .bInterfaceProtocol = PROTOCOL_CODE_MOUSE, 125 .bInterfaceProtocol = PROTOCOL_CODE_KEYBOARD,
97 .iInterface = 0 126 .iInterface = 0
98}; 127};
99 128
@@ -129,7 +158,17 @@ static struct usb_endpoint_descriptor __attribute__((aligned(2)))
129 .bInterval = 0 158 .bInterval = 0
130}; 159};
131 160
132static unsigned char report_descriptor[HID_BUG_SIZE_REPORT] 161typedef struct
162{
163 uint8_t usage_page;
164 /* Write the id into the buffer in the appropriate location, and returns the
165 * buffer length */
166 uint8_t (*buf_set)(unsigned char *buf, int id);
167} usb_hid_report_t;
168
169usb_hid_report_t usb_hid_reports[REPORT_ID_COUNT];
170
171static unsigned char report_descriptor[HID_BUF_SIZE_REPORT]
133 USB_DEVBSS_ATTR __attribute__((aligned(32))); 172 USB_DEVBSS_ATTR __attribute__((aligned(32)));
134 173
135static unsigned char send_buffer[HID_NUM_BUFFERS][HID_BUF_SIZE_MSG] 174static unsigned char send_buffer[HID_NUM_BUFFERS][HID_BUF_SIZE_MSG]
@@ -138,16 +177,14 @@ size_t send_buffer_len[HID_NUM_BUFFERS];
138static int cur_buf_prepare; 177static int cur_buf_prepare;
139static int cur_buf_send; 178static int cur_buf_send;
140 179
141static uint16_t report_descriptor_len;
142static bool active = false; 180static bool active = false;
143static int ep_in; 181static int ep_in;
144static int usb_interface; 182static int usb_interface;
145static uint32_t report_id;
146 183
147static void usb_hid_try_send_drv(void); 184static void usb_hid_try_send_drv(void);
148 185
149static void pack_parameter(unsigned char **dest, uint8_t parameter, 186static void pack_parameter(unsigned char **dest, bool is_signed,
150 uint32_t value) 187 uint8_t parameter, uint32_t value)
151{ 188{
152 uint8_t size_value = 1; /* # of bytes */ 189 uint8_t size_value = 1; /* # of bytes */
153 uint32_t v = value; 190 uint32_t v = value;
@@ -155,6 +192,30 @@ static void pack_parameter(unsigned char **dest, uint8_t parameter,
155 while (v >>= 8) 192 while (v >>= 8)
156 size_value++; 193 size_value++;
157 194
195 if (is_signed)
196 {
197 bool is_negative = 0;
198
199 switch (size_value)
200 {
201 case 1:
202 is_negative = (int8_t)value < 0;
203 break;
204 case 2:
205 is_negative = (int16_t)value < 0;
206 break;
207 case 3:
208 case 4:
209 is_negative = (int32_t)value < 0;
210 break;
211 default:
212 break;
213 }
214
215 if (is_negative)
216 size_value++;
217 }
218
158 **dest = parameter | size_value; 219 **dest = parameter | size_value;
159 (*dest)++; 220 (*dest)++;
160 221
@@ -182,48 +243,157 @@ int usb_hid_set_first_interface(int interface)
182 return interface + 1; 243 return interface + 1;
183} 244}
184 245
185int usb_hid_get_config_descriptor(unsigned char *dest,int max_packet_size) 246#ifdef LOGF_ENABLE
247static unsigned char
248 buf_dump_ar[BUF_DUMP_NUM_LINES][BUF_DUMP_LINE_SIZE + 1]
249 USB_DEVBSS_ATTR __attribute__((aligned(32)));
250
251void buf_dump(unsigned char *buf, size_t size)
252{
253 size_t i;
254 int line;
255 static const char v[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
256 'A', 'B', 'C', 'D', 'E', 'F' };
257
258 for (i = 0, line = 0; i < size; line++)
259 {
260 int j, i0 = i;
261 char *b = buf_dump_ar[line];
262
263 for (j = 0; j < BUF_DUMP_ITEMS_IN_LINE && i < size; j++, i++)
264 {
265 *b++ = v[buf[i] >> 4];
266 *b++ = v[buf[i] & 0xF];
267 *b++ = ' ';
268 }
269 *b = 0;
270
271 /* Prefix must be of len BUF_DUMP_PREFIX_SIZE */
272 logf("%03d: %s", i0, buf_dump_ar[line]);
273 }
274}
275#else
276#undef buf_dump
277#define buf_dump(...)
278#endif
279
280uint8_t buf_set_keyboard(unsigned char *buf, int id)
281{
282 memset(buf, 0, 7);
283
284 if (HID_KEYBOARD_LEFT_CONTROL <= id && id <= HID_KEYBOARD_RIGHT_GUI)
285 buf[0] = (1 << (id - HID_KEYBOARD_LEFT_CONTROL));
286 else
287 buf[1] = (uint8_t)id;
288
289 return 7;
290}
291
292uint8_t buf_set_consumer(unsigned char *buf, int id)
293{
294 memset(buf, 0, 4);
295 buf[0] = (uint8_t)id;
296
297 return 4;
298}
299
300static size_t descriptor_report_get(unsigned char *dest)
301{
302 unsigned char *report = dest;
303 usb_hid_report_t *usb_hid_report;
304
305 /* Keyboard control */
306 usb_hid_report = &usb_hid_reports[REPORT_ID_KEYBOARD];
307 usb_hid_report->usage_page = HID_USAGE_PAGE_KEYBOARD_KEYPAD;
308 usb_hid_report->buf_set = buf_set_keyboard;
309
310 pack_parameter(&report, 0, USAGE_PAGE,
311 HID_USAGE_PAGE_GENERIC_DESKTOP_CONTROLS);
312 PACK_VAL2(report, CONCAT(CONSUMER_USAGE, HID_GENERIC_DESKTOP_KEYBOARD));
313 pack_parameter(&report, 0, COLLECTION, COLLECTION_APPLICATION);
314 pack_parameter(&report, 0, REPORT_ID, REPORT_ID_KEYBOARD);
315 pack_parameter(&report, 0, USAGE_PAGE, HID_GENERIC_DESKTOP_KEYPAD);
316 pack_parameter(&report, 0, USAGE_MINIMUM, HID_KEYBOARD_LEFT_CONTROL);
317 pack_parameter(&report, 0, USAGE_MAXIMUM, HID_KEYBOARD_RIGHT_GUI);
318 pack_parameter(&report, 1, LOGICAL_MINIMUM, 0);
319 pack_parameter(&report, 1, LOGICAL_MAXIMUM, 1);
320 pack_parameter(&report, 0, REPORT_SIZE, 1);
321 pack_parameter(&report, 0, REPORT_COUNT, 8);
322 pack_parameter(&report, 0, INPUT, MAIN_ITEM_VARIABLE);
323 pack_parameter(&report, 0, REPORT_SIZE, 1);
324 pack_parameter(&report, 0, REPORT_COUNT, 5);
325 pack_parameter(&report, 0, USAGE_PAGE, HID_USAGE_PAGE_LEDS);
326 pack_parameter(&report, 0, USAGE_MINIMUM, HID_LED_NUM_LOCK);
327 pack_parameter(&report, 0, USAGE_MAXIMUM, HID_LED_KANA);
328 pack_parameter(&report, 0, OUTPUT, MAIN_ITEM_VARIABLE);
329 pack_parameter(&report, 0, REPORT_SIZE, 3);
330 pack_parameter(&report, 0, REPORT_COUNT, 1);
331 pack_parameter(&report, 0, OUTPUT, MAIN_ITEM_CONSTANT);
332 pack_parameter(&report, 0, REPORT_SIZE, 8);
333 pack_parameter(&report, 0, REPORT_COUNT, 6);
334 pack_parameter(&report, 1, LOGICAL_MINIMUM, 0);
335 pack_parameter(&report, 1, LOGICAL_MAXIMUM, HID_KEYBOARD_EX_SEL);
336 pack_parameter(&report, 0, USAGE_PAGE, HID_USAGE_PAGE_KEYBOARD_KEYPAD);
337 pack_parameter(&report, 0, USAGE_MINIMUM, 0);
338 pack_parameter(&report, 0, USAGE_MAXIMUM, HID_KEYBOARD_EX_SEL);
339 pack_parameter(&report, 0, INPUT, 0);
340 PACK_VAL1(report, END_COLLECTION);
341
342 /* Consumer usage controls - play/pause, stop, etc. */
343 usb_hid_report = &usb_hid_reports[REPORT_ID_CONSUMER];
344 usb_hid_report->usage_page = HID_USAGE_PAGE_CONSUMER;
345 usb_hid_report->buf_set = buf_set_consumer;
346
347 pack_parameter(&report, 0, USAGE_PAGE, HID_USAGE_PAGE_CONSUMER);
348 PACK_VAL2(report, CONCAT(CONSUMER_USAGE,
349 HID_CONSUMER_USAGE_CONSUMER_CONTROL));
350 pack_parameter(&report, 0, COLLECTION, COLLECTION_APPLICATION);
351 pack_parameter(&report, 0, REPORT_ID, REPORT_ID_CONSUMER);
352 pack_parameter(&report, 0, REPORT_SIZE, 16);
353 pack_parameter(&report, 0, REPORT_COUNT, 2);
354 pack_parameter(&report, 1, LOGICAL_MINIMUM, 1);
355 pack_parameter(&report, 1, LOGICAL_MAXIMUM, 652);
356 pack_parameter(&report, 0, USAGE_MINIMUM,
357 HID_CONSUMER_USAGE_CONSUMER_CONTROL);
358 pack_parameter(&report, 0, USAGE_MAXIMUM, HID_CONSUMER_USAGE_AC_SEND);
359 pack_parameter(&report, 0, INPUT, MAIN_ITEM_NO_PREFERRED |
360 MAIN_ITEM_NULL_STATE);
361 PACK_VAL1(report, END_COLLECTION);
362
363 return (size_t)((uint32_t)report - (uint32_t)dest);
364}
365
366static void descriptor_hid_get(unsigned char **dest)
367{
368 hid_descriptor.wDescriptorLength0 =
369 (uint16_t)descriptor_report_get(report_descriptor);
370
371 PACK_DATA(*dest, hid_descriptor);
372}
373
374int usb_hid_get_config_descriptor(unsigned char *dest, int max_packet_size)
186{ 375{
187 unsigned char *report, *orig_dest = dest; 376 unsigned char *orig_dest = dest;
188 377
189 logf("hid: config desc."); 378 logf("hid: config desc.");
190 379
191 /* Ignore given max_packet_size */ 380 /* Ignore given max_packet_size */
192 (void)max_packet_size; 381 (void)max_packet_size;
193 382
194 /* TODO: Increment report_id for each report, and send command with 383 /* Interface descriptor */
195 * appropriate report id */
196 report_id = 2;
197
198 /* Initialize report descriptor */
199 report = report_descriptor;
200 pack_parameter(&report, USAGE_PAGE, USAGE_PAGE_CONSUMER);
201 PACK_VAL2(report, CONCAT(CONSUMER_USAGE, CONSUMER_CONTROL));
202 pack_parameter(&report, COLLECTION, COLLECTION_APPLICATION);
203 pack_parameter(&report, REPORT_ID, report_id);
204 pack_parameter(&report, REPORT_SIZE, 16);
205 pack_parameter(&report, REPORT_COUNT, 2);
206 pack_parameter(&report, LOGICAL_MINIMUM, 1);
207 pack_parameter(&report, LOGICAL_MAXIMUM, 652);
208 pack_parameter(&report, USAGE_MINIMUM, CONSUMER_CONTROL);
209 pack_parameter(&report, USAGE_MAXIMUM, AC_SEND);
210 pack_parameter(&report, INPUT, PREFERERD | NULL_STATE);
211 PACK_VAL1(report, END_COLLECTION);
212 report_descriptor_len = (uint16_t)((uint32_t)report -
213 (uint32_t)report_descriptor);
214
215 interface_descriptor.bInterfaceNumber = usb_interface; 384 interface_descriptor.bInterfaceNumber = usb_interface;
216 PACK_DATA(dest, interface_descriptor); 385 PACK_DATA(dest, interface_descriptor);
217 hid_descriptor.wDescriptorLength0 = report_descriptor_len;
218 PACK_DATA(dest, hid_descriptor);
219 386
387 /* HID descriptor */
388 descriptor_hid_get(&dest);
389
390 /* Endpoint descriptor */
220 endpoint_descriptor.wMaxPacketSize = 8; 391 endpoint_descriptor.wMaxPacketSize = 8;
221 endpoint_descriptor.bInterval = 8; 392 endpoint_descriptor.bInterval = 8;
222
223 endpoint_descriptor.bEndpointAddress = ep_in; 393 endpoint_descriptor.bEndpointAddress = ep_in;
224 PACK_DATA(dest, endpoint_descriptor); 394 PACK_DATA(dest, endpoint_descriptor);
225 395
226 return (dest - orig_dest); 396 return (int)(dest - orig_dest);
227} 397}
228 398
229void usb_hid_init_connection(void) 399void usb_hid_init_connection(void)
@@ -263,10 +433,12 @@ void usb_hid_transfer_complete(int ep, int dir, int status, int length)
263 (void)status; 433 (void)status;
264 (void)length; 434 (void)length;
265 435
266 switch (dir) { 436 switch (dir)
437 {
267 case USB_DIR_OUT: 438 case USB_DIR_OUT:
268 break; 439 break;
269 case USB_DIR_IN: { 440 case USB_DIR_IN:
441 {
270 if (status) 442 if (status)
271 break; 443 break;
272 444
@@ -278,26 +450,95 @@ void usb_hid_transfer_complete(int ep, int dir, int status, int length)
278 } 450 }
279} 451}
280 452
453/* The DAP is registered as a keyboard with several LEDs, therefore the OS sends
454 * LED report to notify the DAP whether Num Lock / Caps Lock etc. are enabled.
455 * In order to allow sending info to the DAP, the Set Report mechanism can be
456 * used by defining vendor specific output reports and send them from the host
457 * to the DAP using the host's custom driver */
458static int usb_hid_set_report(struct usb_ctrlrequest *req)
459{
460 static unsigned char buf[SET_REPORT_BUF_LEN]
461 USB_DEVBSS_ATTR __attribute__((aligned(32)));
462 int length;
463 int rc = 0;
464
465 if ((req->wValue >> 8) != REPORT_TYPE_OUTPUT)
466 {
467 logf("Unsopported report type");
468 rc = 1;
469 goto Exit;
470 }
471 if ((req->wValue & 0xff) != REPORT_ID_KEYBOARD)
472 {
473 logf("Wrong report id");
474 rc = 2;
475 goto Exit;
476 }
477 if (req->wIndex != (uint16_t)usb_interface)
478 {
479 logf("Wrong interface");
480 rc = 3;
481 goto Exit;
482 }
483 length = req->wLength;
484 if (length != SET_REPORT_BUF_LEN)
485 {
486 logf("Wrong length");
487 rc = 4;
488 goto Exit;
489 }
490
491 memset(buf, 0, length);
492 usb_drv_recv(EP_CONTROL, buf, length);
493
494#ifdef LOGF_ENABLE
495 if (buf[1] & 0x01)
496 logf("Num Lock enabled");
497 if (buf[1] & 0x02)
498 logf("Caps Lock enabled");
499 if (buf[1] & 0x04)
500 logf("Scroll Lock enabled");
501 if (buf[1] & 0x08)
502 logf("Compose enabled");
503 if (buf[1] & 0x10)
504 logf("Kana enabled");
505#endif
506
507 /* Defining other LEDs and setting them from the USB host (OS) can be used
508 * to send messages to the DAP */
509
510Exit:
511 return rc;
512}
513
281/* called by usb_core_control_request() */ 514/* called by usb_core_control_request() */
282bool usb_hid_control_request(struct usb_ctrlrequest* req, unsigned char* dest) 515bool usb_hid_control_request(struct usb_ctrlrequest *req, unsigned char *dest)
283{ 516{
284 bool handled = false; 517 bool handled = false;
285 518
286 switch(req->bRequestType & USB_TYPE_MASK) { 519 switch (req->bRequestType & USB_TYPE_MASK)
287 case USB_TYPE_STANDARD: { 520 {
521 case USB_TYPE_STANDARD:
522 {
288 unsigned char *orig_dest = dest; 523 unsigned char *orig_dest = dest;
289 524
290 switch(req->wValue>>8) { /* type */ 525 switch (req->wValue>>8) /* type */
291 case USB_DT_HID: { 526 {
527 case USB_DT_HID:
528 {
292 logf("hid: type hid"); 529 logf("hid: type hid");
293 hid_descriptor.wDescriptorLength0 = report_descriptor_len; 530 descriptor_hid_get(&dest);
294 PACK_DATA(dest, hid_descriptor);
295 break; 531 break;
296 } 532 }
297 case USB_DT_REPORT: { 533 case USB_DT_REPORT:
534 {
535 int len;
536
298 logf("hid: type report"); 537 logf("hid: type report");
299 memcpy(dest, &report_descriptor, report_descriptor_len); 538
300 dest += report_descriptor_len; 539 len = descriptor_report_get(report_descriptor);
540 memcpy(dest, &report_descriptor, len);
541 dest += len;
301 break; 542 break;
302 } 543 }
303 default: 544 default:
@@ -305,26 +546,37 @@ bool usb_hid_control_request(struct usb_ctrlrequest* req, unsigned char* dest)
305 break; 546 break;
306 } 547 }
307 if (dest != orig_dest && 548 if (dest != orig_dest &&
308 !usb_drv_send(EP_CONTROL, orig_dest, dest - orig_dest)) { 549 !usb_drv_send(EP_CONTROL, orig_dest, dest - orig_dest))
550 {
309 usb_core_ack_control(req); 551 usb_core_ack_control(req);
310 handled = true; 552 handled = true;
311 } 553 }
312 break; 554 break;
313 } 555 }
314 556
315 case USB_TYPE_CLASS: { 557 case USB_TYPE_CLASS:
316 switch (req->bRequest) { 558 {
317 case USB_HID_SET_IDLE: 559 switch (req->bRequest)
318 logf("hid: set idle"); 560 {
561 case USB_HID_SET_IDLE:
562 logf("hid: set idle");
563 usb_core_ack_control(req);
564 handled = true;
565 break;
566 case USB_HID_SET_REPORT:
567 logf("hid: set report");
568 if (!usb_hid_set_report(req))
569 {
319 usb_core_ack_control(req); 570 usb_core_ack_control(req);
320 handled = true; 571 handled = true;
321 break; 572 }
322 default: 573 break;
323 logf("%d: unsup. cls. req", req->bRequest); 574 default:
324 break; 575 logf("%d: unsup. cls. req", req->bRequest);
325 } 576 break;
326 break;
327 } 577 }
578 break;
579 }
328 580
329 case USB_TYPE_VENDOR: 581 case USB_TYPE_VENDOR:
330 logf("hid: unsup. ven. req"); 582 logf("hid: unsup. ven. req");
@@ -367,26 +619,42 @@ static void usb_hid_queue(unsigned char *data, int length)
367 HID_BUF_INC(cur_buf_prepare); 619 HID_BUF_INC(cur_buf_prepare);
368} 620}
369 621
370void usb_hid_send_consumer_usage(consumer_usage_page_t id) 622void usb_hid_send(usage_page_t usage_page, int id)
371{ 623{
624 uint8_t report_id, length;
372 static unsigned char buf[HID_BUF_SIZE_CMD] USB_DEVBSS_ATTR 625 static unsigned char buf[HID_BUF_SIZE_CMD] USB_DEVBSS_ATTR
373 __attribute__((aligned(32))); 626 __attribute__((aligned(32)));
374 unsigned char *dest = buf; 627 usb_hid_report_t *report = NULL;
375
376 memset(buf, 0, sizeof(buf));
377 628
378 logf("HID: Sending 0x%x", id); 629 for (report_id = 1; report_id < REPORT_ID_COUNT; report_id++)
630 {
631 if (usb_hid_reports[report_id].usage_page == usage_page)
632 {
633 report = &usb_hid_reports[report_id];
634 break;
635 }
636 }
637 if (!report)
638 {
639 logf("Unsupported usage_page");
640 return;
641 }
379 642
380 pack_parameter(&dest, 0, id); 643 logf("Sending cmd 0x%x", id);
381 buf[0] = report_id; 644 buf[0] = report_id;
645 length = report->buf_set(&buf[1], id) + 1;
646 logf("length %u", length);
382 647
383 /* Key pressed */ 648 /* Key pressed */
384 usb_hid_queue(buf, HID_BUF_SIZE_CMD); 649 buf_dump(buf, length);
650 usb_hid_queue(buf, length);
385 651
386 /* Key released */ 652 /* Key released */
387 memset(buf, 0, sizeof(buf)); 653 memset(buf, 0, length);
388 buf[0] = report_id; 654 buf[0] = report_id;
389 usb_hid_queue(buf, HID_BUF_SIZE_CMD); 655
656 buf_dump(buf, length);
657 usb_hid_queue(buf, length);
390 658
391 usb_hid_try_send_drv(); 659 usb_hid_try_send_drv();
392} 660}
diff --git a/firmware/usbstack/usb_hid.h b/firmware/usbstack/usb_hid.h
index bce6943a4d..917992cd35 100644
--- a/firmware/usbstack/usb_hid.h
+++ b/firmware/usbstack/usb_hid.h
@@ -22,6 +22,7 @@
22#define USB_HID_H 22#define USB_HID_H
23 23
24#include "usb_ch9.h" 24#include "usb_ch9.h"
25#include "usb_core.h"
25#include "usb_hid_usage_tables.h" 26#include "usb_hid_usage_tables.h"
26 27
27int usb_hid_request_endpoints(struct usb_class_driver *drv); 28int usb_hid_request_endpoints(struct usb_class_driver *drv);
@@ -33,7 +34,7 @@ void usb_hid_disconnect(void);
33void usb_hid_transfer_complete(int ep, int dir, int status, int length); 34void usb_hid_transfer_complete(int ep, int dir, int status, int length);
34bool usb_hid_control_request(struct usb_ctrlrequest* req, unsigned char* dest); 35bool usb_hid_control_request(struct usb_ctrlrequest* req, unsigned char* dest);
35 36
36void usb_hid_send_consumer_usage(consumer_usage_page_t id); 37void usb_hid_send(usage_page_t usage_page, int id);
37 38
38#endif 39#endif
39 40
diff --git a/firmware/usbstack/usb_hid_usage_tables.h b/firmware/usbstack/usb_hid_usage_tables.h
index 37c69d2bd6..9b64cd0328 100644
--- a/firmware/usbstack/usb_hid_usage_tables.h
+++ b/firmware/usbstack/usb_hid_usage_tables.h
@@ -21,374 +21,685 @@
21#ifndef USB_HID_USAGE_TABLES_H 21#ifndef USB_HID_USAGE_TABLES_H
22#define USB_HID_USAGE_TABLES_H 22#define USB_HID_USAGE_TABLES_H
23 23
24typedef enum consumer_usage_page 24typedef enum usage_page
25{ 25{
26 UNASSIGNED = 0x00, 26 HID_USAGE_PAGE_UNDEFINED = 0x00,
27 CONSUMER_CONTROL = 0x1, 27 HID_USAGE_PAGE_GENERIC_DESKTOP_CONTROLS = 0x01,
28 NUMERIC_KEY_PAD = 0x2, 28 HID_USAGE_PAGE_SIMULATION_CONTROLS = 0x02,
29 PROGRAMMABLE_BUTTONS = 0x3, 29 HID_USAGE_PAGE_VR_CONTROLS = 0x03,
30 MICROPHONE = 0x4, 30 HID_USAGE_PAGE_SPORT_CONTROLS = 0x04,
31 HEADPHONE = 0x5, 31 HID_USAGE_PAGE_GAME_CONTROLS = 0x05,
32 GRAPHIC_EQUALIZER = 0x6, 32 HID_USAGE_PAGE_GENERIC_DEVICE_CONTROLS = 0x06,
33 PLUS_10 = 0x20, 33 HID_USAGE_PAGE_KEYBOARD_KEYPAD = 0x07,
34 PLUS_100 = 0x21, 34 HID_USAGE_PAGE_LEDS = 0x08,
35 AM_PM = 0x22, 35 HID_USAGE_PAGE_BUTTON = 0x09,
36 POWER = 0x30, 36 HID_USAGE_PAGE_ORDINAL = 0x0A,
37 RESET = 0x31, 37 HID_USAGE_PAGE_TELEPHONY = 0x0B,
38 SLEEP = 0x32, 38 HID_USAGE_PAGE_CONSUMER = 0x0C,
39 SLEEP_AFTER = 0x33, 39 HID_USAGE_PAGE_DIGITIZER = 0x0D,
40 SLEEP_MODE = 0x34, 40 HID_USAGE_PAGE_PID_PAGE = 0x0F,
41 ILLUMINATION = 0x35, 41 HID_USAGE_PAGE_UNICODE = 0x10,
42 FUNCTION_BUTTONS = 0x36, 42 HID_USAGE_PAGE_ALPHANUMERIC_DISPLAY = 0x14,
43 MENU = 0x40, 43 HID_USAGE_PAGE_MEDICAL_INSTRUMENTS = 0x40,
44 MENU_PICK = 0x41, 44 HID_USAGE_PAGE_BAR_CODE_SCANNER_PAGE = 0x8C,
45 MENU_UP = 0x42, 45 HID_USAGE_PAGE_SCALE_PAGE = 0x8D,
46 MENU_DOWN = 0x43, 46 HID_USAGE_PAGE_MAGNETIC_STRIPE_READING_DEVICES = 0x8E,
47 MENU_LEFT = 0x44, 47 HID_USAGE_PAGE_CAMERA_CONTROL_PAGE = 0x90,
48 MENU_RIGHT = 0x45, 48 HID_USAGE_PAGE_ARCADE_PAGE = 0x91,
49 MENU_ESCAPE = 0x46, 49} usage_page_t;
50 MENU_VALUE_INCREASE = 0x47, 50
51 MENU_VALUE_DECREASE = 0x48, 51/* Generic Desktop Page (0x01) */
52 DATA_ON_SCREEN = 0x60, 52#define HID_GENERIC_DESKTOP_UNDEFINED 0x00
53 CLOSED_CAPTION = 0x61, 53#define HID_GENERIC_DESKTOP_POINTER 0x01
54 CLOSED_CAPTION_SELECT = 0x62, 54#define HID_GENERIC_DESKTOP_MOUSE 0x02
55 VCR_TV = 0x63, 55#define HID_GENERIC_DESKTOP_JOYSTICK 0x04
56 BROADCAST_MODE = 0x64, 56#define HID_GENERIC_DESKTOP_GAME_PAD 0x05
57 SNAPSHOT = 0x65, 57#define HID_GENERIC_DESKTOP_KEYBOARD 0x06
58 STILL = 0x66, 58#define HID_GENERIC_DESKTOP_KEYPAD 0x07
59 SELECTION = 0x80, 59#define HID_GENERIC_DESKTOP_MULTI_AXIS_CONTROLLER 0x08
60 ASSIGN_SELECTION = 0x81, 60#define HID_GENERIC_DESKTOP_TABLET_PC_SYSTEM_CONTROLS 0x09
61 MODE_STEP = 0x82, 61#define HID_GENERIC_DESKTOP_X 0x30
62 RECALL_LAST = 0x83, 62#define HID_GENERIC_DESKTOP_Y 0x31
63 ENTER_CHANNEL = 0x84, 63#define HID_GENERIC_DESKTOP_Z 0x32
64 ORDER_MOVIE = 0x85, 64#define HID_GENERIC_DESKTOP_RX 0x33
65 CHANNEL = 0x86, 65#define HID_GENERIC_DESKTOP_RY 0x34
66 MEDIA_SELECTION = 0x87, 66#define HID_GENERIC_DESKTOP_RZ 0x35
67 MEDIA_SELECT_COMPUTER = 0x88, 67#define HID_GENERIC_DESKTOP_SLIDER 0x36
68 MEDIA_SELECT_TV = 0x89, 68#define HID_GENERIC_DESKTOP_DIAL 0x37
69 MEDIA_SELECT_WWW = 0x8A, 69#define HID_GENERIC_DESKTOP_WHEEL 0x38
70 MEDIA_SELECT_DVD = 0x8B, 70#define HID_GENERIC_DESKTOP_HAT_SWITCH 0x39
71 MEDIA_SELECT_TELEPHONE = 0x8C, 71#define HID_GENERIC_DESKTOP_COUNTED_BUFFER 0x3A
72 MEDIA_SELECT_PROGRAM_GUIDE = 0x8D, 72#define HID_GENERIC_DESKTOP_BYTE_COUNT 0x3B
73 MEDIA_SELECT_VIDEO_PHONE = 0x8E, 73#define HID_GENERIC_DESKTOP_MOTION_WAKEUP 0x3C
74 MEDIA_SELECT_GAMES = 0x8F, 74#define HID_GENERIC_DESKTOP_START 0x3D
75 MEDIA_SELECT_MESSAGES = 0x90, 75#define HID_GENERIC_DESKTOP_SELECT 0x3E
76 MEDIA_SELECT_CD = 0x91, 76#define HID_GENERIC_DESKTOP_VX 0x40
77 MEDIA_SELECT_VCR = 0x92, 77#define HID_GENERIC_DESKTOP_VY 0x41
78 MEDIA_SELECT_TUNER = 0x93, 78#define HID_GENERIC_DESKTOP_VZ 0x42
79 QUIT = 0x94, 79#define HID_GENERIC_DESKTOP_VBRX 0x43
80 HELP = 0x95, 80#define HID_GENERIC_DESKTOP_VBRY 0x44
81 MEDIA_SELECT_TAPE = 0x96, 81#define HID_GENERIC_DESKTOP_VBRZ 0x45
82 MEDIA_SELECT_CABLE = 0x97, 82#define HID_GENERIC_DESKTOP_VNO 0x46
83 MEDIA_SELECT_SATELLITE = 0x98, 83#define HID_GENERIC_DESKTOP_FEATURE_NOTIFICATION 0x47
84 MEDIA_SELECT_SECURITY = 0x99, 84#define HID_GENERIC_DESKTOP_RESOLUTION_MULTIPLIER 0x48
85 MEDIA_SELECT_HOME = 0x9A, 85#define HID_GENERIC_DESKTOP_SYSTEM_CONTROL 0x80
86 MEDIA_SELECT_CALL = 0x9B, 86#define HID_GENERIC_DESKTOP_SYSTEM_POWER_DOWN 0x81
87 CHANNEL_INCREMENT = 0x9C, 87#define HID_GENERIC_DESKTOP_SYSTEM_SLEEP 0x82
88 CHANNEL_DECREMENT = 0x9D, 88#define HID_GENERIC_DESKTOP_SYSTEM_WAKE_UP 0x83
89 MEDIA_SELECT_SAP = 0x9E, 89#define HID_GENERIC_DESKTOP_SYSTEM_CONTEXT_MENU 0x84
90 VCR_PLUS = 0xA0, 90#define HID_GENERIC_DESKTOP_SYSTEM_MAIN_MENU 0x85
91 ONCE = 0xA1, 91#define HID_GENERIC_DESKTOP_SYSTEM_APP_MENU 0x86
92 DAILY = 0xA2, 92#define HID_GENERIC_DESKTOP_SYSTEM_MENU_HELP 0x87
93 WEEKLY = 0xA3, 93#define HID_GENERIC_DESKTOP_SYSTEM_MENU_EXIT 0x88
94 MONTHLY = 0xA4, 94#define HID_GENERIC_DESKTOP_SYSTEM_MENU_SELECT 0x89
95 PLAY = 0xB0, 95#define HID_GENERIC_DESKTOP_SYSTEM_MENU_RIGHT 0x8A
96 PAUSE = 0xB1, 96#define HID_GENERIC_DESKTOP_SYSTEM_MENU_LEFT 0x8B
97 RECORD = 0xB2, 97#define HID_GENERIC_DESKTOP_SYSTEM_MENU_UP 0x8C
98 FAST_FORWARD = 0xB3, 98#define HID_GENERIC_DESKTOP_SYSTEM_MENU_DOWN 0x8D
99 REWIND = 0xB4, 99#define HID_GENERIC_DESKTOP_SYSTEM_COLD_RESTART 0x8E
100 SCAN_NEXT_TRACK = 0xB5, 100#define HID_GENERIC_DESKTOP_SYSTEM_WARM_RESTART 0x8F
101 SCAN_PREVIOUS_TRACK = 0xB6, 101#define HID_GENERIC_DESKTOP_D_PAD_UP 0x90
102 STOP = 0xB7, 102#define HID_GENERIC_DESKTOP_D_PAD_DOWN 0x91
103 EJECT = 0xB8, 103#define HID_GENERIC_DESKTOP_D_PAD_RIGHT 0x92
104 RANDOM_PLAY = 0xB9, 104#define HID_GENERIC_DESKTOP_D_PAD_LEFT 0x93
105 SELECT_DISC = 0xBA, 105#define HID_GENERIC_DESKTOP_SYSTEM_DOCK 0xA0
106 ENTER_DISC = 0xBB, 106#define HID_GENERIC_DESKTOP_SYSTEM_UNDOCK 0xA1
107 REPEAT = 0xBC, 107#define HID_GENERIC_DESKTOP_SYSTEM_SETUP 0xA2
108 TRACKING = 0xBD, 108#define HID_GENERIC_DESKTOP_SYSTEM_BREAK 0xA3
109 TRACK_NORMAL = 0xBE, 109#define HID_GENERIC_DESKTOP_SYSTEM_DEBUGGER_BREAK 0xA4
110 SLOW_TRACKING = 0xBF, 110#define HID_GENERIC_DESKTOP_APPLICATION_BREAK 0xA5
111 FRAME_FORWARD = 0xC0, 111#define HID_GENERIC_DESKTOP_APPLICATION_DEBUGGER_BREAK 0xA6
112 FRAME_BACK = 0xC1, 112#define HID_GENERIC_DESKTOP_SYSTEM_SPEAKER_MUTE 0xA7
113 MARK = 0xC2, 113#define HID_GENERIC_DESKTOP_SYSTEM_HIBERNATE 0xA8
114 CLEAR_MARK = 0xC3, 114#define HID_GENERIC_DESKTOP_SYSTEM_DISPLAY_INVERT 0xB0
115 REPEAT_FROM_MARK = 0xC4, 115#define HID_GENERIC_DESKTOP_SYSTEM_DISPLAY_INTERNAL 0xB1
116 RETURN_TO_MARK = 0xC5, 116#define HID_GENERIC_DESKTOP_SYSTEM_DISPLAY_EXTERNAL 0xB2
117 SEARCH_MARK_FORWARD = 0xC6, 117#define HID_GENERIC_DESKTOP_SYSTEM_DISPLAY_BOTH 0xB3
118 SEARCH_MARK_BACKWARDS = 0xC7, 118#define HID_GENERIC_DESKTOP_SYSTEM_DISPLAY_DUAL 0xB4
119 COUNTER_RESET = 0xC8, 119#define HID_GENERIC_DESKTOP_SYSTEM_DISPLAY_TOGGLE_INT_EXT 0xB5
120 SHOW_COUNTER = 0xC9, 120#define HID_GENERIC_DESKTOP_SYSTEM_DISPLAY_SWAP_PRIMARY_SECONDARY 0xB6
121 TRACKING_INCREMENT = 0xCA, 121#define HID_GENERIC_DESKTOP_SYSTEM_DISPLAY_LCD_AUTOSCALE 0xB7
122 TRACKING_DECREMENT = 0xCB, 122
123 STOP_EJECT = 0xCC, 123/* Keyboard/Keypad Page (0x07) */
124 PLAY_PAUSE = 0xCD, 124#define HID_KEYBOARD_RESERVED 0x00
125 PLAY_SKIP = 0xCE, 125#define HID_KEYBOARD_ERROR_ROLLOVER 0x01
126 VOLUME = 0xE0, 126#define HID_KEYBOARD_POSTFAIL 0x02
127 BALANCE = 0xE1, 127#define HID_KEYBOARD_ERROR_UNDEFINED 0x03
128 MUTE = 0xE2, 128#define HID_KEYBOARD_A 0x04
129 BASS = 0xE3, 129#define HID_KEYBOARD_B 0x05
130 TREBLE = 0xE4, 130#define HID_KEYBOARD_C 0x06
131 BASS_BOOST = 0xE5, 131#define HID_KEYBOARD_D 0x07
132 SURROUND_MODE = 0xE6, 132#define HID_KEYBOARD_E 0x08
133 LOUDNESS = 0xE7, 133#define HID_KEYBOARD_F 0x09
134 MPX = 0xE8, 134#define HID_KEYBOARD_G 0x0A
135 VOLUME_INCREMENT = 0xE9, 135#define HID_KEYBOARD_H 0x0B
136 VOLUME_DECREMENT = 0xEA, 136#define HID_KEYBOARD_I 0x0C
137 SPEED_SELECT = 0xF0, 137#define HID_KEYBOARD_J 0x0D
138 PLAYBACK_SPEED = 0xF1, 138#define HID_KEYBOARD_K 0x0E
139 STANDARD_PLAY = 0xF2, 139#define HID_KEYBOARD_L 0x0F
140 LONG_PLAY = 0xF3, 140#define HID_KEYBOARD_M 0x10
141 EXTENDED_PLAY = 0xF4, 141#define HID_KEYBOARD_N 0x11
142 SLOW = 0xF5, 142#define HID_KEYBOARD_O 0x12
143 FAN_ENABLE = 0x100, 143#define HID_KEYBOARD_P 0x13
144 FAN_SPEED = 0x101, 144#define HID_KEYBOARD_Q 0x14
145 LIGHT_ENABLE = 0x102, 145#define HID_KEYBOARD_R 0x15
146 LIGHT_ILLUMINATION_LEVEL = 0x103, 146#define HID_KEYBOARD_S 0x16
147 CLIMATE_CONTROL_ENABLE = 0x104, 147#define HID_KEYBOARD_T 0x17
148 ROOM_TEMPERATURE = 0x105, 148#define HID_KEYBOARD_U 0x18
149 SECURITY_ENABLE = 0x106, 149#define HID_KEYBOARD_V 0x19
150 FIRE_ALARM = 0x107, 150#define HID_KEYBOARD_W 0x1A
151 POLICE_ALARM = 0x108, 151#define HID_KEYBOARD_X 0x1B
152 PROXIMITY = 0x109, 152#define HID_KEYBOARD_Y 0x1C
153 MOTION = 0x10A, 153#define HID_KEYBOARD_Z 0x1D
154 DURESS_ALARM = 0x10B, 154#define HID_KEYBOARD_1 0x1E
155 HOLDUP_ALARM = 0x10C, 155#define HID_KEYBOARD_2 0x1F
156 MEDICAL_ALARM = 0x10D, 156#define HID_KEYBOARD_3 0x20
157 BALANCE_RIGHT = 0x150, 157#define HID_KEYBOARD_4 0x21
158 BALANCE_LEFT = 0x151, 158#define HID_KEYBOARD_5 0x22
159 BASS_INCREMENT = 0x152, 159#define HID_KEYBOARD_6 0x23
160 BASS_DECREMENT = 0x153, 160#define HID_KEYBOARD_7 0x24
161 TREBLE_INCREMENT = 0x154, 161#define HID_KEYBOARD_8 0x25
162 TREBLE_DECREMENT = 0x155, 162#define HID_KEYBOARD_9 0x26
163 SPEAKER_SYSTEM = 0x160, 163#define HID_KEYBOARD_0 0x27
164 CHANNEL_LEFT = 0x161, 164#define HID_KEYBOARD_RETURN 0x28
165 CHANNEL_RIGHT = 0x162, 165#define HID_KEYBOARD_ESCAPE 0x29
166 CHANNEL_CENTER = 0x163, 166#define HID_KEYBOARD_DELETE 0x2A
167 CHANNEL_FRONT = 0x164, 167#define HID_KEYBOARD_TAB 0x2B
168 CHANNEL_CENTER_FRONT = 0x165, 168#define HID_KEYBOARD_SPACEBAR 0x2C
169 CHANNEL_SIDE = 0x166, 169#define HID_KEYBOARD_COMMA 0x36
170 CHANNEL_SURROUND = 0x167, 170#define HID_KEYBOARD_DOT 0x37
171 CHANNEL_LOW_FREQUENCY_ENHANCEMENT = 0x168, 171#define HID_KEYBOARD_F1 0x3A
172 CHANNEL_TOP = 0x169, 172#define HID_KEYBOARD_F2 0x3B
173 CHANNEL_UNKNOWN = 0x16A, 173#define HID_KEYBOARD_F3 0x3C
174 SUB_CHANNEL = 0x170, 174#define HID_KEYBOARD_F4 0x3D
175 SUB_CHANNEL_INCREMENT = 0x171, 175#define HID_KEYBOARD_F5 0x3E
176 SUB_CHANNEL_DECREMENT = 0x172, 176#define HID_KEYBOARD_F6 0x3F
177 ALTERNATE_AUDIO_INCREMENT = 0x173, 177#define HID_KEYBOARD_F7 0x40
178 ALTERNATE_AUDIO_DECREMENT = 0x174, 178#define HID_KEYBOARD_F8 0x41
179 APPLICATION_LAUNCH_BUTTONS = 0x180, 179#define HID_KEYBOARD_F9 0x42
180 AL_LAUNCH_BUTTON_CONFIGURATION_TOOL = 0x181, 180#define HID_KEYBOARD_F10 0x43
181 AL_PROGRAMMABLE_BUTTON_CONFIGUARTION = 0x182, 181#define HID_KEYBOARD_F11 0x44
182 AL_CONSUMER_CONTROL_CONFIGURATION = 0x183, 182#define HID_KEYBOARD_F12 0x45
183 AL_WORD_PROCESSOR = 0x184, 183#define HID_KEYBOARD_PRINT_SCREEN 0x46
184 AL_TEXT_EDITOR = 0x185, 184#define HID_KEYBOARD_SCROLL_LOCK 0x47
185 AL_SPREADSHEET = 0x186, 185#define HID_KEYBOARD_PAUSE 0x48
186 AL_GRAPHICS_EDITOR = 0x187, 186#define HID_KEYBOARD_INSERT 0x49
187 AL_PRESENTATION_APP = 0x188, 187#define HID_KEYBOARD_HOME 0x4A
188 AL_DATABASE_APP = 0x189, 188#define HID_KEYBOARD_PAGE_UP 0x4B
189 AL_EMAIL_READER = 0x18A, 189#define HID_KEYBOARD_DELETE_FORWARD 0x4C
190 AL_NEWSREADER = 0x18B, 190#define HID_KEYBOARD_END 0x4D
191 AL_VOICEMAIL = 0x18C, 191#define HID_KEYBOARD_PAGE_DOWN 0x4E
192 AL_CONTACTS_ADDRESS_BOOK = 0x18D, 192#define HID_KEYBOARD_RIGHT_ARROW 0x4F
193 AL_CALENDAR_SCHEDULE = 0x18E, 193#define HID_KEYBOARD_LEFT_ARROW 0x50
194 AL_TASK_PROJECT_MANAGER = 0x18F, 194#define HID_KEYBOARD_DOWN_ARROW 0x51
195 AL_LOG_JOURNAL_TIMECARD = 0x190, 195#define HID_KEYBOARD_UP_ARROW 0x52
196 AL_CHECKBOOK_FINANCE = 0x191, 196#define HID_KEYPAD_NUM_LOCK_AND_CLEAR 0x53
197 AL_CALCULATOR = 0x192, 197#define HID_KEYPAD_SLASH 0x54
198 AL_A_V_CAPTURE_PLAYBACK = 0x193, 198#define HID_KEYPAD_ASTERISK 0x55
199 AL_LOCAL_MACHINE_BROWSER = 0x194, 199#define HID_KEYPAD_MINUS 0x56
200 AL_LAN_WAN_BROWSER = 0x195, 200#define HID_KEYPAD_PLUS 0x57
201 AL_INTERNET_BROWSER = 0x196, 201#define HID_KEYPAD_ENTER 0x58
202 AL_REMOTE_NETWORKING_ISP_CONNECT = 0x197, 202#define HID_KEYPAD_1_AND_END 0x59
203 AL_NETWORK_CONFERENCE = 0x198, 203#define HID_KEYPAD_2_AND_DOWN_ARROW 0x5A
204 AL_NETWORK_CHAT = 0x199, 204#define HID_KEYPAD_3_AND_PAGE_DOWN 0x5B
205 AL_TELEPHONY_DIALER = 0x19A, 205#define HID_KEYPAD_4_AND_LEFT_ARROW 0x5C
206 AL_LOGON = 0x19B, 206#define HID_KEYPAD_5 0x5D
207 AL_LOGOFF = 0x19C, 207#define HID_KEYPAD_6_AND_RIGHT_ARROW 0x5E
208 AL_LOGON_LOGOFF = 0x19D, 208#define HID_KEYPAD_7_AND_HOME 0x5F
209 AL_TERMINAL_LOCK_SCREENSAVER = 0x19E, 209#define HID_KEYPAD_8_AND_UP_ARROW 0x60
210 AL_CONTROL_PANEL = 0x19F, 210#define HID_KEYPAD_9_AND_PAGE_UP 0x61
211 AL_COMMAND_LINE_PROCESSOR_RUN = 0x1A0, 211#define HID_KEYPAD_0_AND_INSERT 0x62
212 AL_PROCESS_TASK_MANAGER = 0x1A1, 212#define HID_KEYPAD_PERIOD_AND_DELETE 0x63
213 AL_SELECT_TASK_APPLICATION = 0x1A2, 213#define HID_KEYBOARD_APPLICATION 0x65
214 AL_NEXT_TASK_APPLICATION = 0x1A3, 214#define HID_KEYBOARD_POWER 0x66
215 AL_PREVIOUS_TASK_APPLICATION = 0x1A4, 215#define HID_KEYPAD_EQUAL 0x67
216 AL_PREEMPTIVE_HALT_TASK_APPLICATION = 0x1A5, 216#define HID_KEYBOARD_F13 0x68
217 AL_INTEGRATED_HELP_CENTER = 0x1A6, 217#define HID_KEYBOARD_F14 0x69
218 AL_DOCUMENTS = 0x1A7, 218#define HID_KEYBOARD_F15 0x6A
219 AL_THESAURUS = 0x1A8, 219#define HID_KEYBOARD_F16 0x6B
220 AL_DICTIONARY = 0x1A9, 220#define HID_KEYBOARD_F17 0x6C
221 AL_DESKTOP = 0x1AA, 221#define HID_KEYBOARD_F18 0x6D
222 AL_SPELL_CHECK = 0x1AB, 222#define HID_KEYBOARD_F19 0x6E
223 AL_GRAMMAR_CHECK = 0x1AC, 223#define HID_KEYBOARD_F20 0x6F
224 AL_WIRELESS_STATUS = 0x1AD, 224#define HID_KEYBOARD_F21 0x70
225 AL_KEYBOARD_LAYOUT = 0x1AE, 225#define HID_KEYBOARD_F22 0x71
226 AL_VIRUS_PROTECTION = 0x1AF, 226#define HID_KEYBOARD_F23 0x72
227 AL_ENCRYPTION = 0x1B0, 227#define HID_KEYBOARD_F24 0x73
228 AL_SCREEN_SAVER = 0x1B1, 228#define HID_KEYBOARD_EXECUTE 0x74
229 AL_ALARMS = 0x1B2, 229#define HID_KEYBOARD_HELP 0x75
230 AL_CLOCK = 0x1B3, 230#define HID_KEYBOARD_MENU 0x76
231 AL_FILE_BROWSER = 0x1B4, 231#define HID_KEYBOARD_SELECT 0x77
232 AL_POWER_STATUS = 0x1B5, 232#define HID_KEYBOARD_STOP 0x78
233 AL_IMAGE_BROWSER = 0x1B6, 233#define HID_KEYBOARD_AGAIN 0x79
234 AL_AUDIO_BROWSER = 0x1B7, 234#define HID_KEYBOARD_UNDO 0x7A
235 AL_MOVIE_BROWSER = 0x1B8, 235#define HID_KEYBOARD_CUT 0x7B
236 AL_DIGITAL_RIGHTS_MANAGER = 0x1B9, 236#define HID_KEYBOARD_COPY 0x7C
237 AL_DIGITAL_WALLET = 0x1BA, 237#define HID_KEYBOARD_PASTE 0x7D
238 AL_INSTANT_MESSAGING = 0x1BC, 238#define HID_KEYBOARD_FIND 0x7E
239 AL_OEM_FEATURES_TIPS_TUTORIAL_BROWSER = 0x1BD, 239#define HID_KEYBOARD_MUTE 0x7F
240 AL_OEM_HELP = 0x1BE, 240#define HID_KEYBOARD_VOLUME_UP 0x80
241 AL_ONLINE_COMMUNITY = 0x1BF, 241#define HID_KEYBOARD_VOLUME_DOWN 0x81
242 AL_ENTERTAINMENT_CONTENT_BROWSER = 0x1C0, 242#define HID_KEYBOARD_LOCKING_CAPS_LOCK 0x82
243 AL_ONLINE_SHOPPING_BROWSER = 0x1C1, 243#define HID_KEYBOARD_LOCKING_NUM_LOCK 0x83
244 AL_SMARTCARD_INFORMATION_HELP = 0x1C2, 244#define HID_KEYBOARD_LOCKING_SCROLL_LOCK 0x84
245 AL_MARKET_MONITOR_FINANCE_BROWSER = 0x1C3, 245#define HID_KEYPAD_COMMA 0x85
246 AL_CUSTOMIZED_CORPORATE_NEWS_BROWSER = 0x1C4, 246#define HID_KEYPAD_EQUAL_SIGN 0x86
247 AL_ONLINE_ACTIVITY_BROWSER = 0x1C5, 247#define HID_KEYBOARD_EX_SEL 0xA4
248 AL_RESEARCH_SEARCH_BROWSER = 0x1C6, 248#define HID_KEYBOARD_LEFT_CONTROL 0xE0
249 AL_AUDIO_PLAYER = 0x1C7, 249#define HID_KEYBOARD_LEFT_SHIFT 0xE1
250 GENERIC_GUI_APPLICATION_CONTROLS = 0x200, 250#define HID_KEYBOARD_LEFT_ALT 0xE2
251 AC_NEW = 0x201, 251#define HID_KEYBOARD_LEFT_GUI 0xE3
252 AC_OPEN = 0x202, 252#define HID_KEYBOARD_RIGHT_CONTROL 0xE4
253 AC_CLOSE = 0x203, 253#define HID_KEYBOARD_RIGHT_SHIFT 0xE5
254 AC_EXIT = 0x204, 254#define HID_KEYBOARD_RIGHT_ALT 0xE6
255 AC_MAXIMIZE = 0x205, 255#define HID_KEYBOARD_RIGHT_GUI 0xE7
256 AC_MINIMIZE = 0x206, 256
257 AC_SAVE = 0x207, 257/* LED Page (0x08) */
258 AC_PRINT = 0x208, 258#define HID_LED_UNDEFINED 0x00
259 AC_PROPERTIES = 0x209, 259#define HID_LED_NUM_LOCK 0x01
260 AC_UNDO = 0x21A, 260#define HID_LED_CAPS_LOCK 0x02
261 AC_COPY = 0x21B, 261#define HID_LED_SCROLL_LOCK 0x03
262 AC_CUT = 0x21C, 262#define HID_LED_COMPOSE 0x04
263 AC_PASTE = 0x21D, 263#define HID_LED_KANA 0x05
264 AC_SELECT_ALL = 0x21E, 264#define HID_LED_POWER 0x06
265 AC_FIND = 0x21F, 265#define HID_LED_SHIFT 0x07
266 AC_FIND_AND_REPLACE = 0x220, 266#define HID_LED_DO_NOT_DISTURB 0x08
267 AC_SEARCH = 0x221, 267#define HID_LED_MUTE 0x09
268 AC_GO_TO = 0x222, 268#define HID_LED_TONE_ENABLE 0x0A
269 AC_HOME = 0x223, 269#define HID_LED_HIGH_CUT_FILTER 0x0B
270 AC_BACK = 0x224, 270#define HID_LED_LOW_CUT_FILTER 0x0C
271 AC_FORWARD = 0x225, 271#define HID_LED_EQUALIZER_ENABLE 0x0D
272 AC_STOP = 0x226, 272#define HID_LED_SOUND_FIELD_ON 0x0E
273 AC_REFRESH = 0x227, 273#define HID_LED_SURROUND_ON 0x0F
274 AC_PREVIOUS_LINK = 0x228, 274#define HID_LED_REPEAT 0x10
275 AC_NEXT_LINK = 0x229, 275#define HID_LED_STEREO 0x11
276 AC_BOOKMARKS = 0x22A, 276#define HID_LED_SAMPLING_RATE_DETECT 0x12
277 AC_HISTORY = 0x22B, 277#define HID_LED_SPINNING 0x13
278 AC_SUBSCRIPTIONS = 0x22C, 278#define HID_LED_CAV 0x14
279 AC_ZOOM_IN = 0x22D, 279#define HID_LED_CLV 0x15
280 AC_ZOOM_OUT = 0x22E, 280#define HID_LED_RECORDING_FORMAT_DETECT 0x16
281 AC_ZOOM = 0x22F, 281#define HID_LED_OFF_HOOK 0x17
282 AC_FULL_SCREEN_VIEW = 0x230, 282#define HID_LED_RING 0x18
283 AC_NORMAL_VIEW = 0x231, 283#define HID_LED_MESSAGE_WAITING 0x19
284 AC_VIEW_TOGGLE = 0x232, 284#define HID_LED_DATA_MODE 0x1A
285 AC_SCROLL_UP = 0x233, 285#define HID_LED_BATTERY_OPERATION 0x1B
286 AC_SCROLL_DOWN = 0x234, 286#define HID_LED_BATTERY_OK 0x1C
287 AC_SCROLL = 0x235, 287#define HID_LED_BATTERY_LOW 0x1D
288 AC_PAN_LEFT = 0x236, 288#define HID_LED_SPEAKER 0x1E
289 AC_PAN_RIGHT = 0x237, 289#define HID_LED_HEAD_SET 0x1F
290 AC_PAN = 0x238, 290#define HID_LED_HOLD 0x20
291 AC_NEW_WINDOW = 0x239, 291#define HID_LED_MICROPHONE 0x21
292 AC_TILE_HORIZONTALLY = 0x23A, 292#define HID_LED_COVERAGE 0x22
293 AC_TILE_VERTICALLY = 0x23B, 293#define HID_LED_NIGHT_MODE 0x23
294 AC_FORMAT = 0x23C, 294#define HID_LED_SEND_CALLS 0x24
295 AC_EDIT = 0x23D, 295#define HID_LED_CALL_PICKUP 0x25
296 AC_BOLD = 0x23E, 296#define HID_LED_CONFERENCE 0x26
297 AC_ITALICS = 0x23F, 297#define HID_LED_STAND_BY 0x27
298 AC_UNDERLINE = 0x240, 298#define HID_LED_CAMERA_ON 0x28
299 AC_STRIKETHROUGH = 0x241, 299#define HID_LED_CAMERA_OFF 0x29
300 AC_SUBSCRIPT = 0x242, 300#define HID_LED_ON_LINE 0x2A
301 AC_SUPERSCRIPT = 0x243, 301#define HID_LED_OFF_LINE 0x2B
302 AC_ALL_CAPS = 0x244, 302#define HID_LED_BUSY 0x2C
303 AC_ROTATE = 0x245, 303#define HID_LED_READY 0x2D
304 AC_RESIZE = 0x246, 304#define HID_LED_PAPER_OUT 0x2E
305 AC_FLIP_HORIZONTAL = 0x247, 305#define HID_LED_PAPER_JAM 0x2F
306 AC_FLIP_VERTICAL = 0x248, 306#define HID_LED_REMOTE 0x30
307 AC_MIRROR_HORIZONTAL = 0x249, 307#define HID_LED_FORWARD 0x31
308 AC_MIRROR_VERTICAL = 0x24A, 308#define HID_LED_REVERSE 0x32
309 AC_FONT_SELECT = 0x24B, 309#define HID_LED_STOP 0x33
310 AC_FONT_COLOR = 0x24C, 310#define HID_LED_REWIND 0x34
311 AC_FONT_SIZE = 0x24D, 311#define HID_LED_FAST_FORWARD 0x35
312 AC_JUSTIFY_LEFT = 0x24E, 312#define HID_LED_PLAY 0x36
313 AC_JUSTIFY_CENTER_H = 0x24F, 313#define HID_LED_PAUSE 0x37
314 AC_JUSTIFY_RIGHT = 0x250, 314#define HID_LED_RECORD 0x38
315 AC_JUSTIFY_BLOCK_H = 0x251, 315#define HID_LED_ERROR 0x39
316 AC_JUSTIFY_TOP = 0x252, 316#define HID_LED_USAGE_SELECTED_INDICATOR 0x3A
317 AC_JUSTIFY_CENTER_V = 0x253, 317#define HID_LED_USAGE_IN_USE_INDICATOR 0x3B
318 AC_JUSTIFY_BOTTOM = 0x254, 318#define HID_LED_USAGE_MULTI_MODE_INDICATOR 0x3C
319 AC_JUSTIFY_BLOCK_V = 0x255, 319#define HID_LED_INDICATOR_ON 0x3D
320 AC_INDENT_DECREASE = 0x256, 320#define HID_LED_INDICATOR_FLASH 0x3E
321 AC_INDENT_INCREASE = 0x257, 321#define HID_LED_INDICATOR_SLOW_BLINK 0x3F
322 AC_NUMBERED_LIST = 0x258, 322#define HID_LED_INDICATOR_FAST_BLINK 0x40
323 AC_RESTART_NUMBERING = 0x259, 323#define HID_LED_INDICATOR_OFF 0x41
324 AC_BULLETED_LIST = 0x25A, 324#define HID_LED_FLASH_ON_TIME 0x42
325 AC_PROMOTE = 0x25B, 325#define HID_LED_SLOW_BLINK_ON_TIME 0x43
326 AC_DEMOTE = 0x25C, 326#define HID_LED_SLOW_BLINK_OFF_TIME 0x44
327 AC_YES = 0x25D, 327#define HID_LED_FAST_BLINK_ON_TIME 0x45
328 AC_NO = 0x25E, 328#define HID_LED_FAST_BLINK_OFF_TIME 0x46
329 AC_CANCEL = 0x25F, 329#define HID_LED_USAGE_INDICATOR_COLOR 0x47
330 AC_CATALOG = 0x260, 330#define HID_LED_INDICATOR_RED 0x48
331 AC_BUY_CHECKOUT = 0x261, 331#define HID_LED_INDICATOR_GREEN 0x49
332 AC_ADD_TO_CART = 0x262, 332#define HID_LED_INDICATOR_AMBER 0x4A
333 AC_EXPAND = 0x263, 333#define HID_LED_GENERIC_INDICATOR 0x4B
334 AC_EXPAND_ALL = 0x264, 334#define HID_LED_SYSTEM_SUSPEND 0x4C
335 AC_COLLAPSE = 0x265, 335#define HID_LED_EXTERNAL_POWER_CONNECTED 0x4D
336 AC_COLLAPSE_ALL = 0x266, 336
337 AC_PRINT_PREVIEW = 0x267, 337/* Consumer Page (0x0C) */
338 AC_PASTE_SPECIAL = 0x268, 338#define HID_CONSUMER_USAGE_UNASSIGNED 0x00
339 AC_INSERT_MODE = 0x269, 339#define HID_CONSUMER_USAGE_CONSUMER_CONTROL 0x1
340 AC_DELETE = 0x26A, 340#define HID_CONSUMER_USAGE_NUMERIC_KEY_PAD 0x2
341 AC_LOCK = 0x26B, 341#define HID_CONSUMER_USAGE_PROGRAMMABLE_BUTTONS 0x3
342 AC_UNLOCK = 0x26C, 342#define HID_CONSUMER_USAGE_MICROPHONE 0x4
343 AC_PROTECT = 0x26D, 343#define HID_CONSUMER_USAGE_HEADPHONE 0x5
344 AC_UNPROTECT = 0x26E, 344#define HID_CONSUMER_USAGE_GRAPHIC_EQUALIZER 0x6
345 AC_ATTACH_COMMENT = 0x26F, 345#define HID_CONSUMER_USAGE_PLUS_10 0x20
346 AC_DELETE_COMMENT = 0x270, 346#define HID_CONSUMER_USAGE_PLUS_100 0x21
347 AC_VIEW_COMMENT = 0x271, 347#define HID_CONSUMER_USAGE_AM_PM 0x22
348 AC_SELECT_WORD = 0x272, 348#define HID_CONSUMER_USAGE_POWER 0x30
349 AC_SELECT_SENTENCE = 0x273, 349#define HID_CONSUMER_USAGE_RESET 0x31
350 AC_SELECT_PARAGRAPH = 0x274, 350#define HID_CONSUMER_USAGE_SLEEP 0x32
351 AC_SELECT_COLUMN = 0x275, 351#define HID_CONSUMER_USAGE_SLEEP_AFTER 0x33
352 AC_SELECT_ROW = 0x276, 352#define HID_CONSUMER_USAGE_SLEEP_MODE 0x34
353 AC_SELECT_TABLE = 0x277, 353#define HID_CONSUMER_USAGE_ILLUMINATION 0x35
354 AC_SELECT_OBJECT = 0x278, 354#define HID_CONSUMER_USAGE_FUNCTION_BUTTONS 0x36
355 AC_REDO_REPEAT = 0x279, 355#define HID_CONSUMER_USAGE_MENU 0x40
356 AC_SORT = 0x27A, 356#define HID_CONSUMER_USAGE_MENU_PICK 0x41
357 AC_SORT_ASCENDING = 0x27B, 357#define HID_CONSUMER_USAGE_MENU_UP 0x42
358 AC_SORT_DESCENDING = 0x27C, 358#define HID_CONSUMER_USAGE_MENU_DOWN 0x43
359 AC_FILTER = 0x27D, 359#define HID_CONSUMER_USAGE_MENU_LEFT 0x44
360 AC_SET_CLOCK = 0x27E, 360#define HID_CONSUMER_USAGE_MENU_RIGHT 0x45
361 AC_VIEW_CLOCK = 0x27F, 361#define HID_CONSUMER_USAGE_MENU_ESCAPE 0x46
362 AC_SELECT_TIME_ZONE = 0x280, 362#define HID_CONSUMER_USAGE_MENU_VALUE_INCREASE 0x47
363 AC_EDIT_TIME_ZONES = 0x281, 363#define HID_CONSUMER_USAGE_MENU_VALUE_DECREASE 0x48
364 AC_SET_ALARM = 0x282, 364#define HID_CONSUMER_USAGE_DATA_ON_SCREEN 0x60
365 AC_CLEAR_ALARM = 0x283, 365#define HID_CONSUMER_USAGE_CLOSED_CAPTION 0x61
366 AC_SNOOZE_ALARM = 0x284, 366#define HID_CONSUMER_USAGE_CLOSED_CAPTION_SELECT 0x62
367 AC_RESET_ALARM = 0x285, 367#define HID_CONSUMER_USAGE_VCR_TV 0x63
368 AC_SYNCHRONIZE = 0x286, 368#define HID_CONSUMER_USAGE_BROADCAST_MODE 0x64
369 AC_SEND_RECEIVE = 0x287, 369#define HID_CONSUMER_USAGE_SNAPSHOT 0x65
370 AC_SEND_TO = 0x288, 370#define HID_CONSUMER_USAGE_STILL 0x66
371 AC_REPLY = 0x289, 371#define HID_CONSUMER_USAGE_SELECTION 0x80
372 AC_REPLY_ALL = 0x28A, 372#define HID_CONSUMER_USAGE_ASSIGN_SELECTION 0x81
373 AC_FORWARD_MSG = 0x28B, 373#define HID_CONSUMER_USAGE_MODE_STEP 0x82
374 AC_SEND = 0x28C, 374#define HID_CONSUMER_USAGE_RECALL_LAST 0x83
375 AC_ATTACH_FILE = 0x28D, 375#define HID_CONSUMER_USAGE_ENTER_CHANNEL 0x84
376 AC_UPLOAD = 0x28E, 376#define HID_CONSUMER_USAGE_ORDER_MOVIE 0x85
377 AC_DOWNLOAD_SAVE_TARGET_AS = 0x28F, 377#define HID_CONSUMER_USAGE_CHANNEL 0x86
378 AC_SET_BORDERS = 0x290, 378#define HID_CONSUMER_USAGE_MEDIA_SELECTION 0x87
379 AC_INSERT_ROW = 0x291, 379#define HID_CONSUMER_USAGE_MEDIA_SELECT_COMPUTER 0x88
380 AC_INSERT_COLUMN = 0x292, 380#define HID_CONSUMER_USAGE_MEDIA_SELECT_TV 0x89
381 AC_INSERT_FILE = 0x293, 381#define HID_CONSUMER_USAGE_MEDIA_SELECT_WWW 0x8A
382 AC_INSERT_PICTURE = 0x294, 382#define HID_CONSUMER_USAGE_MEDIA_SELECT_DVD 0x8B
383 AC_INSERT_OBJECT = 0x295, 383#define HID_CONSUMER_USAGE_MEDIA_SELECT_TELEPHONE 0x8C
384 AC_INSERT_SYMBOL = 0x296, 384#define HID_CONSUMER_USAGE_MEDIA_SELECT_PROGRAM_GUIDE 0x8D
385 AC_SAVE_AND_CLOSE = 0x297, 385#define HID_CONSUMER_USAGE_MEDIA_SELECT_VIDEO_PHONE 0x8E
386 AC_RENAME = 0x298, 386#define HID_CONSUMER_USAGE_MEDIA_SELECT_GAMES 0x8F
387 AC_MERGE = 0x299, 387#define HID_CONSUMER_USAGE_MEDIA_SELECT_MESSAGES 0x90
388 AC_SPLIT = 0x29A, 388#define HID_CONSUMER_USAGE_MEDIA_SELECT_CD 0x91
389 AC_DISRIBUTE_HORIZONTALLY = 0x29B, 389#define HID_CONSUMER_USAGE_MEDIA_SELECT_VCR 0x92
390 AC_DISTRIBUTE_VERTICALLY = 0x29C, 390#define HID_CONSUMER_USAGE_MEDIA_SELECT_TUNER 0x93
391} consumer_usage_page_t; 391#define HID_CONSUMER_USAGE_QUIT 0x94
392#define HID_CONSUMER_USAGE_HELP 0x95
393#define HID_CONSUMER_USAGE_MEDIA_SELECT_TAPE 0x96
394#define HID_CONSUMER_USAGE_MEDIA_SELECT_CABLE 0x97
395#define HID_CONSUMER_USAGE_MEDIA_SELECT_SATELLITE 0x98
396#define HID_CONSUMER_USAGE_MEDIA_SELECT_SECURITY 0x99
397#define HID_CONSUMER_USAGE_MEDIA_SELECT_HOME 0x9A
398#define HID_CONSUMER_USAGE_MEDIA_SELECT_CALL 0x9B
399#define HID_CONSUMER_USAGE_CHANNEL_INCREMENT 0x9C
400#define HID_CONSUMER_USAGE_CHANNEL_DECREMENT 0x9D
401#define HID_CONSUMER_USAGE_MEDIA_SELECT_SAP 0x9E
402#define HID_CONSUMER_USAGE_VCR_PLUS 0xA0
403#define HID_CONSUMER_USAGE_ONCE 0xA1
404#define HID_CONSUMER_USAGE_DAILY 0xA2
405#define HID_CONSUMER_USAGE_WEEKLY 0xA3
406#define HID_CONSUMER_USAGE_MONTHLY 0xA4
407#define HID_CONSUMER_USAGE_PLAY 0xB0
408#define HID_CONSUMER_USAGE_PAUSE 0xB1
409#define HID_CONSUMER_USAGE_RECORD 0xB2
410#define HID_CONSUMER_USAGE_FAST_FORWARD 0xB3
411#define HID_CONSUMER_USAGE_REWIND 0xB4
412#define HID_CONSUMER_USAGE_SCAN_NEXT_TRACK 0xB5
413#define HID_CONSUMER_USAGE_SCAN_PREVIOUS_TRACK 0xB6
414#define HID_CONSUMER_USAGE_STOP 0xB7
415#define HID_CONSUMER_USAGE_EJECT 0xB8
416#define HID_CONSUMER_USAGE_RANDOM_PLAY 0xB9
417#define HID_CONSUMER_USAGE_SELECT_DISC 0xBA
418#define HID_CONSUMER_USAGE_ENTER_DISC 0xBB
419#define HID_CONSUMER_USAGE_REPEAT 0xBC
420#define HID_CONSUMER_USAGE_TRACKING 0xBD
421#define HID_CONSUMER_USAGE_TRACK_NORMAL 0xBE
422#define HID_CONSUMER_USAGE_SLOW_TRACKING 0xBF
423#define HID_CONSUMER_USAGE_FRAME_FORWARD 0xC0
424#define HID_CONSUMER_USAGE_FRAME_BACK 0xC1
425#define HID_CONSUMER_USAGE_MARK 0xC2
426#define HID_CONSUMER_USAGE_CLEAR_MARK 0xC3
427#define HID_CONSUMER_USAGE_REPEAT_FROM_MARK 0xC4
428#define HID_CONSUMER_USAGE_RETURN_TO_MARK 0xC5
429#define HID_CONSUMER_USAGE_SEARCH_MARK_FORWARD 0xC6
430#define HID_CONSUMER_USAGE_SEARCH_MARK_BACKWARDS 0xC7
431#define HID_CONSUMER_USAGE_COUNTER_RESET 0xC8
432#define HID_CONSUMER_USAGE_SHOW_COUNTER 0xC9
433#define HID_CONSUMER_USAGE_TRACKING_INCREMENT 0xCA
434#define HID_CONSUMER_USAGE_TRACKING_DECREMENT 0xCB
435#define HID_CONSUMER_USAGE_STOP_EJECT 0xCC
436#define HID_CONSUMER_USAGE_PLAY_PAUSE 0xCD
437#define HID_CONSUMER_USAGE_PLAY_SKIP 0xCE
438#define HID_CONSUMER_USAGE_VOLUME 0xE0
439#define HID_CONSUMER_USAGE_BALANCE 0xE1
440#define HID_CONSUMER_USAGE_MUTE 0xE2
441#define HID_CONSUMER_USAGE_BASS 0xE3
442#define HID_CONSUMER_USAGE_TREBLE 0xE4
443#define HID_CONSUMER_USAGE_BASS_BOOST 0xE5
444#define HID_CONSUMER_USAGE_SURROUND_MODE 0xE6
445#define HID_CONSUMER_USAGE_LOUDNESS 0xE7
446#define HID_CONSUMER_USAGE_MPX 0xE8
447#define HID_CONSUMER_USAGE_VOLUME_INCREMENT 0xE9
448#define HID_CONSUMER_USAGE_VOLUME_DECREMENT 0xEA
449#define HID_CONSUMER_USAGE_SPEED_SELECT 0xF0
450#define HID_CONSUMER_USAGE_PLAYBACK_SPEED 0xF1
451#define HID_CONSUMER_USAGE_STANDARD_PLAY 0xF2
452#define HID_CONSUMER_USAGE_LONG_PLAY 0xF3
453#define HID_CONSUMER_USAGE_EXTENDED_PLAY 0xF4
454#define HID_CONSUMER_USAGE_SLOW 0xF5
455#define HID_CONSUMER_USAGE_FAN_ENABLE 0x100
456#define HID_CONSUMER_USAGE_FAN_SPEED 0x101
457#define HID_CONSUMER_USAGE_LIGHT_ENABLE 0x102
458#define HID_CONSUMER_USAGE_LIGHT_ILLUMINATION_LEVEL 0x103
459#define HID_CONSUMER_USAGE_CLIMATE_CONTROL_ENABLE 0x104
460#define HID_CONSUMER_USAGE_ROOM_TEMPERATURE 0x105
461#define HID_CONSUMER_USAGE_SECURITY_ENABLE 0x106
462#define HID_CONSUMER_USAGE_FIRE_ALARM 0x107
463#define HID_CONSUMER_USAGE_POLICE_ALARM 0x108
464#define HID_CONSUMER_USAGE_PROXIMITY 0x109
465#define HID_CONSUMER_USAGE_MOTION 0x10A
466#define HID_CONSUMER_USAGE_DURESS_ALARM 0x10B
467#define HID_CONSUMER_USAGE_HOLDUP_ALARM 0x10C
468#define HID_CONSUMER_USAGE_MEDICAL_ALARM 0x10D
469#define HID_CONSUMER_USAGE_BALANCE_RIGHT 0x150
470#define HID_CONSUMER_USAGE_BALANCE_LEFT 0x151
471#define HID_CONSUMER_USAGE_BASS_INCREMENT 0x152
472#define HID_CONSUMER_USAGE_BASS_DECREMENT 0x153
473#define HID_CONSUMER_USAGE_TREBLE_INCREMENT 0x154
474#define HID_CONSUMER_USAGE_TREBLE_DECREMENT 0x155
475#define HID_CONSUMER_USAGE_SPEAKER_SYSTEM 0x160
476#define HID_CONSUMER_USAGE_CHANNEL_LEFT 0x161
477#define HID_CONSUMER_USAGE_CHANNEL_RIGHT 0x162
478#define HID_CONSUMER_USAGE_CHANNEL_CENTER 0x163
479#define HID_CONSUMER_USAGE_CHANNEL_FRONT 0x164
480#define HID_CONSUMER_USAGE_CHANNEL_CENTER_FRONT 0x165
481#define HID_CONSUMER_USAGE_CHANNEL_SIDE 0x166
482#define HID_CONSUMER_USAGE_CHANNEL_SURROUND 0x167
483#define HID_CONSUMER_USAGE_CHANNEL_LOW_FREQUENCY_ENHANCEMENT 0x168
484#define HID_CONSUMER_USAGE_CHANNEL_TOP 0x169
485#define HID_CONSUMER_USAGE_CHANNEL_UNKNOWN 0x16A
486#define HID_CONSUMER_USAGE_SUB_CHANNEL 0x170
487#define HID_CONSUMER_USAGE_SUB_CHANNEL_INCREMENT 0x171
488#define HID_CONSUMER_USAGE_SUB_CHANNEL_DECREMENT 0x172
489#define HID_CONSUMER_USAGE_ALTERNATE_AUDIO_INCREMENT 0x173
490#define HID_CONSUMER_USAGE_ALTERNATE_AUDIO_DECREMENT 0x174
491#define HID_CONSUMER_USAGE_APPLICATION_LAUNCH_BUTTONS 0x180
492#define HID_CONSUMER_USAGE_AL_LAUNCH_BUTTON_CONFIGURATION_TOOL 0x181
493#define HID_CONSUMER_USAGE_AL_PROGRAMMABLE_BUTTON_CONFIGUARTION 0x182
494#define HID_CONSUMER_USAGE_AL_CONSUMER_CONTROL_CONFIGURATION 0x183
495#define HID_CONSUMER_USAGE_AL_WORD_PROCESSOR 0x184
496#define HID_CONSUMER_USAGE_AL_TEXT_EDITOR 0x185
497#define HID_CONSUMER_USAGE_AL_SPREADSHEET 0x186
498#define HID_CONSUMER_USAGE_AL_GRAPHICS_EDITOR 0x187
499#define HID_CONSUMER_USAGE_AL_PRESENTATION_APP 0x188
500#define HID_CONSUMER_USAGE_AL_DATABASE_APP 0x189
501#define HID_CONSUMER_USAGE_AL_EMAIL_READER 0x18A
502#define HID_CONSUMER_USAGE_AL_NEWSREADER 0x18B
503#define HID_CONSUMER_USAGE_AL_VOICEMAIL 0x18C
504#define HID_CONSUMER_USAGE_AL_CONTACTS_ADDRESS_BOOK 0x18D
505#define HID_CONSUMER_USAGE_AL_CALENDAR_SCHEDULE 0x18E
506#define HID_CONSUMER_USAGE_AL_TASK_PROJECT_MANAGER 0x18F
507#define HID_CONSUMER_USAGE_AL_LOG_JOURNAL_TIMECARD 0x190
508#define HID_CONSUMER_USAGE_AL_CHECKBOOK_FINANCE 0x191
509#define HID_CONSUMER_USAGE_AL_CALCULATOR 0x192
510#define HID_CONSUMER_USAGE_AL_A_V_CAPTURE_PLAYBACK 0x193
511#define HID_CONSUMER_USAGE_AL_LOCAL_MACHINE_BROWSER 0x194
512#define HID_CONSUMER_USAGE_AL_LAN_WAN_BROWSER 0x195
513#define HID_CONSUMER_USAGE_AL_INTERNET_BROWSER 0x196
514#define HID_CONSUMER_USAGE_AL_REMOTE_NETWORKING_ISP_CONNECT 0x197
515#define HID_CONSUMER_USAGE_AL_NETWORK_CONFERENCE 0x198
516#define HID_CONSUMER_USAGE_AL_NETWORK_CHAT 0x199
517#define HID_CONSUMER_USAGE_AL_TELEPHONY_DIALER 0x19A
518#define HID_CONSUMER_USAGE_AL_LOGON 0x19B
519#define HID_CONSUMER_USAGE_AL_LOGOFF 0x19C
520#define HID_CONSUMER_USAGE_AL_LOGON_LOGOFF 0x19D
521#define HID_CONSUMER_USAGE_AL_TERMINAL_LOCK_SCREENSAVER 0x19E
522#define HID_CONSUMER_USAGE_AL_CONTROL_PANEL 0x19F
523#define HID_CONSUMER_USAGE_AL_COMMAND_LINE_PROCESSOR_RUN 0x1A0
524#define HID_CONSUMER_USAGE_AL_PROCESS_TASK_MANAGER 0x1A1
525#define HID_CONSUMER_USAGE_AL_SELECT_TASK_APPLICATION 0x1A2
526#define HID_CONSUMER_USAGE_AL_NEXT_TASK_APPLICATION 0x1A3
527#define HID_CONSUMER_USAGE_AL_PREVIOUS_TASK_APPLICATION 0x1A4
528#define HID_CONSUMER_USAGE_AL_PREEMPTIVE_HALT_TASK_APPLICATION 0x1A5
529#define HID_CONSUMER_USAGE_AL_INTEGRATED_HELP_CENTER 0x1A6
530#define HID_CONSUMER_USAGE_AL_DOCUMENTS 0x1A7
531#define HID_CONSUMER_USAGE_AL_THESAURUS 0x1A8
532#define HID_CONSUMER_USAGE_AL_DICTIONARY 0x1A9
533#define HID_CONSUMER_USAGE_AL_DESKTOP 0x1AA
534#define HID_CONSUMER_USAGE_AL_SPELL_CHECK 0x1AB
535#define HID_CONSUMER_USAGE_AL_GRAMMAR_CHECK 0x1AC
536#define HID_CONSUMER_USAGE_AL_WIRELESS_STATUS 0x1AD
537#define HID_CONSUMER_USAGE_AL_KEYBOARD_LAYOUT 0x1AE
538#define HID_CONSUMER_USAGE_AL_VIRUS_PROTECTION 0x1AF
539#define HID_CONSUMER_USAGE_AL_ENCRYPTION 0x1B0
540#define HID_CONSUMER_USAGE_AL_SCREEN_SAVER 0x1B1
541#define HID_CONSUMER_USAGE_AL_ALARMS 0x1B2
542#define HID_CONSUMER_USAGE_AL_CLOCK 0x1B3
543#define HID_CONSUMER_USAGE_AL_FILE_BROWSER 0x1B4
544#define HID_CONSUMER_USAGE_AL_POWER_STATUS 0x1B5
545#define HID_CONSUMER_USAGE_AL_IMAGE_BROWSER 0x1B6
546#define HID_CONSUMER_USAGE_AL_AUDIO_BROWSER 0x1B7
547#define HID_CONSUMER_USAGE_AL_MOVIE_BROWSER 0x1B8
548#define HID_CONSUMER_USAGE_AL_DIGITAL_RIGHTS_MANAGER 0x1B9
549#define HID_CONSUMER_USAGE_AL_DIGITAL_WALLET 0x1BA
550#define HID_CONSUMER_USAGE_AL_INSTANT_MESSAGING 0x1BC
551#define HID_CONSUMER_USAGE_AL_OEM_FEATURES_TIPS_TUTORIAL_BROWSER 0x1BD
552#define HID_CONSUMER_USAGE_AL_OEM_HELP 0x1BE
553#define HID_CONSUMER_USAGE_AL_ONLINE_COMMUNITY 0x1BF
554#define HID_CONSUMER_USAGE_AL_ONLINE_SHOPPING_BROWSER 0x1C1
555#define HID_CONSUMER_USAGE_AL_ENTERTAINMENT_CONTENT_BROWSER 0x1C0
556#define HID_CONSUMER_USAGE_AL_SMARTCARD_INFORMATION_HELP 0x1C2
557#define HID_CONSUMER_USAGE_AL_MARKET_MONITOR_FINANCE_BROWSER 0x1C3
558#define HID_CONSUMER_USAGE_AL_CUSTOMIZED_CORPORATE_NEWS_BROWSER 0x1C4
559#define HID_CONSUMER_USAGE_AL_RESEARCH_SEARCH_BROWSER 0x1C6
560#define HID_CONSUMER_USAGE_AL_ONLINE_ACTIVITY_BROWSER 0x1C5
561#define HID_CONSUMER_USAGE_AL_AUDIO_PLAYER 0x1C7
562#define HID_CONSUMER_USAGE_GENERIC_GUI_APPLICATION_CONTROLS 0x200
563#define HID_CONSUMER_USAGE_AC_NEW 0x201
564#define HID_CONSUMER_USAGE_AC_OPEN 0x202
565#define HID_CONSUMER_USAGE_AC_CLOSE 0x203
566#define HID_CONSUMER_USAGE_AC_EXIT 0x204
567#define HID_CONSUMER_USAGE_AC_MAXIMIZE 0x205
568#define HID_CONSUMER_USAGE_AC_MINIMIZE 0x206
569#define HID_CONSUMER_USAGE_AC_SAVE 0x207
570#define HID_CONSUMER_USAGE_AC_PRINT 0x208
571#define HID_CONSUMER_USAGE_AC_PROPERTIES 0x209
572#define HID_CONSUMER_USAGE_AC_UNDO 0x21A
573#define HID_CONSUMER_USAGE_AC_COPY 0x21B
574#define HID_CONSUMER_USAGE_AC_CUT 0x21C
575#define HID_CONSUMER_USAGE_AC_PASTE 0x21D
576#define HID_CONSUMER_USAGE_AC_SELECT_ALL 0x21E
577#define HID_CONSUMER_USAGE_AC_FIND 0x21F
578#define HID_CONSUMER_USAGE_AC_FIND_AND_REPLACE 0x220
579#define HID_CONSUMER_USAGE_AC_SEARCH 0x221
580#define HID_CONSUMER_USAGE_AC_GO_TO 0x222
581#define HID_CONSUMER_USAGE_AC_HOME 0x223
582#define HID_CONSUMER_USAGE_AC_BACK 0x224
583#define HID_CONSUMER_USAGE_AC_FORWARD 0x225
584#define HID_CONSUMER_USAGE_AC_STOP 0x226
585#define HID_CONSUMER_USAGE_AC_REFRESH 0x227
586#define HID_CONSUMER_USAGE_AC_PREVIOUS_LINK 0x228
587#define HID_CONSUMER_USAGE_AC_NEXT_LINK 0x229
588#define HID_CONSUMER_USAGE_AC_BOOKMARKS 0x22A
589#define HID_CONSUMER_USAGE_AC_HISTORY 0x22B
590#define HID_CONSUMER_USAGE_AC_SUBSCRIPTIONS 0x22C
591#define HID_CONSUMER_USAGE_AC_ZOOM_IN 0x22D
592#define HID_CONSUMER_USAGE_AC_ZOOM_OUT 0x22E
593#define HID_CONSUMER_USAGE_AC_ZOOM 0x22F
594#define HID_CONSUMER_USAGE_AC_FULL_SCREEN_VIEW 0x230
595#define HID_CONSUMER_USAGE_AC_NORMAL_VIEW 0x231
596#define HID_CONSUMER_USAGE_AC_VIEW_TOGGLE 0x232
597#define HID_CONSUMER_USAGE_AC_SCROLL_UP 0x233
598#define HID_CONSUMER_USAGE_AC_SCROLL_DOWN 0x234
599#define HID_CONSUMER_USAGE_AC_SCROLL 0x235
600#define HID_CONSUMER_USAGE_AC_PAN_LEFT 0x236
601#define HID_CONSUMER_USAGE_AC_PAN_RIGHT 0x237
602#define HID_CONSUMER_USAGE_AC_PAN 0x238
603#define HID_CONSUMER_USAGE_AC_NEW_WINDOW 0x239
604#define HID_CONSUMER_USAGE_AC_TILE_HORIZONTALLY 0x23A
605#define HID_CONSUMER_USAGE_AC_TILE_VERTICALLY 0x23B
606#define HID_CONSUMER_USAGE_AC_FORMAT 0x23C
607#define HID_CONSUMER_USAGE_AC_EDIT 0x23D
608#define HID_CONSUMER_USAGE_AC_BOLD 0x23E
609#define HID_CONSUMER_USAGE_AC_ITALICS 0x23F
610#define HID_CONSUMER_USAGE_AC_UNDERLINE 0x240
611#define HID_CONSUMER_USAGE_AC_STRIKETHROUGH 0x241
612#define HID_CONSUMER_USAGE_AC_SUBSCRIPT 0x242
613#define HID_CONSUMER_USAGE_AC_SUPERSCRIPT 0x243
614#define HID_CONSUMER_USAGE_AC_ALL_CAPS 0x244
615#define HID_CONSUMER_USAGE_AC_ROTATE 0x245
616#define HID_CONSUMER_USAGE_AC_RESIZE 0x246
617#define HID_CONSUMER_USAGE_AC_FLIP_HORIZONTAL 0x247
618#define HID_CONSUMER_USAGE_AC_FLIP_VERTICAL 0x248
619#define HID_CONSUMER_USAGE_AC_MIRROR_HORIZONTAL 0x249
620#define HID_CONSUMER_USAGE_AC_MIRROR_VERTICAL 0x24A
621#define HID_CONSUMER_USAGE_AC_FONT_SELECT 0x24B
622#define HID_CONSUMER_USAGE_AC_FONT_COLOR 0x24C
623#define HID_CONSUMER_USAGE_AC_FONT_SIZE 0x24D
624#define HID_CONSUMER_USAGE_AC_JUSTIFY_LEFT 0x24E
625#define HID_CONSUMER_USAGE_AC_JUSTIFY_CENTER_H 0x24F
626#define HID_CONSUMER_USAGE_AC_JUSTIFY_RIGHT 0x250
627#define HID_CONSUMER_USAGE_AC_JUSTIFY_BLOCK_H 0x251
628#define HID_CONSUMER_USAGE_AC_JUSTIFY_TOP 0x252
629#define HID_CONSUMER_USAGE_AC_JUSTIFY_CENTER_V 0x253
630#define HID_CONSUMER_USAGE_AC_JUSTIFY_BOTTOM 0x254
631#define HID_CONSUMER_USAGE_AC_JUSTIFY_BLOCK_V 0x255
632#define HID_CONSUMER_USAGE_AC_INDENT_DECREASE 0x256
633#define HID_CONSUMER_USAGE_AC_INDENT_INCREASE 0x257
634#define HID_CONSUMER_USAGE_AC_NUMBERED_LIST 0x258
635#define HID_CONSUMER_USAGE_AC_RESTART_NUMBERING 0x259
636#define HID_CONSUMER_USAGE_AC_BULLETED_LIST 0x25A
637#define HID_CONSUMER_USAGE_AC_PROMOTE 0x25B
638#define HID_CONSUMER_USAGE_AC_DEMOTE 0x25C
639#define HID_CONSUMER_USAGE_AC_YES 0x25D
640#define HID_CONSUMER_USAGE_AC_NO 0x25E
641#define HID_CONSUMER_USAGE_AC_CANCEL 0x25F
642#define HID_CONSUMER_USAGE_AC_CATALOG 0x260
643#define HID_CONSUMER_USAGE_AC_BUY_CHECKOUT 0x261
644#define HID_CONSUMER_USAGE_AC_ADD_TO_CART 0x262
645#define HID_CONSUMER_USAGE_AC_EXPAND 0x263
646#define HID_CONSUMER_USAGE_AC_EXPAND_ALL 0x264
647#define HID_CONSUMER_USAGE_AC_COLLAPSE 0x265
648#define HID_CONSUMER_USAGE_AC_COLLAPSE_ALL 0x266
649#define HID_CONSUMER_USAGE_AC_PRINT_PREVIEW 0x267
650#define HID_CONSUMER_USAGE_AC_PASTE_SPECIAL 0x268
651#define HID_CONSUMER_USAGE_AC_INSERT_MODE 0x269
652#define HID_CONSUMER_USAGE_AC_DELETE 0x26A
653#define HID_CONSUMER_USAGE_AC_LOCK 0x26B
654#define HID_CONSUMER_USAGE_AC_UNLOCK 0x26C
655#define HID_CONSUMER_USAGE_AC_PROTECT 0x26D
656#define HID_CONSUMER_USAGE_AC_UNPROTECT 0x26E
657#define HID_CONSUMER_USAGE_AC_ATTACH_COMMENT 0x26F
658#define HID_CONSUMER_USAGE_AC_DELETE_COMMENT 0x270
659#define HID_CONSUMER_USAGE_AC_VIEW_COMMENT 0x271
660#define HID_CONSUMER_USAGE_AC_SELECT_WORD 0x272
661#define HID_CONSUMER_USAGE_AC_SELECT_SENTENCE 0x273
662#define HID_CONSUMER_USAGE_AC_SELECT_PARAGRAPH 0x274
663#define HID_CONSUMER_USAGE_AC_SELECT_COLUMN 0x275
664#define HID_CONSUMER_USAGE_AC_SELECT_ROW 0x276
665#define HID_CONSUMER_USAGE_AC_SELECT_TABLE 0x277
666#define HID_CONSUMER_USAGE_AC_SELECT_OBJECT 0x278
667#define HID_CONSUMER_USAGE_AC_REDO_REPEAT 0x279
668#define HID_CONSUMER_USAGE_AC_SORT 0x27A
669#define HID_CONSUMER_USAGE_AC_SORT_ASCENDING 0x27B
670#define HID_CONSUMER_USAGE_AC_SORT_DESCENDING 0x27C
671#define HID_CONSUMER_USAGE_AC_FILTER 0x27D
672#define HID_CONSUMER_USAGE_AC_SET_CLOCK 0x27E
673#define HID_CONSUMER_USAGE_AC_VIEW_CLOCK 0x27F
674#define HID_CONSUMER_USAGE_AC_SELECT_TIME_ZONE 0x280
675#define HID_CONSUMER_USAGE_AC_EDIT_TIME_ZONES 0x281
676#define HID_CONSUMER_USAGE_AC_SET_ALARM 0x282
677#define HID_CONSUMER_USAGE_AC_CLEAR_ALARM 0x283
678#define HID_CONSUMER_USAGE_AC_SNOOZE_ALARM 0x284
679#define HID_CONSUMER_USAGE_AC_RESET_ALARM 0x285
680#define HID_CONSUMER_USAGE_AC_SYNCHRONIZE 0x286
681#define HID_CONSUMER_USAGE_AC_SEND_RECEIVE 0x287
682#define HID_CONSUMER_USAGE_AC_SEND_TO 0x288
683#define HID_CONSUMER_USAGE_AC_REPLY 0x289
684#define HID_CONSUMER_USAGE_AC_REPLY_ALL 0x28A
685#define HID_CONSUMER_USAGE_AC_FORWARD_MSG 0x28B
686#define HID_CONSUMER_USAGE_AC_SEND 0x28C
687#define HID_CONSUMER_USAGE_AC_ATTACH_FILE 0x28D
688#define HID_CONSUMER_USAGE_AC_UPLOAD 0x28E
689#define HID_CONSUMER_USAGE_AC_DOWNLOAD_SAVE_TARGET_AS 0x28F
690#define HID_CONSUMER_USAGE_AC_SET_BORDERS 0x290
691#define HID_CONSUMER_USAGE_AC_INSERT_ROW 0x291
692#define HID_CONSUMER_USAGE_AC_INSERT_COLUMN 0x292
693#define HID_CONSUMER_USAGE_AC_INSERT_FILE 0x293
694#define HID_CONSUMER_USAGE_AC_INSERT_PICTURE 0x294
695#define HID_CONSUMER_USAGE_AC_INSERT_OBJECT 0x295
696#define HID_CONSUMER_USAGE_AC_INSERT_SYMBOL 0x296
697#define HID_CONSUMER_USAGE_AC_SAVE_AND_CLOSE 0x297
698#define HID_CONSUMER_USAGE_AC_RENAME 0x298
699#define HID_CONSUMER_USAGE_AC_MERGE 0x299
700#define HID_CONSUMER_USAGE_AC_SPLIT 0x29A
701#define HID_CONSUMER_USAGE_AC_DISRIBUTE_HORIZONTALLY 0x29B
702#define HID_CONSUMER_USAGE_AC_DISTRIBUTE_VERTICALLY 0x29C
392 703
393#endif 704#endif
394 705