Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-usb-hid.c
blob41366f8235dd7dc31509d4aceb7a21570f6e9709
1 /* packet-usb-hid.c
3 * USB HID dissector
4 * By Adam Nielsen <a.nielsen@shikadi.net> 2009
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
9 /* See specification at
10 * https://www.usb.org/sites/default/files/hid1_11.pdf
11 * https://www.usb.org/sites/default/files/hut1_22.pdf
14 #include "config.h"
17 #include <epan/packet.h>
18 #include "wsutil/sign_ext.h"
19 #include "wsutil/pint.h"
20 #include "packet-usb.h"
21 #include "packet-usb-hid.h"
22 #include "packet-btsdp.h"
25 void proto_register_usb_hid(void);
26 void proto_reg_handoff_usb_hid(void);
28 /* Dissector handles */
29 static dissector_handle_t usb_hid_control_handle;
30 static dissector_handle_t usb_hid_interrupt_handle;
31 static dissector_handle_t usb_hid_descr_handle;
33 /* protocols and header fields */
34 static int proto_usb_hid;
35 static int hf_usb_hid_item_bSize;
36 static int hf_usb_hid_item_bType;
37 static int hf_usb_hid_mainitem_bTag;
38 static int hf_usb_hid_globalitem_bTag;
39 static int hf_usb_hid_localitem_bTag;
40 static int hf_usb_hid_longitem_bTag;
41 static int hf_usb_hid_item_bDataSize;
42 static int hf_usb_hid_item_bLongItemTag;
43 static int hf_usb_hid_item_unk_data;
45 static int hf_usb_hid_mainitem_bit0;
46 static int hf_usb_hid_mainitem_bit1;
47 static int hf_usb_hid_mainitem_bit2;
48 static int hf_usb_hid_mainitem_bit3;
49 static int hf_usb_hid_mainitem_bit4;
50 static int hf_usb_hid_mainitem_bit5;
51 static int hf_usb_hid_mainitem_bit6;
52 static int hf_usb_hid_mainitem_bit7;
53 static int hf_usb_hid_mainitem_bit7_input;
54 static int hf_usb_hid_mainitem_bit8;
55 static int hf_usb_hid_mainitem_colltype;
57 static int hf_usb_hid_globalitem_usage;
58 static int hf_usb_hid_globalitem_log_min;
59 static int hf_usb_hid_globalitem_log_max;
60 static int hf_usb_hid_globalitem_phy_min;
61 static int hf_usb_hid_globalitem_phy_max;
62 static int hf_usb_hid_globalitem_unit_exp;
63 static int hf_usb_hid_globalitem_unit_sys;
64 static int hf_usb_hid_globalitem_unit_len;
65 static int hf_usb_hid_globalitem_unit_mass;
66 static int hf_usb_hid_globalitem_unit_time;
67 static int hf_usb_hid_globalitem_unit_temp;
68 static int hf_usb_hid_globalitem_unit_current;
69 static int hf_usb_hid_globalitem_unit_brightness;
70 static int hf_usb_hid_globalitem_report_size;
71 static int hf_usb_hid_globalitem_report_id;
72 static int hf_usb_hid_globalitem_report_count;
73 static int hf_usb_hid_globalitem_push;
74 static int hf_usb_hid_globalitem_pop;
76 static int hf_usb_hid_localitem_usage;
77 static int hf_usb_hid_localitem_usage_min;
78 static int hf_usb_hid_localitem_usage_max;
79 static int hf_usb_hid_localitem_desig_index;
80 static int hf_usb_hid_localitem_desig_min;
81 static int hf_usb_hid_localitem_desig_max;
82 static int hf_usb_hid_localitem_string_index;
83 static int hf_usb_hid_localitem_string_min;
84 static int hf_usb_hid_localitem_string_max;
85 static int hf_usb_hid_localitem_delimiter;
87 static int ett_usb_hid_report;
88 static int ett_usb_hid_item_header;
89 static int ett_usb_hid_wValue;
90 static int ett_usb_hid_descriptor;
91 static int ett_usb_hid_data;
92 static int ett_usb_hid_unknown_data;
93 static int ett_usb_hid_array;
95 static int hf_usb_hid_request;
96 static int hf_usb_hid_value;
97 static int hf_usb_hid_index;
98 static int hf_usb_hid_length;
99 static int hf_usb_hid_report_type;
100 static int hf_usb_hid_report_id;
101 static int hf_usb_hid_duration;
102 static int hf_usb_hid_zero;
104 static int hf_usb_hid_bcdHID;
105 static int hf_usb_hid_bCountryCode;
106 static int hf_usb_hid_bNumDescriptors;
107 static int hf_usb_hid_bDescriptorIndex;
108 static int hf_usb_hid_bDescriptorType;
109 static int hf_usb_hid_wInterfaceNumber;
110 static int hf_usb_hid_wDescriptorLength;
112 static int hf_usbhid_boot_report_keyboard_modifier_right_gui;
113 static int hf_usbhid_boot_report_keyboard_modifier_right_alt;
114 static int hf_usbhid_boot_report_keyboard_modifier_right_shift;
115 static int hf_usbhid_boot_report_keyboard_modifier_right_ctrl;
116 static int hf_usbhid_boot_report_keyboard_modifier_left_gui;
117 static int hf_usbhid_boot_report_keyboard_modifier_left_alt;
118 static int hf_usbhid_boot_report_keyboard_modifier_left_shift;
119 static int hf_usbhid_boot_report_keyboard_modifier_left_ctrl;
120 static int hf_usbhid_boot_report_keyboard_reserved;
121 static int hf_usbhid_boot_report_keyboard_keycode_1;
122 static int hf_usbhid_boot_report_keyboard_keycode_2;
123 static int hf_usbhid_boot_report_keyboard_keycode_3;
124 static int hf_usbhid_boot_report_keyboard_keycode_4;
125 static int hf_usbhid_boot_report_keyboard_keycode_5;
126 static int hf_usbhid_boot_report_keyboard_keycode_6;
127 static int hf_usbhid_boot_report_keyboard_leds_constants;
128 static int hf_usbhid_boot_report_keyboard_leds_kana;
129 static int hf_usbhid_boot_report_keyboard_leds_compose;
130 static int hf_usbhid_boot_report_keyboard_leds_scroll_lock;
131 static int hf_usbhid_boot_report_keyboard_leds_caps_lock;
132 static int hf_usbhid_boot_report_keyboard_leds_num_lock;
133 static int hf_usbhid_boot_report_mouse_button_8;
134 static int hf_usbhid_boot_report_mouse_button_7;
135 static int hf_usbhid_boot_report_mouse_button_6;
136 static int hf_usbhid_boot_report_mouse_button_5;
137 static int hf_usbhid_boot_report_mouse_button_4;
138 static int hf_usbhid_boot_report_mouse_button_middle;
139 static int hf_usbhid_boot_report_mouse_button_right;
140 static int hf_usbhid_boot_report_mouse_button_left;
141 static int hf_usbhid_boot_report_mouse_x_displacement;
142 static int hf_usbhid_boot_report_mouse_y_displacement;
143 static int hf_usbhid_boot_report_mouse_horizontal_scroll_wheel;
144 static int hf_usbhid_boot_report_mouse_vertical_scroll_wheel;
145 static int hf_usbhid_data;
146 static int hf_usbhid_unknown_data;
147 static int hf_usbhid_vendor_data;
148 static int hf_usbhid_report_id;
149 static int hf_usbhid_padding;
150 static int hf_usbhid_axis_x;
151 static int hf_usbhid_axis_y;
152 static int hf_usbhid_axis_z;
153 static int hf_usbhid_axis_rx;
154 static int hf_usbhid_axis_ry;
155 static int hf_usbhid_axis_rz;
156 static int hf_usbhid_axis_slider;
157 static int hf_usbhid_axis_vx;
158 static int hf_usbhid_axis_vy;
159 static int hf_usbhid_axis_vz;
160 static int hf_usbhid_axis_vbrx;
161 static int hf_usbhid_axis_vbry;
162 static int hf_usbhid_axis_vbrz;
163 static int hf_usbhid_axis_vno;
164 static int hf_usbhid_button;
165 static int hf_usbhid_key;
166 static int hf_usbhid_array;
167 static int hf_usbhid_array_usage;
169 static const true_false_string tfs_mainitem_bit0 = {"Constant", "Data"};
170 static const true_false_string tfs_mainitem_bit1 = {"Variable", "Array"};
171 static const true_false_string tfs_mainitem_bit2 = {"Relative", "Absolute"};
172 static const true_false_string tfs_mainitem_bit3 = {"Wrap", "No Wrap"};
173 static const true_false_string tfs_mainitem_bit4 = {"Non Linear", "Linear"};
174 static const true_false_string tfs_mainitem_bit5 = {"No Preferred", "Preferred State"};
175 static const true_false_string tfs_mainitem_bit6 = {"Null state", "No Null position"};
176 static const true_false_string tfs_mainitem_bit7 = {"Volatile", "Non Volatile"};
177 static const true_false_string tfs_mainitem_bit8 = {"Buffered Bytes", "Bit Field"};
180 struct usb_hid_global_state {
181 unsigned int usage_page;
184 static wmem_tree_t *report_descriptors;
187 /* local items */
188 #define HID_USAGE_MIN (1 << 0)
189 #define HID_USAGE_MAX (1 << 1)
191 /* global items */
192 #define HID_REPORT_ID (1 << 2)
193 #define HID_REPORT_COUNT (1 << 3)
194 #define HID_REPORT_SIZE (1 << 4)
195 #define HID_LOGICAL_MIN (1 << 5)
196 #define HID_LOGICAL_MAX (1 << 6)
197 #define HID_USAGE_PAGE (1 << 7)
199 /* main items */
200 #define HID_INPUT (1 << 8)
201 #define HID_OUTPUT (1 << 9)
202 #define HID_FEATURE (1 << 10)
204 #define HID_EXTENDED_USAGE (1 << 11)
206 /* masks */
208 #define HID_GLOBAL_MASK (HID_REPORT_ID | \
209 HID_REPORT_COUNT | \
210 HID_REPORT_SIZE | \
211 HID_LOGICAL_MIN | \
212 HID_LOGICAL_MAX | \
213 HID_USAGE_PAGE)
215 #define HID_REQUIRED_MASK (HID_REPORT_COUNT | \
216 HID_REPORT_SIZE | \
217 HID_LOGICAL_MIN | \
218 HID_LOGICAL_MAX)
221 #define HID_MAIN_CONSTANT (1 << 0) /* data / constant */
222 #define HID_MAIN_TYPE (1 << 1) /* array / variable */
223 #define HID_MAIN_RELATIVE (1 << 2) /* absolute / relative */
224 #define HID_MAIN_WRAP (1 << 3) /* no wrap / wrap */
225 #define HID_MAIN_NON_LINEAR (1 << 4) /* linear / non linear */
226 #define HID_MAIN_NO_PREFERRED (1 << 5) /* preferred state / no preferred */
227 #define HID_MAIN_NULL_STATE (1 << 6) /* no null position / null state */
228 #define HID_MAIN_BUFFERED_BYTES (1 << 8) /* bit field / buffered bytes */
231 #define HID_MAIN_ARRAY (0 << 1)
232 #define HID_MAIN_VARIABLE (1 << 1)
235 #define HID_USAGE_UNSET 0
236 #define HID_USAGE_SINGLE 1
237 #define HID_USAGE_RANGE 2
240 #define USAGE_ID(usage) (usage & 0x0000FFFF)
241 #define USAGE_PAGE(usage) ((usage & 0xFFFF0000) >> 16)
243 typedef struct _hid_field hid_field_t;
245 struct _hid_field {
246 wmem_array_t *usages;
248 uint32_t report_id; /* optional */
249 uint32_t report_count;
250 uint32_t report_size;
251 int32_t logical_min;
252 int32_t logical_max;
253 uint32_t properties;
255 hid_field_t *next;
259 typedef struct _report_descriptor report_descriptor_t;
261 struct _report_descriptor {
262 uint16_t bus_id;
263 uint16_t device_address;
264 uint8_t interface;
266 int desc_length;
267 uint8_t *desc_body;
269 bool uses_report_id;
270 wmem_array_t *fields_in;
271 wmem_array_t *fields_out;
272 /* TODO: features */
274 report_descriptor_t *next;
277 #define USBHID_GENERIC_DESKTOP_CONTROLS_X 0x0030
278 #define USBHID_GENERIC_DESKTOP_CONTROLS_Y 0x0031
279 #define USBHID_GENERIC_DESKTOP_CONTROLS_Z 0x0032
280 #define USBHID_GENERIC_DESKTOP_CONTROLS_RX 0x0033
281 #define USBHID_GENERIC_DESKTOP_CONTROLS_RY 0x0034
282 #define USBHID_GENERIC_DESKTOP_CONTROLS_RZ 0x0035
283 #define USBHID_GENERIC_DESKTOP_CONTROLS_SLIDER 0x0036
285 #define USBHID_GENERIC_DESKTOP_CONTROLS_VX 0x0040
286 #define USBHID_GENERIC_DESKTOP_CONTROLS_VY 0x0041
287 #define USBHID_GENERIC_DESKTOP_CONTROLS_VZ 0x0042
288 #define USBHID_GENERIC_DESKTOP_CONTROLS_VBRX 0x0043
289 #define USBHID_GENERIC_DESKTOP_CONTROLS_VBRY 0x0044
290 #define USBHID_GENERIC_DESKTOP_CONTROLS_VBRZ 0x0045
291 #define USBHID_GENERIC_DESKTOP_CONTROLS_VNO 0x0046
293 /* HID class specific descriptor types */
294 #define USB_DT_HID 0x21
295 #define USB_DT_HID_REPORT 0x22
296 static const value_string hid_descriptor_type_vals[] = {
297 {USB_DT_HID, "HID"},
298 {USB_DT_HID_REPORT, "HID Report"},
299 {0, NULL}
301 static value_string_ext hid_descriptor_type_vals_ext =
302 VALUE_STRING_EXT_INIT(hid_descriptor_type_vals);
305 #define USBHID_SIZE_MASK 0x03
306 #define USBHID_TYPE_MASK 0x0C
307 #define USBHID_TAG_MASK 0xF0
309 static const value_string usb_hid_item_bSize_vals[] = {
310 {0, "0 bytes"},
311 {1, "1 byte"},
312 {2, "2 bytes"},
313 {3, "4 bytes"},
314 {0, NULL}
317 #define USBHID_ITEMTYPE_MAIN 0
318 #define USBHID_ITEMTYPE_GLOBAL 1
319 #define USBHID_ITEMTYPE_LOCAL 2
320 #define USBHID_ITEMTYPE_LONG 3
321 static const value_string usb_hid_item_bType_vals[] = {
322 {USBHID_ITEMTYPE_MAIN, "Main"},
323 {USBHID_ITEMTYPE_GLOBAL, "Global"},
324 {USBHID_ITEMTYPE_LOCAL, "Local"},
325 {USBHID_ITEMTYPE_LONG, "Long item"},
326 {0, NULL}
329 #define USBHID_MAINITEM_TAG_INPUT 8
330 #define USBHID_MAINITEM_TAG_OUTPUT 9
331 #define USBHID_MAINITEM_TAG_FEATURE 11
332 #define USBHID_MAINITEM_TAG_COLLECTION 10
333 #define USBHID_MAINITEM_TAG_ENDCOLLECTION 12
334 static const value_string usb_hid_mainitem_bTag_vals[] = {
335 {USBHID_MAINITEM_TAG_INPUT, "Input"},
336 {USBHID_MAINITEM_TAG_OUTPUT, "Output"},
337 {USBHID_MAINITEM_TAG_FEATURE, "Feature"},
338 {USBHID_MAINITEM_TAG_COLLECTION, "Collection"},
339 {USBHID_MAINITEM_TAG_ENDCOLLECTION, "End Collection"},
340 {0, NULL}
342 #define USBHID_GLOBALITEM_TAG_USAGE_PAGE 0
343 #define USBHID_GLOBALITEM_TAG_LOG_MIN 1
344 #define USBHID_GLOBALITEM_TAG_LOG_MAX 2
345 #define USBHID_GLOBALITEM_TAG_PHY_MIN 3
346 #define USBHID_GLOBALITEM_TAG_PHY_MAX 4
347 #define USBHID_GLOBALITEM_TAG_UNIT_EXP 5
348 #define USBHID_GLOBALITEM_TAG_UNIT 6
349 #define USBHID_GLOBALITEM_TAG_REPORT_SIZE 7
350 #define USBHID_GLOBALITEM_TAG_REPORT_ID 8
351 #define USBHID_GLOBALITEM_TAG_REPORT_COUNT 9
352 #define USBHID_GLOBALITEM_TAG_PUSH 10
353 #define USBHID_GLOBALITEM_TAG_POP 11
354 static const value_string usb_hid_globalitem_bTag_vals[] = {
355 {USBHID_GLOBALITEM_TAG_USAGE_PAGE, "Usage Page"},
356 {USBHID_GLOBALITEM_TAG_LOG_MIN, "Logical Minimum"},
357 {USBHID_GLOBALITEM_TAG_LOG_MAX, "Logical Maximum"},
358 {USBHID_GLOBALITEM_TAG_PHY_MIN, "Physical Minimum"},
359 {USBHID_GLOBALITEM_TAG_PHY_MAX, "Physical Maximum"},
360 {USBHID_GLOBALITEM_TAG_UNIT_EXP, "Unit Exponent"},
361 {USBHID_GLOBALITEM_TAG_UNIT, "Unit"},
362 {USBHID_GLOBALITEM_TAG_REPORT_SIZE, "Report Size"},
363 {USBHID_GLOBALITEM_TAG_REPORT_ID, "Report ID"},
364 {USBHID_GLOBALITEM_TAG_REPORT_COUNT, "Report Count"},
365 {USBHID_GLOBALITEM_TAG_PUSH, "Push"},
366 {USBHID_GLOBALITEM_TAG_POP, "Pop"},
367 {12, "[Reserved]"},
368 {13, "[Reserved]"},
369 {14, "[Reserved]"},
370 {15, "[Reserved]"},
371 {0, NULL}
373 #define USBHID_LOCALITEM_TAG_USAGE 0
374 #define USBHID_LOCALITEM_TAG_USAGE_MIN 1
375 #define USBHID_LOCALITEM_TAG_USAGE_MAX 2
376 #define USBHID_LOCALITEM_TAG_DESIG_INDEX 3
377 #define USBHID_LOCALITEM_TAG_DESIG_MIN 4
378 #define USBHID_LOCALITEM_TAG_DESIG_MAX 5
379 /* No 6 in spec */
380 #define USBHID_LOCALITEM_TAG_STRING_INDEX 7
381 #define USBHID_LOCALITEM_TAG_STRING_MIN 8
382 #define USBHID_LOCALITEM_TAG_STRING_MAX 9
383 #define USBHID_LOCALITEM_TAG_DELIMITER 10 /* Also listed as reserved in spec! */
384 static const value_string usb_hid_localitem_bTag_vals[] = {
385 {USBHID_LOCALITEM_TAG_USAGE, "Usage"},
386 {USBHID_LOCALITEM_TAG_USAGE_MIN, "Usage Minimum"},
387 {USBHID_LOCALITEM_TAG_USAGE_MAX, "Usage Maximum"},
388 {USBHID_LOCALITEM_TAG_DESIG_INDEX, "Designator Index"},
389 {USBHID_LOCALITEM_TAG_DESIG_MIN, "Designator Minimum"},
390 {USBHID_LOCALITEM_TAG_DESIG_MAX, "Designator Maximum"},
391 {USBHID_LOCALITEM_TAG_STRING_INDEX, "String Index"},
392 {USBHID_LOCALITEM_TAG_STRING_MIN, "String Minimum"},
393 {USBHID_LOCALITEM_TAG_STRING_MAX, "String Maximum"},
394 {USBHID_LOCALITEM_TAG_DELIMITER, "Delimiter"},
395 {11, "[Reserved]"},
396 {12, "[Reserved]"},
397 {13, "[Reserved]"},
398 {14, "[Reserved]"},
399 {15, "[Reserved]"},
400 {0, NULL}
402 static const value_string usb_hid_longitem_bTag_vals[] = {
403 {15, "Long item"},
404 {0, NULL}
407 static const range_string usb_hid_mainitem_colltype_vals[] = {
408 {0x00, 0x00, "Physical"},
409 {0x01, 0x01, "Application"},
410 {0x02, 0x02, "Logical"},
411 {0x03, 0x03, "Report"},
412 {0x04, 0x04, "Named array"},
413 {0x05, 0x05, "Usage switch"},
414 {0x06, 0x06, "Usage modifier"},
415 {0x07, 0x7F, "[Reserved]"},
416 {0x80, 0xFF, "[Vendor-defined]"},
417 {0, 0, NULL}
420 static const value_string usb_hid_globalitem_unit_exp_vals[] = {
421 {0x0, "n^0"},
422 {0x1, "n^1"},
423 {0x2, "n^2"},
424 {0x3, "n^3"},
425 {0x4, "n^4"},
426 {0x5, "n^5"},
427 {0x6, "n^6"},
428 {0x7, "n^7"},
429 {0x8, "n^-8"},
430 {0x9, "n^-7"},
431 {0xA, "n^-6"},
432 {0xB, "n^-5"},
433 {0xC, "n^-4"},
434 {0xD, "n^-3"},
435 {0xE, "n^-2"},
436 {0xF, "n^-1"},
437 {0, NULL}
440 #define GENERIC_DESKTOP_CONTROLS_PAGE 0x01
441 #define SIMULATION_CONTROLS_PAGE 0x02
442 #define VR_CONTROLS_PAGE 0x03
443 #define SPORT_CONTROLS_PAGE 0x04
444 #define GAME_CONTROLS_PAGE 0x05
445 #define GENERIC_DEVICE_CONTROLS_PAGE 0x06
446 #define KEYBOARD_KEYPAD_PAGE 0x07
447 #define LED_PAGE 0x08
448 #define BUTTON_PAGE 0x09
449 #define ORDINAL_PAGE 0x0A
450 #define TELEPHONY_PAGE 0x0B
451 #define CONSUMER_PAGE 0x0C
452 #define DIGITIZER_PAGE 0x0D
453 #define HAPTICS_PAGE 0x0E
454 #define PID_PAGE 0x0F
455 #define UNICODE_PAGE 0x10
456 #define SOC_PAGE 0x11
457 #define EYE_AND_HEAD_TRACKER_PAGE 0x12
458 #define ALPHANUMERIC_DISPLAY_PAGE 0x14
459 #define SENSOR_PAGE 0x20
460 #define MEDICAL_INSTRUMENTS_PAGE 0x40
461 #define BRAILLE_DISPLAY_PAGE 0x41
462 #define LIGHTING_AND_ILLUMINATION_PAGE 0x59
463 #define USB_MONITOR_PAGE 0x80
464 #define USB_ENUMERATED_VALUES_PAGE 0x81
465 #define VESA_VIRTUAL_CONTROLS_PAGE 0x82
466 #define POWER_DEVICE_PAGE 0x84
467 #define BATTERY_SYSTEM_PAGE 0x85
468 #define BARCODE_SCANNER_PAGE 0x8C
469 #define WEIGHING_PAGE 0x8D
470 #define MSR_PAGE 0x8E
471 #define RESERVED_POS_PAGE 0x8F
472 #define CAMERA_CONTROL_PAGE 0x90
473 #define ARCADE_PAGE 0x91
474 #define GAMING_DEVICE_PAGE 0x92
475 #define FIDO_ALLIANCE_PAGE 0xF1D0
476 #define VENDOR_PAGE_HBYTE 0xFF00
477 static const value_string usb_hid_item_usage_page_vals[] = {
478 {0x00, "Undefined"},
479 {GENERIC_DESKTOP_CONTROLS_PAGE, "Generic Desktop Controls"},
480 {SIMULATION_CONTROLS_PAGE, "Simulation Controls"},
481 {VR_CONTROLS_PAGE, "VR Controls"},
482 {SPORT_CONTROLS_PAGE, "Sport Controls"},
483 {GAME_CONTROLS_PAGE, "Game Controls"},
484 {GENERIC_DEVICE_CONTROLS_PAGE, "Generic Device Controls"},
485 {KEYBOARD_KEYPAD_PAGE, "Keyboard/Keypad"},
486 {LED_PAGE, "LED"},
487 {BUTTON_PAGE, "Button"},
488 {ORDINAL_PAGE, "Ordinal"},
489 {TELEPHONY_PAGE, "Telephony"},
490 {CONSUMER_PAGE, "Consumer"},
491 {DIGITIZER_PAGE, "Digitizer"},
492 {HAPTICS_PAGE, "Haptics"},
493 {PID_PAGE, "Physical Interface Device (PID)"},
494 {UNICODE_PAGE, "Unicode"},
495 {SOC_PAGE, "System-on-Chip"},
496 {EYE_AND_HEAD_TRACKER_PAGE, "Eye and Head Tracker"},
497 {ALPHANUMERIC_DISPLAY_PAGE, "Alphanumeric Display"},
498 {SENSOR_PAGE, "Sensor"},
499 {MEDICAL_INSTRUMENTS_PAGE, "Medical Instruments"},
500 {BRAILLE_DISPLAY_PAGE, "Braille Display"},
501 {LIGHTING_AND_ILLUMINATION_PAGE, "Lighting and Illumination"},
502 {USB_MONITOR_PAGE, "USB Monitor"},
503 {USB_ENUMERATED_VALUES_PAGE, "USB Enumerated Values"},
504 {VESA_VIRTUAL_CONTROLS_PAGE, "VESA Virtual Controls"},
505 {POWER_DEVICE_PAGE, "Power Device"},
506 {BATTERY_SYSTEM_PAGE, "Battery Device"},
507 {BARCODE_SCANNER_PAGE, "Barcode Scanner"},
508 {WEIGHING_PAGE, "Weighing"},
509 {MSR_PAGE, "Magnetic Stripe Reading (MSR) Devices"},
510 {RESERVED_POS_PAGE, "[Reserved Point of Sale page]"},
511 {CAMERA_CONTROL_PAGE, "Camera Control Page"},
512 {ARCADE_PAGE, "Arcade"},
513 {GAMING_DEVICE_PAGE, "Gaming Device"},
514 {FIDO_ALLIANCE_PAGE , "FIDO Alliance"},
515 {0, NULL}
518 static const value_string usb_hid_generic_desktop_controls_usage_page_vals[] = {
519 {0x00, "Undefined"},
520 {0x01, "Pointer"},
521 {0x02, "Mouse"},
522 {0x04, "Joystick"},
523 {0x05, "Game Pad"},
524 {0x06, "Keyboard"},
525 {0x07, "Keypad"},
526 {0x08, "Multi-axis Controller"},
527 {0x09, "Tablet PC System Controls"},
528 {0x0A, "Water Cooling Device"},
529 {0x0B, "Computer Chassis Device"},
530 {0x0C, "Wireless Radio Controls"},
531 {0x0D, "Portable Device Control"},
532 {0x0E, "System Multi-Axis Controller"},
533 {0x0F, "Spatial Controller"},
534 {0x10, "Assistive Control"},
535 {0x11, "Device Dock"},
536 {0x12, "Dockable Device"},
537 {0x13, "Call State Management Control"},
538 {0x30, "X"},
539 {0x31, "Y"},
540 {0x32, "Z"},
541 {0x33, "Rx"},
542 {0x34, "Ry"},
543 {0x35, "Rz"},
544 {0x36, "Slider"},
545 {0x37, "Dial"},
546 {0x38, "Wheel"},
547 {0x39, "Hat switch"},
548 {0x3A, "Counted Buffer"},
549 {0x3B, "Byte Count"},
550 {0x3C, "Motion Wakeup"},
551 {0x3D, "Start"},
552 {0x3E, "Select"},
553 {0x40, "Vx"},
554 {0x41, "Vy"},
555 {0x42, "Vz"},
556 {0x43, "Vbrx"},
557 {0x44, "Vbry"},
558 {0x45, "Vbrz"},
559 {0x46, "Vno"},
560 {0x47, "Feature Notification"},
561 {0x48, "Resolution Multiplier"},
562 {0x49, "Qx"},
563 {0x4A, "Qy"},
564 {0x4B, "Qz"},
565 {0x4C, "Qw"},
566 {0x80, "System Control"},
567 {0x81, "System Power Down"},
568 {0x82, "System Sleep"},
569 {0x83, "System Wake Up"},
570 {0x84, "System Context Menu"},
571 {0x85, "System Main Menu"},
572 {0x86, "System App Menu"},
573 {0x87, "System Menu Help"},
574 {0x88, "System Menu Exit"},
575 {0x89, "System Menu Select"},
576 {0x8A, "System Menu Right"},
577 {0x8B, "System Menu Left"},
578 {0x8C, "System Menu Up"},
579 {0x8D, "System Menu Down"},
580 {0x8E, "System Cold Restart"},
581 {0x8F, "System Warm Restart"},
582 {0x90, "D-pad Up"},
583 {0x91, "D-pad Down"},
584 {0x92, "D-pad Right"},
585 {0x93, "D-pad Left"},
586 {0x94, "Index Trigger"},
587 {0x95, "Palm Trigger"},
588 {0x96, "Thumbstick"},
589 {0x97, "System Function Shift"},
590 {0x98, "System Function Shift Lock"},
591 {0x99, "System Function Shift Lock Indicator"},
592 {0x9A, "System Dismiss Notification"},
593 {0x9B, "System Do Not Disturb"},
594 {0xA0, "System Dock"},
595 {0xA1, "System Undock"},
596 {0xA2, "System Setup"},
597 {0xA3, "System Break"},
598 {0xA4, "System Debugger Break"},
599 {0xA5, "Application Break"},
600 {0xA6, "Application Debugger Break"},
601 {0xA7, "System Speaker Mute"},
602 {0xA8, "System Hibernate"},
603 {0xA9, "System Microphone Mute"},
604 {0xB0, "System Display Invert"},
605 {0xB1, "System Display Internal"},
606 {0xB2, "System Display External"},
607 {0xB3, "System Display Both"},
608 {0xB4, "System Display Dual"},
609 {0xB5, "System Display Toggle Int/Ext"},
610 {0xB6, "System Display Swap Primary/Secondary"},
611 {0xB7, "System Display LCD Autoscale"},
612 {0xC0, "Sensor Zone"},
613 {0xC1, "RPM"},
614 {0xC2, "Coolant Level"},
615 {0xC3, "Coolant Critical Level"},
616 {0xC4, "Coolant Pump"},
617 {0xC5, "Chassis Enclosure"},
618 {0xC6, "Wireless Radio Button"},
619 {0xC7, "Wireless Radio LED"},
620 {0xC8, "Wireless Radio Slider Switch"},
621 {0xC9, "System Display Rotation Lock Button"},
622 {0xCA, "System Display Rotation Lock Slider Switch"},
623 {0xCB, "Control Enable"},
624 {0xD0, "Dockable Device Unique ID"},
625 {0xD1, "Dockable Device Vendor ID"},
626 {0xD2, "Dockable Device Primary Usage Page"},
627 {0xD3, "Dockable Device Primary Usage ID"},
628 {0xD4, "Dockable Device Docking State"},
629 {0xD5, "Dockable Device Display Occlusion"},
630 {0xD6, "Dockable Device Object Type"},
631 {0xE0, "Call Active LED"},
632 {0xE1, "Call Mute Toggle"},
633 {0xE2, "Call Mute LED"},
634 {0, NULL}
636 static const value_string usb_hid_simulation_control_usage_page_vals[] = {
637 {0x00, "Undefined"},
638 {0x01, "Flight Simulation Device"},
639 {0x02, "Automobile Simulation Device"},
640 {0x03, "Tank Simulation Device"},
641 {0x04, "Spaceship Simulation Device"},
642 {0x05, "Submarine Simulation Device"},
643 {0x06, "Sailing Simulation Device"},
644 {0x07, "Motorcycle Simulation Device"},
645 {0x08, "Sports Simulation Device"},
646 {0x09, "Airplane Simulation Device"},
647 {0x0A, "Helicopter Simulation Device"},
648 {0x0B, "Magic Carpet Simulation Device"},
649 {0x0C, "Bicycle Simulation Device"},
650 {0x20, "Flight Control Stick"},
651 {0x21, "Flight Stick"},
652 {0x22, "Cyclic Control"},
653 {0x23, "Cyclic Trim"},
654 {0x24, "Flight Yoke"},
655 {0x25, "Track Control"},
656 {0xB0, "Aileron"},
657 {0xB1, "Aileron Trim"},
658 {0xB2, "Anti-Torque Control"},
659 {0xB3, "Autopilot Enable"},
660 {0xB4, "Chaff Release"},
661 {0xB5, "Collective Control"},
662 {0xB6, "Dive Brake"},
663 {0xB7, "Electronic Countermeasures"},
664 {0xB8, "Elevator"},
665 {0xB9, "Elevator Trim"},
666 {0xBA, "Rudder"},
667 {0xBB, "Throttle"},
668 {0xBC, "Flight Communications"},
669 {0xBD, "Flare Release"},
670 {0xBE, "Landing Gear"},
671 {0xBF, "Toe Brake"},
672 {0xC0, "Trigger"},
673 {0xC1, "Weapons Arm"},
674 {0xC2, "Weapons Select"},
675 {0xC3, "Wing Flaps"},
676 {0xC4, "Accelerator"},
677 {0xC5, "Brake"},
678 {0xC6, "Clutch"},
679 {0xC7, "Shifter"},
680 {0xC8, "Steering"},
681 {0xC9, "Turret Direction"},
682 {0xCA, "Barrel Elevation"},
683 {0xCB, "Dive Plane"},
684 {0xCC, "Ballast"},
685 {0xCD, "Bicycle Crank"},
686 {0xCE, "Handle Bars"},
687 {0xCF, "Front Brake"},
688 {0xD0, "Rear Brake"},
689 {0, NULL}
691 static const value_string usb_hid_vr_controls_usage_page_vals[] = {
692 {0x00, "Undefined"},
693 {0x01, "Belt"},
694 {0x02, "Body Suit"},
695 {0x03, "Flexor"},
696 {0x04, "Glove"},
697 {0x05, "Head Tracker"},
698 {0x06, "Head Mounted Display"},
699 {0x07, "Hand Tracker"},
700 {0x08, "Oculometer"},
701 {0x09, "Vest"},
702 {0x0A, "Animatronic Device"},
703 {0x20, "Stereo Enable"},
704 {0x21, "Display Enable"},
705 {0, NULL}
707 static const value_string usb_hid_sport_controls_usage_page_vals[] = {
708 {0x00, "Undefined"},
709 {0x01, "Baseball Bat"},
710 {0x02, "Golf Club"},
711 {0x03, "Rowing Machine"},
712 {0x04, "Treadmill"},
713 {0x30, "Oar"},
714 {0x31, "Slope"},
715 {0x32, "Rate"},
716 {0x33, "Stick Speed"},
717 {0x34, "Stick Face Angle"},
718 {0x35, "Stick Heel/Toe"},
719 {0x36, "Stick Follow Through"},
720 {0x37, "Stick Tempo"},
721 {0x38, "Stick Type"},
722 {0x39, "Stick Height"},
723 {0x50, "Putter"},
724 {0x51, "1 Iron"},
725 {0x52, "2 Iron"},
726 {0x53, "3 Iron"},
727 {0x54, "4 Iron"},
728 {0x55, "5 Iron"},
729 {0x56, "6 Iron"},
730 {0x57, "7 Iron"},
731 {0x58, "8 Iron"},
732 {0x59, "9 Iron"},
733 {0x5A, "10 Iron"},
734 {0x5B, "11 Iron"},
735 {0x5C, "Sand Wedge"},
736 {0x5D, "Loft Wedge"},
737 {0x5E, "Power Wedge"},
738 {0x5F, "1 Wood"},
739 {0x60, "3 Wood"},
740 {0x61, "5 Wood"},
741 {0x62, "7 Wood"},
742 {0x63, "9 Wood"},
743 {0, NULL}
745 static const value_string usb_hid_game_controls_usage_page_vals[] = {
746 {0x00, "Undefined"},
747 {0x01, "3D Game Controller"},
748 {0x02, "Pinball Device"},
749 {0x03, "Gun Device"},
750 {0x20, "Point of View"},
751 {0x21, "Turn Right/Left"},
752 {0x22, "Pitch Forward/Backward"},
753 {0x23, "Roll Right/Left"},
754 {0x24, "Move Right/Left"},
755 {0x25, "Move Forward/Backward"},
756 {0x26, "Move Up/Down"},
757 {0x27, "Lean Right/Left"},
758 {0x28, "Lean Forward/Backward"},
759 {0x29, "Height of POV"},
760 {0x2A, "Flipper"},
761 {0x2B, "Secondary Flipper"},
762 {0x2C, "Bump"},
763 {0x2D, "New Game"},
764 {0x2E, "Shoot Ball"},
765 {0x2F, "Player"},
766 {0x30, "Gun Bolt"},
767 {0x31, "Gun Clip"},
768 {0x32, "Gun Selector"},
769 {0x33, "Gun Single Shot"},
770 {0x34, "Gun Burst"},
771 {0x35, "Gun Automatic"},
772 {0x36, "Gun Safety"},
773 {0x37, "Gamepad Fire/Jump"},
774 {0x39, "Gamepad Trigger"},
775 {0x3A, "Form-fitting Gamepad"},
776 {0, NULL}
778 static const value_string usb_hid_generic_device_controls_usage_page_vals[] = {
779 {0x00, "Undefined"},
780 {0x01, "Background/Nonuser Controls"},
781 {0x20, "Battery Strength"},
782 {0x21, "Wireless Channel"},
783 {0x22, "Wireless ID"},
784 {0x23, "Discover Wireless Control"},
785 {0x24, "Security Code Character Entered"},
786 {0x25, "Security Code Character Erased"},
787 {0x26, "Security Code Cleared"},
788 {0x27, "Sequence ID"},
789 {0x28, "Sequence ID Reset"},
790 {0x29, "RF Signal Strength"},
791 {0x2A, "Software Version"},
792 {0x2B, "Protocol Version"},
793 {0x2C, "Hardware Version"},
794 {0x2D, "Major"},
795 {0x2E, "Minor"},
796 {0x2F, "Revision"},
797 {0x30, "Handedness"},
798 {0x31, "Either Hand"},
799 {0x32, "Left Hand"},
800 {0x33, "Right Hand"},
801 {0x34, "Both Hands"},
802 {0x40, "Grip Pose Offset"},
803 {0x41, "Pointer Pose Offset"},
804 {0, NULL}
806 static const value_string usb_hid_keyboard_keypad_usage_page_vals[] = {
807 {0x00, "Reserved (no event indicated)"},
808 {0x01, "Keyboard ErrorRollOver"},
809 {0x02, "Keyboard POSTFail"},
810 {0x03, "Keyboard ErrorUndefined"},
811 {0x04, "Keyboard a and A"},
812 {0x05, "Keyboard b and B"},
813 {0x06, "Keyboard c and C"},
814 {0x07, "Keyboard d and D"},
815 {0x08, "Keyboard e and E"},
816 {0x09, "Keyboard f and F"},
817 {0x0A, "Keyboard g and G"},
818 {0x0B, "Keyboard h and H"},
819 {0x0C, "Keyboard i and I"},
820 {0x0D, "Keyboard j and J"},
821 {0x0E, "Keyboard k and K"},
822 {0x0F, "Keyboard l and L"},
823 {0x10, "Keyboard m and M"},
824 {0x11, "Keyboard n and N"},
825 {0x12, "Keyboard o and O"},
826 {0x13, "Keyboard p and P"},
827 {0x14, "Keyboard q and Q"},
828 {0x15, "Keyboard r and R"},
829 {0x16, "Keyboard s and S"},
830 {0x17, "Keyboard t and T"},
831 {0x18, "Keyboard u and U"},
832 {0x19, "Keyboard v and V"},
833 {0x1A, "Keyboard w and W"},
834 {0x1B, "Keyboard x and X"},
835 {0x1C, "Keyboard y and Y"},
836 {0x1D, "Keyboard z and Z"},
837 {0x1E, "Keyboard 1 and !"},
838 {0x1F, "Keyboard 2 and @"},
839 {0x20, "Keyboard 3 and #"},
840 {0x21, "Keyboard 4 and $"},
841 {0x22, "Keyboard 5 and %"},
842 {0x23, "Keyboard 6 and ^"},
843 {0x24, "Keyboard 7 and &"},
844 {0x25, "Keyboard 8 and *"},
845 {0x26, "Keyboard 9 and ("},
846 {0x27, "Keyboard 0 and )"},
847 {0x28, "Keyboard Return (ENTER)"},
848 {0x29, "Keyboard ESCAPE"},
849 {0x2A, "Keyboard DELETE (Backspace)"},
850 {0x2B, "Keyboard Tab"},
851 {0x2C, "Keyboard Spacebar"},
852 {0x2D, "Keyboard - and (underscore)"},
853 {0x2E, "Keyboard = and +"},
854 {0x2F, "Keyboard [ and {"},
855 {0x30, "Keyboard ] and }"},
856 {0x31, "Keyboard \\ and |"},
857 {0x32, "Keyboard Non-US # and ~"},
858 {0x33, "Keyboard ; and :"},
859 {0x34, "Keyboard ' and \""},
860 {0x35, "Keyboard Grave Accent and Tilde"},
861 {0x36, "Keyboard , and <"},
862 {0x37, "Keyboard . and >"},
863 {0x38, "Keyboard / and ?"},
864 {0x39, "Keyboard Caps Lock"},
865 {0x3A, "Keyboard F1"},
866 {0x3B, "Keyboard F2"},
867 {0x3C, "Keyboard F3"},
868 {0x3D, "Keyboard F4"},
869 {0x3E, "Keyboard F5"},
870 {0x3F, "Keyboard F6"},
871 {0x40, "Keyboard F7"},
872 {0x41, "Keyboard F8"},
873 {0x42, "Keyboard F9"},
874 {0x43, "Keyboard F10"},
875 {0x44, "Keyboard F11"},
876 {0x45, "Keyboard F12"},
877 {0x46, "Keyboard PrintScreen"},
878 {0x47, "Keyboard Scroll Lock"},
879 {0x48, "Keyboard Pause"},
880 {0x49, "Keyboard Insert"},
881 {0x4A, "Keyboard Home"},
882 {0x4B, "Keyboard PageUp"},
883 {0x4C, "Keyboard Delete Forward"},
884 {0x4D, "Keyboard End"},
885 {0x4E, "Keyboard PageDown"},
886 {0x4F, "Keyboard RightArrow"},
887 {0x50, "Keyboard LeftArrow"},
888 {0x51, "Keyboard DownArrow"},
889 {0x52, "Keyboard UpArrow"},
890 {0x53, "Keypad Num Lock and Clear"},
891 {0x54, "Keypad /"},
892 {0x55, "Keypad *"},
893 {0x56, "Keypad -"},
894 {0x57, "Keypad +"},
895 {0x58, "Keypad ENTER"},
896 {0x59, "Keypad 1 and End"},
897 {0x5A, "Keypad 2 and Down Arrow"},
898 {0x5B, "Keypad 3 and PageDn"},
899 {0x5C, "Keypad 4 and Left Arrow"},
900 {0x5D, "Keypad 5"},
901 {0x5E, "Keypad 6 and Right Arrow"},
902 {0x5F, "Keypad 7 and Home"},
903 {0x60, "Keypad 8 and Up Arrow"},
904 {0x61, "Keypad 9 and PageUp"},
905 {0x62, "Keypad 0 and Insert"},
906 {0x63, "Keypad . and Delete"},
907 {0x64, "Keyboard Non-US \\ and |"},
908 {0x65, "Keyboard Application"},
909 {0x66, "Keyboard Power"},
910 {0x67, "Keypad ="},
911 {0x68, "Keyboard F13"},
912 {0x69, "Keyboard F14"},
913 {0x6A, "Keyboard F15"},
914 {0x6B, "Keyboard F16"},
915 {0x6C, "Keyboard F17"},
916 {0x6D, "Keyboard F18"},
917 {0x6E, "Keyboard F19"},
918 {0x6F, "Keyboard F20"},
919 {0x70, "Keyboard F21"},
920 {0x71, "Keyboard F22"},
921 {0x72, "Keyboard F23"},
922 {0x73, "Keyboard F24"},
923 {0x74, "Keyboard Execute"},
924 {0x75, "Keyboard Help"},
925 {0x76, "Keyboard Menu"},
926 {0x77, "Keyboard Select"},
927 {0x78, "Keyboard Stop"},
928 {0x79, "Keyboard Again"},
929 {0x7A, "Keyboard Undo"},
930 {0x7B, "Keyboard Cut"},
931 {0x7C, "Keyboard Copy"},
932 {0x7D, "Keyboard Paste"},
933 {0x7E, "Keyboard Find"},
934 {0x7F, "Keyboard Mute"},
935 {0x80, "Keyboard Volume Up"},
936 {0x81, "Keyboard Volume Down"},
937 {0x82, "Keyboard Locking Caps Lock"},
938 {0x83, "Keyboard Locking Num Lock"},
939 {0x84, "Keyboard Locking Scroll Lock"},
940 {0x85, "Keypad Comma"},
941 {0x86, "Keypad Equal Sign"},
942 {0x87, "Keyboard International1"},
943 {0x88, "Keyboard International2"},
944 {0x89, "Keyboard International3"},
945 {0x8A, "Keyboard International4"},
946 {0x8B, "Keyboard International5"},
947 {0x8C, "Keyboard International6"},
948 {0x8D, "Keyboard International7"},
949 {0x8E, "Keyboard International8"},
950 {0x8F, "Keyboard International9"},
951 {0x90, "Keyboard LANG1"},
952 {0x91, "Keyboard LANG2"},
953 {0x92, "Keyboard LANG3"},
954 {0x93, "Keyboard LANG4"},
955 {0x94, "Keyboard LANG5"},
956 {0x95, "Keyboard LANG6"},
957 {0x96, "Keyboard LANG7"},
958 {0x97, "Keyboard LANG8"},
959 {0x98, "Keyboard LANG9"},
960 {0x99, "Keyboard Alternate Erase"},
961 {0x9A, "Keyboard SysReq/Attention"},
962 {0x9B, "Keyboard Cancel"},
963 {0x9C, "Keyboard Clear"},
964 {0x9D, "Keyboard Prior"},
965 {0x9E, "Keyboard Return"},
966 {0x9F, "Keyboard Separator"},
967 {0xA0, "Keyboard Out"},
968 {0xA1, "Keyboard Oper"},
969 {0xA2, "Keyboard Clear/Again"},
970 {0xA3, "Keyboard CrSel/Props"},
971 {0xA4, "Keyboard ExSel"},
972 {0xB0, "Keypad 00"},
973 {0xB1, "Keypad 000"},
974 {0xB2, "Thousands Separator"},
975 {0xB3, "Decimal Separator"},
976 {0xB4, "Currency Unit"},
977 {0xB5, "Currency Sub-unit"},
978 {0xB6, "Keypad ("},
979 {0xB7, "Keypad )"},
980 {0xB8, "Keypad {"},
981 {0xB9, "Keypad }"},
982 {0xBA, "Keypad Tab"},
983 {0xBB, "Keypad Backspace"},
984 {0xBC, "Keypad A"},
985 {0xBD, "Keypad B"},
986 {0xBE, "Keypad C"},
987 {0xBF, "Keypad D"},
988 {0xC0, "Keypad E"},
989 {0xC1, "Keypad F"},
990 {0xC2, "Keypad XOR"},
991 {0xC3, "Keypad ^"},
992 {0xC4, "Keypad %"},
993 {0xC5, "Keypad <"},
994 {0xC6, "Keypad >"},
995 {0xC7, "Keypad &"},
996 {0xC8, "Keypad &&"},
997 {0xC9, "Keypad |"},
998 {0xCA, "Keypad ||"},
999 {0xCB, "Keypad :"},
1000 {0xCC, "Keypad #"},
1001 {0xCD, "Keypad Space"},
1002 {0xCE, "Keypad @"},
1003 {0xCF, "Keypad !"},
1004 {0xD0, "Keypad Memory Store"},
1005 {0xD1, "Keypad Memory Recall"},
1006 {0xD2, "Keypad Memory Clear"},
1007 {0xD3, "Keypad Memory Add"},
1008 {0xD4, "Keypad Memory Subtract"},
1009 {0xD5, "Keypad Memory Multiply"},
1010 {0xD6, "Keypad Memory Divide"},
1011 {0xD7, "Keypad +/-"},
1012 {0xD8, "Keypad Clear"},
1013 {0xD9, "Keypad Clear Entry"},
1014 {0xDA, "Keypad Binary"},
1015 {0xDB, "Keypad Octal"},
1016 {0xDC, "Keypad Decimal"},
1017 {0xDD, "Keypad Hexadecimal"},
1018 {0xE0, "Keyboard LeftControl"},
1019 {0xE1, "Keyboard LeftShift"},
1020 {0xE2, "Keyboard LeftAlt"},
1021 {0xE3, "Keyboard Left GUI"},
1022 {0xE4, "Keyboard RightControl"},
1023 {0xE5, "Keyboard RightShift"},
1024 {0xE6, "Keyboard RightAlt"},
1025 {0xE7, "Keyboard Right GUI"},
1026 {0, NULL}
1028 static const value_string usb_hid_led_usage_page_vals[] = {
1029 {0x00, "Undefined"},
1030 {0x01, "Num Lock"},
1031 {0x02, "Caps Lock"},
1032 {0x03, "Scroll Lock"},
1033 {0x04, "Compose"},
1034 {0x05, "Kana"},
1035 {0x06, "Power"},
1036 {0x07, "Shift"},
1037 {0x08, "Do Not Disturb"},
1038 {0x09, "Mute"},
1039 {0x0A, "Tone Enable"},
1040 {0x0B, "High Cut Filter"},
1041 {0x0C, "Low Cut Filter"},
1042 {0x0D, "Equalizer Enable"},
1043 {0x0E, "Sound Field On"},
1044 {0x0F, "Surround On"},
1045 {0x10, "Repeat"},
1046 {0x11, "Stereo"},
1047 {0x12, "Sampling Rate Detect"},
1048 {0x13, "Spinning"},
1049 {0x14, "CAV"},
1050 {0x15, "CLV"},
1051 {0x16, "Recording Format Detect"},
1052 {0x17, "Off-Hook"},
1053 {0x18, "Ring"},
1054 {0x19, "Message Waiting"},
1055 {0x1A, "Data Mode"},
1056 {0x1B, "Battery Operation"},
1057 {0x1C, "Battery OK"},
1058 {0x1D, "Battery Low"},
1059 {0x1E, "Speaker"},
1060 {0x1F, "Head Set"},
1061 {0x20, "Hold"},
1062 {0x21, "Microphone"},
1063 {0x22, "Coverage"},
1064 {0x23, "Night Mode"},
1065 {0x24, "Send Calls"},
1066 {0x25, "Call Pickup"},
1067 {0x26, "Conference"},
1068 {0x27, "Stand-by"},
1069 {0x28, "Camera On"},
1070 {0x29, "Camera Off"},
1071 {0x2A, "On-Line"},
1072 {0x2B, "Off-Line"},
1073 {0x2C, "Busy"},
1074 {0x2D, "Ready"},
1075 {0x2E, "Paper-Out"},
1076 {0x2F, "Paper-Jam"},
1077 {0x30, "Remote"},
1078 {0x31, "Forward"},
1079 {0x32, "Reverse"},
1080 {0x33, "Stop"},
1081 {0x34, "Rewind"},
1082 {0x35, "Fast Forward"},
1083 {0x36, "Play"},
1084 {0x37, "Pause"},
1085 {0x38, "Record"},
1086 {0x39, "Error"},
1087 {0x3A, "Usage Selected Indicator"},
1088 {0x3B, "Usage In Use Indicator"},
1089 {0x3C, "Usage Multi Mode Indicator"},
1090 {0x3D, "Indicator On"},
1091 {0x3E, "Indicator Flash"},
1092 {0x3F, "Indicator Slow Blink"},
1093 {0x40, "Indicator Fast Blink"},
1094 {0x41, "Indicator Off"},
1095 {0x42, "Flash On Time"},
1096 {0x43, "Slow Blink On Time"},
1097 {0x44, "Slow Blink Off Time"},
1098 {0x45, "Fast Blink On Time"},
1099 {0x46, "Fast Blink Off Time"},
1100 {0x47, "Usage Indicator Color"},
1101 {0x48, "Indicator Red"},
1102 {0x49, "Indicator Green"},
1103 {0x4A, "Indicator Amber"},
1104 {0x4B, "Generic Indicator"},
1105 {0x4C, "System Suspend"},
1106 {0x4D, "External Power Connected"},
1107 {0x4E, "Indicator Blue"},
1108 {0x4F, "Indicator Orange"},
1109 {0x50, "Good Status"},
1110 {0x51, "Warning Status"},
1111 {0x52, "RGB LED"},
1112 {0x53, "Red LED Channel"},
1113 {0x54, "Blue LED Channel"},
1114 {0x55, "Green LED Channel"},
1115 {0x56, "LED Intensity"},
1116 {0x57, "System Microphone Mute"},
1117 {0x60, "Player Indicator"},
1118 {0x61, "Player 1"},
1119 {0x62, "Player 2"},
1120 {0x63, "Player 3"},
1121 {0x64, "Player 4"},
1122 {0x65, "Player 5"},
1123 {0x66, "Player 6"},
1124 {0x67, "Player 7"},
1125 {0x68, "Player 8"},
1126 {0, NULL}
1128 static const value_string usb_hid_button_usage_page_vals[] = {
1129 {0x00, "No button pressed"},
1130 {0x01, "Button 1 (primary/trigger)"},
1131 {0x02, "Button 2 (secondary)"},
1132 {0x03, "Button 3 (tertiary)"},
1133 /* Other Buttons parsed as "Button %u" in get_usage_page_item_string */
1134 {0, NULL}
1136 static const value_string usb_hid_ordinal_usage_page_vals[] = {
1137 {0x00, "Reserved"},
1138 /* Instances parsed as "Instance %u" in get_usage_page_item_string */
1139 {0, NULL}
1141 static const value_string usb_hid_telephony_device_usage_page_vals[] = {
1142 {0x000, "Undefined"},
1143 {0x001, "Phone"},
1144 {0x002, "Answering Machine"},
1145 {0x003, "Message Controls"},
1146 {0x004, "Handset"},
1147 {0x005, "Headset"},
1148 {0x006, "Telephony Key Pad"},
1149 {0x007, "Programmable Button"},
1150 {0x020, "Hook Switch"},
1151 {0x021, "Flash"},
1152 {0x022, "Feature"},
1153 {0x023, "Hold"},
1154 {0x024, "Redial"},
1155 {0x025, "Transfer"},
1156 {0x026, "Drop"},
1157 {0x027, "Park"},
1158 {0x028, "Forward Calls"},
1159 {0x029, "Alternate Function"},
1160 {0x02A, "Line"},
1161 {0x02B, "Speaker Phone"},
1162 {0x02C, "Conference"},
1163 {0x02D, "Ring Enable"},
1164 {0x02E, "Ring Select"},
1165 {0x02F, "Phone Mute"},
1166 {0x030, "Caller ID"},
1167 {0x031, "Send"},
1168 {0x050, "Speed Dial"},
1169 {0x051, "Store Number"},
1170 {0x052, "Recall Number"},
1171 {0x053, "Phone Directory"},
1172 {0x070, "Voice Mail"},
1173 {0x071, "Screen Calls"},
1174 {0x072, "Do Not Disturb"},
1175 {0x073, "Message"},
1176 {0x074, "Answer On/Off"},
1177 {0x090, "Inside Dial Tone"},
1178 {0x091, "Outside Dial Tone"},
1179 {0x092, "Inside Ring Tone"},
1180 {0x093, "Outside Ring Tone"},
1181 {0x094, "Priority Ring Tone"},
1182 {0x095, "Inside Ringback"},
1183 {0x096, "Priority Ringback"},
1184 {0x097, "Line Busy Tone"},
1185 {0x098, "Reorder Tone"},
1186 {0x099, "Call Waiting Tone"},
1187 {0x09A, "Confirmation Tone 1"},
1188 {0x09B, "Confirmation Tone 2"},
1189 {0x09C, "Tones Off"},
1190 {0x09D, "Outside Ringback"},
1191 {0x09E, "Ringer"},
1192 {0x0B0, "Phone Key 0"},
1193 {0x0B1, "Phone Key 1"},
1194 {0x0B2, "Phone Key 2"},
1195 {0x0B3, "Phone Key 3"},
1196 {0x0B4, "Phone Key 4"},
1197 {0x0B5, "Phone Key 5"},
1198 {0x0B6, "Phone Key 6"},
1199 {0x0B7, "Phone Key 7"},
1200 {0x0B8, "Phone Key 8"},
1201 {0x0B9, "Phone Key 9"},
1202 {0x0BA, "Phone Key Star"},
1203 {0x0BB, "Phone Key Pound"},
1204 {0x0BC, "Phone Key A"},
1205 {0x0BD, "Phone Key B"},
1206 {0x0BE, "Phone Key C"},
1207 {0x0BF, "Phone Key D"},
1208 {0x0C0, "Phone Call History Key"},
1209 {0x0C1, "Phone Caller ID Key"},
1210 {0x0C2, "Phone Settings Key"},
1211 {0x0F0, "Host Control"},
1212 {0x0F1, "Host Available"},
1213 {0x0F2, "Host Call Active"},
1214 {0x0F3, "Activate Handset Audio"},
1215 {0x0F4, "Ring Type"},
1216 {0x0F5, "Re-dialable Phone Number"},
1217 {0x0F8, "Stop Ring Tone"},
1218 {0x0F9, "PSTN Ring Tone"},
1219 {0x0FA, "Host Ring Tone"},
1220 {0x0FB, "Alert Sound Error"},
1221 {0x0FC, "Alert Sound Confirm"},
1222 {0x0FD, "Alert Sound Notification"},
1223 {0x0FE, "Silent Ring"},
1224 {0x108, "Email Message Waiting"},
1225 {0x109, "Voicemail Message Waiting"},
1226 {0x10A, "Host Hold"},
1227 {0x110, "Incoming Call History Count"},
1228 {0x111, "Outgoing Call History Count"},
1229 {0x112, "Incoming Call History"},
1230 {0x113, "Outgoing Call History"},
1231 {0x114, "Phone Locale"},
1232 {0x140, "Phone Time Second"},
1233 {0x141, "Phone Time Minute"},
1234 {0x142, "Phone Time Hour"},
1235 {0x143, "Phone Date Day"},
1236 {0x144, "Phone Date Month"},
1237 {0x145, "Phone Date Year"},
1238 {0x146, "Handset Nickname"},
1239 {0x147, "Address Book ID"},
1240 {0x14A, "Call Duration"},
1241 {0x14B, "Dual Mode Phone"},
1242 {0, NULL}
1244 static const value_string usb_hid_consumer_usage_page_vals[] = {
1245 {0x000, "Undefined"},
1246 {0x001, "Consumer Control"},
1247 {0x002, "Numeric Key Pad"},
1248 {0x003, "Programmable Buttons"},
1249 {0x004, "Microphone"},
1250 {0x005, "Headphone"},
1251 {0x006, "Graphic Equalizer"},
1252 {0x020, "+10"},
1253 {0x021, "+100"},
1254 {0x022, "AM/PM"},
1255 {0x030, "Power"},
1256 {0x031, "Reset"},
1257 {0x032, "Sleep"},
1258 {0x033, "Sleep After"},
1259 {0x034, "Sleep Mode"},
1260 {0x035, "Illumination"},
1261 {0x036, "Function Buttons"},
1262 {0x040, "Menu"},
1263 {0x041, "Menu Pick"},
1264 {0x042, "Menu Up"},
1265 {0x043, "Menu Down"},
1266 {0x044, "Menu Left"},
1267 {0x045, "Menu Right"},
1268 {0x046, "Menu Escape"},
1269 {0x047, "Menu Value Increase"},
1270 {0x048, "Menu Value Decrease"},
1271 {0x060, "Data On Screen"},
1272 {0x061, "Closed Caption"},
1273 {0x062, "Closed Caption Select"},
1274 {0x063, "VCR/TV"},
1275 {0x064, "Broadcast Mode"},
1276 {0x065, "Snapshot"},
1277 {0x066, "Still"},
1278 {0x067, "Picture-in-Picture Toggle"},
1279 {0x068, "Picture-in-Picture Swap"},
1280 {0x069, "Red Menu Button"},
1281 {0x06A, "Green Menu Button"},
1282 {0x06B, "Blue Menu Button"},
1283 {0x06C, "Yellow Menu Button"},
1284 {0x06D, "Aspect"},
1285 {0x06E, "3D Mode Select"},
1286 {0x06F, "Display Brightness Increment"},
1287 {0x070, "Display Brightness Decrement"},
1288 {0x071, "Display Brightness"},
1289 {0x072, "Display Backlight Toggle"},
1290 {0x073, "Display Set Brightness to Minimum"},
1291 {0x074, "Display Set Brightness to Maximum"},
1292 {0x075, "Display Set Auto Brightness"},
1293 {0x076, "Camera Access Enabled"},
1294 {0x077, "Camera Access Disabled"},
1295 {0x078, "Camera Access Toggle"},
1296 {0x079, "Keyboard Brightness Increment"},
1297 {0x07A, "Keyboard Brightness Decrement"},
1298 {0x07B, "Keyboard Backlight Set Level"},
1299 {0x07C, "Keyboard Backlight OOC"},
1300 {0x07D, "Keyboard Backlight Set Minimum"},
1301 {0x07E, "Keyboard Backlight Set Maximum"},
1302 {0x07F, "Keyboard Backlight Auto"},
1303 {0x080, "Selection"},
1304 {0x081, "Assign Selection"},
1305 {0x082, "Mode Step"},
1306 {0x083, "Recall Last"},
1307 {0x084, "Enter Channel"},
1308 {0x085, "Order Movie"},
1309 {0x086, "Channel"},
1310 {0x087, "Media Selection"},
1311 {0x088, "Media Select Computer"},
1312 {0x089, "Media Select TV"},
1313 {0x08A, "Media Select WWW"},
1314 {0x08B, "Media Select DVD"},
1315 {0x08C, "Media Select Telephone"},
1316 {0x08D, "Media Select Program Guide"},
1317 {0x08E, "Media Select Video Phone"},
1318 {0x08F, "Media Select Games"},
1319 {0x090, "Media Select Messages"},
1320 {0x091, "Media Select CD"},
1321 {0x092, "Media Select VCR"},
1322 {0x093, "Media Select Tuner"},
1323 {0x094, "Quit"},
1324 {0x095, "Help"},
1325 {0x096, "Media Select Tape"},
1326 {0x097, "Media Select Cable"},
1327 {0x098, "Media Select Satellite"},
1328 {0x099, "Media Select Security"},
1329 {0x09A, "Media Select Home"},
1330 {0x09B, "Media Select Call"},
1331 {0x09C, "Channel Increment"},
1332 {0x09D, "Channel Decrement"},
1333 {0x09E, "Media Select SAP"},
1334 {0x0A0, "VCR Plus"},
1335 {0x0A1, "Once"},
1336 {0x0A2, "Daily"},
1337 {0x0A3, "Weekly"},
1338 {0x0A4, "Monthly"},
1339 {0x0B0, "Play"},
1340 {0x0B1, "Pause"},
1341 {0x0B2, "Record"},
1342 {0x0B3, "Fast Forward"},
1343 {0x0B4, "Rewind"},
1344 {0x0B5, "Scan Next Track"},
1345 {0x0B6, "Scan Previous Track"},
1346 {0x0B7, "Stop"},
1347 {0x0B8, "Eject"},
1348 {0x0B9, "Random Play"},
1349 {0x0BA, "Select Disc"},
1350 {0x0BB, "Enter Disc"},
1351 {0x0BC, "Repeat"},
1352 {0x0BD, "Tracking"},
1353 {0x0BE, "Track Normal"},
1354 {0x0BF, "Slow Tracking"},
1355 {0x0C0, "Frame Forward"},
1356 {0x0C1, "Frame Back"},
1357 {0x0C2, "Mark"},
1358 {0x0C3, "Clear Mark"},
1359 {0x0C4, "Repeat From Mark"},
1360 {0x0C5, "Return To Mark"},
1361 {0x0C6, "Search Mark Forward"},
1362 {0x0C7, "Search Mark Backwards"},
1363 {0x0C8, "Counter Reset"},
1364 {0x0C9, "Show Counter"},
1365 {0x0CA, "Tracking Increment"},
1366 {0x0CB, "Tracking Decrement"},
1367 {0x0CC, "Stop/Eject"},
1368 {0x0CD, "Play/Pause"},
1369 {0x0CE, "Play/Skip"},
1370 {0x0CF, "Voice Command"},
1371 {0x0D0, "Invoke Capture Interface"},
1372 {0x0D1, "Start or Stop Game Recording"},
1373 {0x0D2, "Historical Game Capture"},
1374 {0x0D3, "Capture Game Screenshot"},
1375 {0x0D4, "Show or Hide Recording Indicator"},
1376 {0x0D5, "Start or Stop Microphone Capture"},
1377 {0x0D6, "Start or Stop Camera Capture"},
1378 {0x0D7, "Start or Stop Game Broadcast"},
1379 {0x0D8, "Start or Stop Voice Dictation Session"},
1380 {0x0D9, "Invoke/Dismiss Emoji Picker"},
1381 {0x0E0, "Volume"},
1382 {0x0E1, "Balance"},
1383 {0x0E2, "Mute"},
1384 {0x0E3, "Bass"},
1385 {0x0E4, "Treble"},
1386 {0x0E5, "Bass Boost"},
1387 {0x0E6, "Surround Mode"},
1388 {0x0E7, "Loudness"},
1389 {0x0E8, "MPX"},
1390 {0x0E9, "Volume Increment"},
1391 {0x0EA, "Volume Decrement"},
1392 {0x0F0, "Speed Select"},
1393 {0x0F1, "Playback Speed"},
1394 {0x0F2, "Standard Play"},
1395 {0x0F3, "Long Play"},
1396 {0x0F4, "Extended Play"},
1397 {0x0F5, "Slow"},
1398 {0x100, "Fan Enable"},
1399 {0x101, "Fan Speed"},
1400 {0x102, "Light Enable"},
1401 {0x103, "Light Illumination Level"},
1402 {0x104, "Climate Control Enable"},
1403 {0x105, "Room Temperature"},
1404 {0x106, "Security Enable"},
1405 {0x107, "Fire Alarm"},
1406 {0x108, "Police Alarm"},
1407 {0x109, "Proximity"},
1408 {0x10A, "Motion"},
1409 {0x10B, "Duress Alarm"},
1410 {0x10C, "Holdup Alarm"},
1411 {0x10D, "Medical Alarm"},
1412 {0x150, "Balance Right"},
1413 {0x151, "Balance Left"},
1414 {0x152, "Bass Increment"},
1415 {0x153, "Bass Decrement"},
1416 {0x154, "Treble Increment"},
1417 {0x155, "Treble Decrement"},
1418 {0x160, "Speaker System"},
1419 {0x161, "Channel Left"},
1420 {0x162, "Channel Right"},
1421 {0x163, "Channel Center"},
1422 {0x164, "Channel Front"},
1423 {0x165, "Channel Center Front"},
1424 {0x166, "Channel Side"},
1425 {0x167, "Channel Surround"},
1426 {0x168, "Channel Low Frequency Enhancement"},
1427 {0x169, "Channel Top"},
1428 {0x16A, "Channel Unknown"},
1429 {0x170, "Sub-channel"},
1430 {0x171, "Sub-channel Increment"},
1431 {0x172, "Sub-channel Decrement"},
1432 {0x173, "Alternate Audio Increment"},
1433 {0x174, "Alternate Audio Decrement"},
1434 {0x180, "Application Launch Buttons"},
1435 {0x181, "AL Launch Button Configuration Tool"},
1436 {0x182, "AL Programmable Button Configuration"},
1437 {0x183, "AL Consumer Control Configuration"},
1438 {0x184, "AL Word Processor"},
1439 {0x185, "AL Text Editor"},
1440 {0x186, "AL Spreadsheet"},
1441 {0x187, "AL Graphics Editor"},
1442 {0x188, "AL Presentation App"},
1443 {0x189, "AL Database App"},
1444 {0x18A, "AL Email Reader"},
1445 {0x18B, "AL Newsreader"},
1446 {0x18C, "AL Voicemail"},
1447 {0x18D, "AL Contacts/Address Book"},
1448 {0x18E, "AL Calendar/Schedule"},
1449 {0x18F, "AL Task/Project Manager"},
1450 {0x190, "AL Log/Journal/Timecard"},
1451 {0x191, "AL Checkbook/Finance"},
1452 {0x192, "AL Calculator"},
1453 {0x193, "AL A/V Capture/Playback"},
1454 {0x194, "AL Local Machine Browser"},
1455 {0x195, "AL LAN/WAN Browser"},
1456 {0x196, "AL Internet Browser"},
1457 {0x197, "AL Remote Networking/ISP Connect"},
1458 {0x198, "AL Network Conference"},
1459 {0x199, "AL Network Chat"},
1460 {0x19A, "AL Telephony/Dialer"},
1461 {0x19B, "AL Logon"},
1462 {0x19C, "AL Logoff"},
1463 {0x19D, "AL Logon/Logoff"},
1464 {0x19E, "AL Terminal Lock/Screensaver"},
1465 {0x19F, "AL Control Panel"},
1466 {0x1A0, "AL Command Line Processor/Run"},
1467 {0x1A1, "AL Process/Task Manager"},
1468 {0x1A2, "AL Select Task/Application"},
1469 {0x1A3, "AL Next Task/Application"},
1470 {0x1A4, "AL Previous Task/Application"},
1471 {0x1A5, "AL Preemptive Halt Task/Application"},
1472 {0x1A6, "AL Integrated Help Center"},
1473 {0x1A7, "AL Documents"},
1474 {0x1A8, "AL Thesaurus"},
1475 {0x1A9, "AL Dictionary"},
1476 {0x1AA, "AL Desktop"},
1477 {0x1AB, "AL Spell Check"},
1478 {0x1AC, "AL Grammar Check"},
1479 {0x1AD, "AL Wireless Status"},
1480 {0x1AE, "AL Keyboard Layout"},
1481 {0x1AF, "AL Virus Protection"},
1482 {0x1B0, "AL Encryption"},
1483 {0x1B1, "AL Screen Saver"},
1484 {0x1B2, "AL Alarms"},
1485 {0x1B3, "AL Clock"},
1486 {0x1B4, "AL File Browser"},
1487 {0x1B5, "AL Power Status"},
1488 {0x1B6, "AL Image Browser"},
1489 {0x1B7, "AL Audio Browser"},
1490 {0x1B8, "AL Movie Browser"},
1491 {0x1B9, "AL Digital Rights Manager"},
1492 {0x1BA, "AL Digital Wallet"},
1493 {0x1BC, "AL Instant Messaging"},
1494 {0x1BD, "AL OEM Features/ Tips/Tutorial Browser"},
1495 {0x1BE, "AL OEM Help"},
1496 {0x1BF, "AL Online Community"},
1497 {0x1C0, "AL Entertainment Content Browser"},
1498 {0x1C1, "AL Online Shopping Browser"},
1499 {0x1C2, "AL SmartCard Information/Help"},
1500 {0x1C3, "AL Market Monitor/Finance Browser"},
1501 {0x1C4, "AL Customized Corporate News Browser"},
1502 {0x1C5, "AL Online Activity Browser"},
1503 {0x1C6, "AL Research/Search Browser"},
1504 {0x1C7, "AL Audio Player"},
1505 {0x1C8, "AL Message Status"},
1506 {0x1C9, "AL Contact Sync"},
1507 {0x1CA, "AL Navigation"},
1508 {0x1CB, "AL Context-aware Desktop Assistant"},
1509 {0x200, "Generic GUI Application Controls"},
1510 {0x201, "AC New"},
1511 {0x202, "AC Open"},
1512 {0x203, "AC Close"},
1513 {0x204, "AC Exit"},
1514 {0x205, "AC Maximize"},
1515 {0x206, "AC Minimize"},
1516 {0x207, "AC Save"},
1517 {0x208, "AC Print"},
1518 {0x209, "AC Properties"},
1519 {0x21A, "AC Undo"},
1520 {0x21B, "AC Copy"},
1521 {0x21C, "AC Cut"},
1522 {0x21D, "AC Paste"},
1523 {0x21E, "AC Select All"},
1524 {0x21F, "AC Find"},
1525 {0x220, "AC Find and Replace"},
1526 {0x221, "AC Search"},
1527 {0x222, "AC Go To"},
1528 {0x223, "AC Home"},
1529 {0x224, "AC Back"},
1530 {0x225, "AC Forward"},
1531 {0x226, "AC Stop"},
1532 {0x227, "AC Refresh"},
1533 {0x228, "AC Previous Link"},
1534 {0x229, "AC Next Link"},
1535 {0x22A, "AC Bookmarks"},
1536 {0x22B, "AC History"},
1537 {0x22C, "AC Subscriptions"},
1538 {0x22D, "AC Zoom In"},
1539 {0x22E, "AC Zoom Out"},
1540 {0x22F, "AC Zoom"},
1541 {0x230, "AC Full Screen View"},
1542 {0x231, "AC Normal View"},
1543 {0x232, "AC View Toggle"},
1544 {0x233, "AC Scroll Up"},
1545 {0x234, "AC Scroll Down"},
1546 {0x235, "AC Scroll"},
1547 {0x236, "AC Pan Left"},
1548 {0x237, "AC Pan Right"},
1549 {0x238, "AC Pan"},
1550 {0x239, "AC New Window"},
1551 {0x23A, "AC Tile Horizontally"},
1552 {0x23B, "AC Tile Vertically"},
1553 {0x23C, "AC Format"},
1554 {0x23D, "AC Edit"},
1555 {0x23E, "AC Bold"},
1556 {0x23F, "AC Italics"},
1557 {0x240, "AC Underline"},
1558 {0x241, "AC Strikethrough"},
1559 {0x242, "AC Subscript"},
1560 {0x243, "AC Superscript"},
1561 {0x244, "AC All Caps"},
1562 {0x245, "AC Rotate"},
1563 {0x246, "AC Resize"},
1564 {0x247, "AC Flip Horizontal"},
1565 {0x248, "AC Flip Vertical"},
1566 {0x249, "AC Mirror Horizontal"},
1567 {0x24A, "AC Mirror Vertical"},
1568 {0x24B, "AC Font Select"},
1569 {0x24C, "AC Font Color"},
1570 {0x24D, "AC Font Size"},
1571 {0x24E, "AC Justify Left"},
1572 {0x24F, "AC Justify Center H"},
1573 {0x250, "AC Justify Right"},
1574 {0x251, "AC Justify Block H"},
1575 {0x252, "AC Justify Top"},
1576 {0x253, "AC Justify Center V"},
1577 {0x254, "AC Justify Bottom"},
1578 {0x255, "AC Justify Block V"},
1579 {0x256, "AC Indent Decrease"},
1580 {0x257, "AC Indent Increase"},
1581 {0x258, "AC Numbered List"},
1582 {0x259, "AC Restart Numbering"},
1583 {0x25A, "AC Bulleted List"},
1584 {0x25B, "AC Promote"},
1585 {0x25C, "AC Demote"},
1586 {0x25D, "AC Yes"},
1587 {0x25E, "AC No"},
1588 {0x25F, "AC Cancel"},
1589 {0x260, "AC Catalog"},
1590 {0x261, "AC Buy/Checkout"},
1591 {0x262, "AC Add to Cart"},
1592 {0x263, "AC Expand"},
1593 {0x264, "AC Expand All"},
1594 {0x265, "AC Collapse"},
1595 {0x266, "AC Collapse All"},
1596 {0x267, "AC Print Preview"},
1597 {0x268, "AC Paste Special"},
1598 {0x269, "AC Insert Mode"},
1599 {0x26A, "AC Delete"},
1600 {0x26B, "AC Lock"},
1601 {0x26C, "AC Unlock"},
1602 {0x26D, "AC Protect"},
1603 {0x26E, "AC Unprotect"},
1604 {0x26F, "AC Attach Comment"},
1605 {0x270, "AC Delete Comment"},
1606 {0x271, "AC View Comment"},
1607 {0x272, "AC Select Word"},
1608 {0x273, "AC Select Sentence"},
1609 {0x274, "AC Select Paragraph"},
1610 {0x275, "AC Select Column"},
1611 {0x276, "AC Select Row"},
1612 {0x277, "AC Select Table"},
1613 {0x278, "AC Select Object"},
1614 {0x279, "AC Redo/Repeat"},
1615 {0x27A, "AC Sort"},
1616 {0x27B, "AC Sort Ascending"},
1617 {0x27C, "AC Sort Descending"},
1618 {0x27D, "AC Filter"},
1619 {0x27E, "AC Set Clock"},
1620 {0x27F, "AC View Clock"},
1621 {0x280, "AC Select Time Zone"},
1622 {0x281, "AC Edit Time Zones"},
1623 {0x282, "AC Set Alarm"},
1624 {0x283, "AC Clear Alarm"},
1625 {0x284, "AC Snooze Alarm"},
1626 {0x285, "AC Reset Alarm"},
1627 {0x286, "AC Synchronize"},
1628 {0x287, "AC Send/Receive"},
1629 {0x288, "AC Send To"},
1630 {0x289, "AC Reply"},
1631 {0x28A, "AC Reply All"},
1632 {0x28B, "AC Forward Msg"},
1633 {0x28C, "AC Send"},
1634 {0x28D, "AC Attach File"},
1635 {0x28E, "AC Upload"},
1636 {0x28F, "AC Download (Save Target As)"},
1637 {0x290, "AC Set Borders"},
1638 {0x291, "AC Insert Row"},
1639 {0x292, "AC Insert Column"},
1640 {0x293, "AC Insert File"},
1641 {0x294, "AC Insert Picture"},
1642 {0x295, "AC Insert Object"},
1643 {0x296, "AC Insert Symbol"},
1644 {0x297, "AC Save and Close"},
1645 {0x298, "AC Rename"},
1646 {0x299, "AC Merge"},
1647 {0x29A, "AC Split"},
1648 {0x29B, "AC Distribute Horizontally"},
1649 {0x29C, "AC Distribute Vertically"},
1650 {0x29D, "AC Next Keyboard Layout Select"},
1651 {0x29E, "AC Navigation Guidance"},
1652 {0x29F, "AC Desktop Show All Windows"},
1653 {0x2A0, "AC Soft Key Left"},
1654 {0x2A1, "AC Soft Key Right"},
1655 {0x2A2, "AC Desktop Show All Applications"},
1656 {0x2B0, "AC Idle Keep Alive"},
1657 {0x2C0, "Extended Keyboard Attributes Collection"},
1658 {0x2C1, "Keyboard Form Factor"},
1659 {0x2C2, "Keyboard Key Type"},
1660 {0x2C3, "Keyboard Physical Layout"},
1661 {0x2C4, "Vendor-Specific Keyboard Physical Layout"},
1662 {0x2C5, "Keyboard IETF Language Tag Index"},
1663 {0x2C6, "Implemented Keyboard Input Assist Controls"},
1664 {0x2C7, "Keyboard Input Assist Previous"},
1665 {0x2C8, "Keyboard Input Assist Next"},
1666 {0x2C9, "Keyboard Input Assist Previous Group"},
1667 {0x2CA, "Keyboard Input Assist Next Group"},
1668 {0x2CB, "Keyboard Input Assist Accept"},
1669 {0x2CC, "Keyboard Input Assist Cancel"},
1670 {0x2D0, "Privacy Screen Toggle"},
1671 {0x2D1, "Privacy Screen Level Decrement"},
1672 {0x2D2, "Privacy Screen Level Increment"},
1673 {0x2D3, "Privacy Screen Level Minimum"},
1674 {0x2D4, "Privacy Screen Level Maximum"},
1675 {0x500, "Contact Edited"},
1676 {0x501, "Contact Added"},
1677 {0x502, "Contact Record Active"},
1678 {0x503, "Contact Index"},
1679 {0x504, "Contact Nickname"},
1680 {0x505, "Contact First Name"},
1681 {0x506, "Contact Last Name"},
1682 {0x507, "Contact Full Name"},
1683 {0x508, "Contact Phone Number Personal"},
1684 {0x509, "Contact Phone Number Business"},
1685 {0x50A, "Contact Phone Number Mobile"},
1686 {0x50B, "Contact Phone Number Pager"},
1687 {0x50C, "Contact Phone Number Fax"},
1688 {0x50D, "Contact Phone Number Other"},
1689 {0x50E, "Contact Email Personal"},
1690 {0x50F, "Contact Email Business"},
1691 {0x510, "Contact Email Other"},
1692 {0x511, "Contact Email Main"},
1693 {0x512, "Contact Speed Dial Number"},
1694 {0x513, "Contact Status Flag"},
1695 {0x514, "Contact Misc."},
1696 {0, NULL}
1698 static const value_string usb_hid_digitizers_usage_page_vals[] = {
1699 {0x00, "Undefined"},
1700 {0x01, "Digitizer"},
1701 {0x02, "Pen"},
1702 {0x03, "Light Pen"},
1703 {0x04, "Touch Screen"},
1704 {0x05, "Touch Pad"},
1705 {0x06, "Whiteboard"},
1706 {0x07, "Coordinate Measuring Machine"},
1707 {0x08, "3D Digitizer"},
1708 {0x09, "Stereo Plotter"},
1709 {0x0A, "Articulated Arm"},
1710 {0x0B, "Armature"},
1711 {0x0C, "Multiple Point Digitizer"},
1712 {0x0D, "Free Space Wand"},
1713 {0x0E, "Device Configuration"},
1714 {0x0F, "Capacitive Heat Map Digitizer"},
1715 {0x20, "Stylus"},
1716 {0x21, "Puck"},
1717 {0x22, "Finger"},
1718 {0x23, "Device settings"},
1719 {0x24, "Character Gesture"},
1720 {0x30, "Tip Pressure"},
1721 {0x31, "Barrel Pressure"},
1722 {0x32, "In Range"},
1723 {0x33, "Touch"},
1724 {0x34, "Untouch"},
1725 {0x35, "Tap"},
1726 {0x36, "Quality"},
1727 {0x37, "Data Valid"},
1728 {0x38, "Transducer Index"},
1729 {0x39, "Tablet Function Keys"},
1730 {0x3A, "Program Change Keys"},
1731 {0x3B, "Battery Strength"},
1732 {0x3C, "Invert"},
1733 {0x3D, "X Tilt"},
1734 {0x3E, "Y Tilt"},
1735 {0x3F, "Azimuth"},
1736 {0x40, "Altitude"},
1737 {0x41, "Twist"},
1738 {0x42, "Tip Switch"},
1739 {0x43, "Secondary Tip Switch"},
1740 {0x44, "Barrel Switch"},
1741 {0x45, "Eraser"},
1742 {0x46, "Tablet Pick"},
1743 {0x47, "Touch Valid"},
1744 {0x48, "Width"},
1745 {0x49, "Height"},
1746 {0x51, "Contact Identifier"},
1747 {0x52, "Device Mode"},
1748 {0x53, "Device Identifier"},
1749 {0x54, "Contact Count"},
1750 {0x55, "Contact Count Maximum"},
1751 {0x56, "Scan Time"},
1752 {0x57, "Surface Switch"},
1753 {0x58, "Button Switch"},
1754 {0x59, "Pad Type"},
1755 {0x5A, "Secondary Barrel Switch"},
1756 {0x5B, "Transducer Serial Number"},
1757 {0x5C, "Preferred Color"},
1758 {0x5D, "Preferred Color is Locked"},
1759 {0x5E, "Preferred Line Width"},
1760 {0x5F, "Preferred Line Width is Locked"},
1761 {0x60, "Latency Mode"},
1762 {0x61, "Gesture Character Quality"},
1763 {0x62, "Character Gesture Data Length"},
1764 {0x63, "Character Gesture Data"},
1765 {0x64, "Gesture Character Encoding"},
1766 {0x65, "UTF8 Character Gesture Encoding"},
1767 {0x66, "UTF16 Little Endian Character Gesture Encoding"},
1768 {0x67, "UTF16 Big Endian Character Gesture Encoding"},
1769 {0x68, "UTF32 Little Endian Character Gesture Encoding"},
1770 {0x69, "UTF32 Big Endian Character Gesture Encoding"},
1771 {0x6A, "Capacitive Heat Map Protocol Vendor ID"},
1772 {0x6B, "Capacitive Heat Map Protocol Version"},
1773 {0x6C, "Capacitive Heat Map Frame Data"},
1774 {0x6D, "Gesture Character Enable"},
1775 {0x6E, "Transducer Serial Number Part 2"},
1776 {0x6F, "No Preferred Color"},
1777 {0x70, "Preferred Line Style"},
1778 {0x71, "Preferred Line Style is Locked"},
1779 {0x72, "Ink"},
1780 {0x73, "Pencil"},
1781 {0x74, "Highlighter"},
1782 {0x75, "Chisel Marker"},
1783 {0x76, "Brush"},
1784 {0x77, "No Preference"},
1785 {0x80, "Digitizer Diagnostic"},
1786 {0x81, "Digitizer Error"},
1787 {0x82, "Err Normal Status"},
1788 {0x83, "Err Transducers Exceeded"},
1789 {0x84, "Err Full Trans Features Unavailable"},
1790 {0x85, "Err Charge Low"},
1791 {0x90, "Transducer Software Info"},
1792 {0x91, "Transducer Vendor Id"},
1793 {0x92, "Transducer Product Id"},
1794 {0x93, "Device Supported Protocols"},
1795 {0x94, "Transducer Supported Protocols"},
1796 {0x95, "No Protocol"},
1797 {0x96, "Wacom AES Protocol"},
1798 {0x97, "USI Protocol"},
1799 {0x98, "Microsoft Pen Protocol"},
1800 {0xA0, "Supported Report Rates"},
1801 {0xA1, "Report Rate"},
1802 {0xA2, "Transducer Connected"},
1803 {0xA3, "Switch Disabled"},
1804 {0xA4, "Switch Unimplemented"},
1805 {0xA5, "Transducer Switches"},
1806 {0xA6, "Transducer Index Selector"},
1807 {0xB0, "Button Press Threshold"},
1808 {0, NULL}
1810 static const value_string usb_hid_haptic_usage_page_vals[] = {
1811 {0x0000, "Undefined"},
1812 {0x0001, "Simple Haptic Controller"},
1813 {0x0010, "Waveform List"},
1814 {0x0011, "Duration List"},
1815 {0x0020, "Auto Trigger"},
1816 {0x0021, "Manual Trigger"},
1817 {0x0022, "Auto Trigger Associated Control"},
1818 {0x0023, "Intensity"},
1819 {0x0024, "Repeat Count"},
1820 {0x0025, "Retrigger Period"},
1821 {0x0026, "Waveform Vendor Page"},
1822 {0x0027, "Waveform Vendor ID"},
1823 {0x0028, "Waveform Cutoff Time"},
1824 {0x1001, "Waveform None"},
1825 {0x1002, "Waveform Stop"},
1826 {0x1003, "Waveform Click"},
1827 {0x1004, "Waveform Buzz Continuous"},
1828 {0x1005, "Waveform Rumble Continuous"},
1829 {0x1006, "Waveform Press"},
1830 {0x1007, "Waveform Release"},
1831 {0x1008, "Waveform Hover"},
1832 {0x1009, "Waveform Success"},
1833 {0x100A, "Waveform Error"},
1834 {0x100B, "Waveform Ink Continuous"},
1835 {0x100C, "Waveform Pencil Continuous"},
1836 {0x100D, "Waveform Marker Continuous"},
1837 {0x100E, "Waveform Chisel Marker Continuous"},
1838 {0x100F, "Waveform Brush Continuous"},
1839 {0x1010, "Waveform Eraser Continuous"},
1840 {0x1011, "Waveform Sparkle Continuous"},
1841 {0, NULL}
1843 static const value_string usb_hid_physical_input_device_usage_page_vals[] = {
1844 {0x00, "Undefined"},
1845 {0x01, "Physical Interface Device"},
1846 {0x20, "Normal"},
1847 {0x21, "Set Effect Report"},
1848 {0x22, "Effect Block Index"},
1849 {0x23, "Parameter Block Offset"},
1850 {0x24, "ROM Flag"},
1851 {0x25, "Effect Type"},
1852 {0x26, "ET Constant Force"},
1853 {0x27, "ET Ramp"},
1854 {0x28, "ET Custom Force Data"},
1855 {0x30, "ET Square"},
1856 {0x31, "ET Sine"},
1857 {0x32, "ET Triangle"},
1858 {0x33, "ET Sawtooth Up"},
1859 {0x34, "ET Sawtooth Down"},
1860 {0x40, "ET Spring"},
1861 {0x41, "ET Damper"},
1862 {0x42, "ET Inertia"},
1863 {0x43, "ET Friction"},
1864 {0x50, "Duration"},
1865 {0x51, "Sample Period"},
1866 {0x52, "Gain"},
1867 {0x53, "Trigger Button"},
1868 {0x54, "Trigger Repeat Interval"},
1869 {0x55, "Axes Enable"},
1870 {0x56, "Direction Enable"},
1871 {0x57, "Direction"},
1872 {0x58, "Type Specific Block Offset"},
1873 {0x59, "Block Type"},
1874 {0x5A, "Set Envelope Report"},
1875 {0x5B, "Attack Level"},
1876 {0x5C, "Attack Time"},
1877 {0x5D, "Fade Level"},
1878 {0x5E, "Fade Time"},
1879 {0x5F, "Set Condition Report"},
1880 {0x60, "CP Offset"},
1881 {0x61, "Positive Coefficient"},
1882 {0x62, "Negative Coefficient"},
1883 {0x63, "Positive Saturation"},
1884 {0x64, "Negative Saturation"},
1885 {0x65, "Dead Band"},
1886 {0x66, "Download Force Sample"},
1887 {0x67, "Isoch Custom Force Enable"},
1888 {0x68, "Custom Force Data Report"},
1889 {0x69, "Custom Force Data"},
1890 {0x6A, "Custom Force Vendor Defined Data"},
1891 {0x6B, "Set Custom Force Report"},
1892 {0x6C, "Custom Force Data Offset"},
1893 {0x6D, "Sample Count"},
1894 {0x6E, "Set Periodic Report"},
1895 {0x6F, "Offset"},
1896 {0x70, "Magnitude"},
1897 {0x71, "Phase"},
1898 {0x72, "Period"},
1899 {0x73, "Set Constant Force Report"},
1900 {0x74, "Set Ramp Force Report"},
1901 {0x75, "Ramp Start"},
1902 {0x76, "Ramp End"},
1903 {0x77, "Effect Operation Report"},
1904 {0x78, "Effect Operation"},
1905 {0x79, "Op Effect Start"},
1906 {0x7A, "Op Effect Start Solo"},
1907 {0x7B, "Op Effect Stop"},
1908 {0x7C, "Loop Count"},
1909 {0x7D, "Device Gain Report"},
1910 {0x7E, "Device Gain"},
1911 {0x7F, "PID Pool Report"},
1912 {0x80, "RAM Pool Size"},
1913 {0x81, "ROM Pool Size"},
1914 {0x82, "ROM Effect Block Count"},
1915 {0x83, "Simultaneous Effects Max"},
1916 {0x84, "Pool Alignment"},
1917 {0x85, "PID Pool Move Report"},
1918 {0x86, "Move Source"},
1919 {0x87, "Move Destination"},
1920 {0x88, "Move Length"},
1921 {0x89, "PID Block Load Report"},
1922 {0x8B, "Block Load Status"},
1923 {0x8C, "Block Load Success"},
1924 {0x8D, "Block Load Full"},
1925 {0x8E, "Block Load Error"},
1926 {0x8F, "Block Handle"},
1927 {0x90, "PID Block Free Report"},
1928 {0x91, "Type Specific Block Handle"},
1929 {0x92, "PID State Report"},
1930 {0x94, "Effect Playing"},
1931 {0x95, "PID Device Control Report"},
1932 {0x96, "PID Device Control"},
1933 {0x97, "DC Enable Actuators"},
1934 {0x98, "DC Disable Actuators"},
1935 {0x99, "DC Stop All Effects"},
1936 {0x9A, "DC Device Reset"},
1937 {0x9B, "DC Device Pause"},
1938 {0x9C, "DC Device Continue"},
1939 {0x9F, "Device Paused"},
1940 {0xA0, "Actuators Enabled"},
1941 {0xA4, "Safety Switch"},
1942 {0xA5, "Actuator Override Switch"},
1943 {0xA6, "Actuator Power"},
1944 {0xA7, "Start Delay"},
1945 {0xA8, "Parameter Block Size"},
1946 {0xA9, "Device Managed Pool"},
1947 {0xAA, "Shared Parameter Blocks"},
1948 {0xAB, "Create New Effect Report"},
1949 {0xAC, "RAM Pool Available"},
1950 {0, NULL}
1952 static const value_string usb_hid_soc_usage_page_vals[] = {
1953 {0x00, "Undefined"},
1954 {0x01, "SocControl"},
1955 {0x02, "FirmwareTransfer"},
1956 {0x03, "FirmwareFileId"},
1957 {0x04, "FileOffsetInBytes"},
1958 {0x05, "FileTransferSizeMaxInBytes"},
1959 {0x06, "FilePayload"},
1960 {0x07, "FilePayloadSizeInBytes"},
1961 {0x08, "FilePayloadContainsLastBytes"},
1962 {0x09, "FileTransferStop"},
1963 {0x0A, "FileTransferTillEnd"},
1964 {0, NULL}
1966 static const value_string usb_hid_eye_and_head_tracker_usage_page_vals[] = {
1967 {0x0000, "Undefined"},
1968 {0x0001, "Eye Tracker"},
1969 {0x0002, "Head Tracker"},
1970 {0x0010, "Tracking Data"},
1971 {0x0011, "Capabilities"},
1972 {0x0012, "Configuration"},
1973 {0x0013, "Status"},
1974 {0x0014, "Control"},
1975 {0x0020, "Sensor Timestamp"},
1976 {0x0021, "Position X"},
1977 {0x0022, "Position Y"},
1978 {0x0023, "Position Z"},
1979 {0x0024, "Gaze Point"},
1980 {0x0025, "Left Eye Position"},
1981 {0x0026, "Right Eye Position"},
1982 {0x0027, "Head Position"},
1983 {0x0028, "Head Direction Point"},
1984 {0x0029, "Rotation about X axis"},
1985 {0x002A, "Rotation about Y axis"},
1986 {0x002B, "Rotation about Z axis"},
1987 {0x0100, "Tracker Quality"},
1988 {0x0101, "Minimum Tracking Distance"},
1989 {0x0102, "Optimum Tracking Distance"},
1990 {0x0103, "Maximum Tracking Distance"},
1991 {0x0104, "Maximum Screen Plane Width"},
1992 {0x0105, "Maximum Screen Plane Height"},
1993 {0x0200, "Display Manufacturer ID"},
1994 {0x0201, "Display Product ID"},
1995 {0x0202, "Display Serial Number"},
1996 {0x0203, "Display Manufacturer Date"},
1997 {0x0204, "Calibrated Screen Width"},
1998 {0x0205, "Calibrated Screen Height"},
1999 {0x0300, "Sampling Frequency"},
2000 {0x0301, "Configuration Status"},
2001 {0x0400, "Device Mode Request"},
2002 {0, NULL}
2004 static const value_string usb_hid_alphanumeric_display_usage_page_vals[] = {
2005 {0x00, "Undefined"},
2006 {0x01, "Alphanumeric Display"},
2007 {0x02, "Auxiliary Display"},
2008 {0x20, "Display Attributes Report"},
2009 {0x21, "ASCII Character Set"},
2010 {0x22, "Data Read Back"},
2011 {0x23, "Font Read Back"},
2012 {0x24, "Display Control Report"},
2013 {0x25, "Clear Display"},
2014 {0x26, "Display Enable"},
2015 {0x27, "Screen Saver Delay"},
2016 {0x28, "Screen Saver Enable"},
2017 {0x29, "Vertical Scroll"},
2018 {0x2A, "Horizontal Scroll"},
2019 {0x2B, "Character Report"},
2020 {0x2C, "Display Data"},
2021 {0x2D, "Display Status"},
2022 {0x2E, "Stat Not Ready"},
2023 {0x2F, "Stat Ready"},
2024 {0x30, "Err Not a loadable character"},
2025 {0x31, "Err Font data cannot be read"},
2026 {0x32, "Cursor Position Report"},
2027 {0x33, "Row"},
2028 {0x34, "Column"},
2029 {0x35, "Rows"},
2030 {0x36, "Columns"},
2031 {0x37, "Cursor Pixel Positioning"},
2032 {0x38, "Cursor Mode"},
2033 {0x39, "Cursor Enable"},
2034 {0x3A, "Cursor Blink"},
2035 {0x3B, "Font Report"},
2036 {0x3C, "Font Data"},
2037 {0x3D, "Character Width"},
2038 {0x3E, "Character Height"},
2039 {0x3F, "Character Spacing Horizontal"},
2040 {0x40, "Character Spacing Vertical"},
2041 {0x41, "Unicode Character Set"},
2042 {0x42, "Font 7-Segment"},
2043 {0x43, "7-Segment Direct Map"},
2044 {0x44, "Font 14-Segment"},
2045 {0x45, "14-Segment Direct Map"},
2046 {0x46, "Display Brightness"},
2047 {0x47, "Display Contrast"},
2048 {0x48, "Character Attribute"},
2049 {0x49, "Attribute Readback"},
2050 {0x4A, "Attribute Data"},
2051 {0x4B, "Char Attr Enhance"},
2052 {0x4C, "Char Attr Underline"},
2053 {0x4D, "Char Attr Blink"},
2054 {0x80, "Bitmap Size X"},
2055 {0x81, "Bitmap Size Y"},
2056 {0x82, "Max Blit Size"},
2057 {0x83, "Bit Depth Format"},
2058 {0x84, "Display Orientation"},
2059 {0x85, "Palette Report"},
2060 {0x86, "Palette Data Size"},
2061 {0x87, "Palette Data Offset"},
2062 {0x88, "Palette Data"},
2063 {0x8A, "Blit Report"},
2064 {0x8B, "Blit Rectangle X1"},
2065 {0x8C, "Blit Rectangle Y1"},
2066 {0x8D, "Blit Rectangle X2"},
2067 {0x8E, "Blit Rectangle Y2"},
2068 {0x8F, "Blit Data"},
2069 {0x90, "Soft Button"},
2070 {0x91, "Soft Button ID"},
2071 {0x92, "Soft Button Side"},
2072 {0x93, "Soft Button Offset 1"},
2073 {0x94, "Soft Button Offset 2"},
2074 {0x95, "Soft Button Report"},
2075 {0xC2, "Soft Keys"},
2076 {0xCC, "Display Data Extensions"},
2077 {0xCF, "Character Mapping"},
2078 {0xDD, "Unicode Equivalent"},
2079 {0xDF, "Character Page Mapping"},
2080 {0xFF, "Request Report"},
2081 {0, NULL}
2083 static const value_string usb_hid_sensor_usage_page_vals[] = {
2084 {0x0000, "Undefined"},
2085 {0x0001, "Sensor"},
2086 {0x0010, "Biometric"},
2087 {0x0011, "Biometric: Human Presence"},
2088 {0x0012, "Biometric: Human Proximity"},
2089 {0x0013, "Biometric: Human Touch"},
2090 {0x0014, "Biometric: Blood Pressure"},
2091 {0x0015, "Biometric: Body Temperature"},
2092 {0x0016, "Biometric: Heart Rate"},
2093 {0x0017, "Biometric: Heart Rate Variability"},
2094 {0x0018, "Biometric: Peripheral Oxygen Saturation"},
2095 {0x0019, "Biometric: Respiratory Rate"},
2096 {0x0020, "Electrical"},
2097 {0x0021, "Electrical: Capacitance"},
2098 {0x0022, "Electrical: Current"},
2099 {0x0023, "Electrical: Power"},
2100 {0x0024, "Electrical: Inductance"},
2101 {0x0025, "Electrical: Resistance"},
2102 {0x0026, "Electrical: Voltage"},
2103 {0x0027, "Electrical: Potentiometer"},
2104 {0x0028, "Electrical: Frequency"},
2105 {0x0029, "Electrical: Period"},
2106 {0x0030, "Environmental"},
2107 {0x0031, "Environmental: Atmospheric Pressure"},
2108 {0x0032, "Environmental: Humidity"},
2109 {0x0033, "Environmental: Temperature"},
2110 {0x0034, "Environmental: Wind Direction"},
2111 {0x0035, "Environmental: Wind Speed"},
2112 {0x0036, "Environmental: Air Quality"},
2113 {0x0037, "Environmental: Heat Index"},
2114 {0x0038, "Environmental: Surface Temperature"},
2115 {0x0039, "Environmental: Volatile Organic Compounds"},
2116 {0x003A, "Environmental: Object Presence"},
2117 {0x003B, "Environmental: Object Proximity"},
2118 {0x0040, "Light"},
2119 {0x0041, "Light: Ambient Light"},
2120 {0x0042, "Light: Consumer Infrared"},
2121 {0x0043, "Light: Infrared Light"},
2122 {0x0044, "Light: Visible Light"},
2123 {0x0045, "Light: Ultraviolet Light"},
2124 {0x0050, "Location"},
2125 {0x0051, "Location: Broadcast"},
2126 {0x0052, "Location: Dead Reckoning"},
2127 {0x0053, "Location: GPS (Global Positioning System)"},
2128 {0x0054, "Location: Lookup"},
2129 {0x0055, "Location: Other"},
2130 {0x0056, "Location: Static"},
2131 {0x0057, "Location: Triangulation"},
2132 {0x0060, "Mechanical"},
2133 {0x0061, "Mechanical: Boolean Switch"},
2134 {0x0062, "Mechanical: Boolean Switch Array"},
2135 {0x0063, "Mechanical: Multivalue Switch"},
2136 {0x0064, "Mechanical: Force"},
2137 {0x0065, "Mechanical: Pressure"},
2138 {0x0066, "Mechanical: Strain"},
2139 {0x0067, "Mechanical: Weight"},
2140 {0x0068, "Mechanical: Haptic Vibrator"},
2141 {0x0069, "Mechanical: Hall Effect Switch"},
2142 {0x0070, "Motion"},
2143 {0x0071, "Motion: Accelerometer 1D"},
2144 {0x0072, "Motion: Accelerometer 2D"},
2145 {0x0073, "Motion: Accelerometer 3D"},
2146 {0x0074, "Motion: Gyrometer 1D"},
2147 {0x0075, "Motion: Gyrometer 2D"},
2148 {0x0076, "Motion: Gyrometer 3D"},
2149 {0x0077, "Motion: Motion Detector"},
2150 {0x0078, "Motion: Speedometer"},
2151 {0x0079, "Motion: Accelerometer"},
2152 {0x007A, "Motion: Gyrometer"},
2153 {0x007B, "Motion: Gravity Vector"},
2154 {0x007C, "Motion: Linear Accelerometer"},
2155 {0x0080, "Orientation"},
2156 {0x0081, "Orientation: Compass 1D"},
2157 {0x0082, "Orientation: Compass 2D"},
2158 {0x0083, "Orientation: Compass 3D"},
2159 {0x0084, "Orientation: Inclinometer 1D"},
2160 {0x0085, "Orientation: Inclinometer 2D"},
2161 {0x0086, "Orientation: Inclinometer 3D"},
2162 {0x0087, "Orientation: Distance 1D"},
2163 {0x0088, "Orientation: Distance 2D"},
2164 {0x0089, "Orientation: Distance 3D"},
2165 {0x008A, "Orientation: Device Orientation"},
2166 {0x008B, "Orientation: Compass"},
2167 {0x008C, "Orientation: Inclinometer"},
2168 {0x008D, "Orientation: Distance"},
2169 {0x008E, "Orientation: Relative Orientation"},
2170 {0x008F, "Orientation: Simple Orientation"},
2171 {0x0090, "Scanner"},
2172 {0x0091, "Scanner: Barcode"},
2173 {0x0092, "Scanner: RFID"},
2174 {0x0093, "Scanner: NFC"},
2175 {0x00A0, "Time"},
2176 {0x00A1, "Time: Alarm Timer"},
2177 {0x00A2, "Time: Real Time Clock"},
2178 {0x00B0, "Personal Activity"},
2179 {0x00B1, "Personal Activity: Activity Detection"},
2180 {0x00B2, "Personal Activity: Device Position"},
2181 {0x00B3, "Personal Activity: Floor Tracker"},
2182 {0x00B4, "Personal Activity: Pedometer"},
2183 {0x00B5, "Personal Activity: Step Detection"},
2184 {0x00C0, "Orientation Extended"},
2185 {0x00C1, "Orientation Extended: Geomagnetic Orientation"},
2186 {0x00C2, "Orientation Extended: Magnetometer"},
2187 {0x00D0, "Gesture"},
2188 {0x00D1, "Gesture: Chassis Flip Gesture"},
2189 {0x00D2, "Gesture: Hinge Fold Gesture"},
2190 {0x00E0, "Other"},
2191 {0x00E1, "Other: Custom"},
2192 {0x00E2, "Other: Generic"},
2193 {0x00E3, "Other: Generic Enumerator"},
2194 {0x00E4, "Other: Hinge Angle"},
2195 {0x0200, "Event"},
2196 {0x0201, "Event: Sensor State"},
2197 {0x0202, "Event: Sensor Event"},
2198 {0x0300, "Property"},
2199 {0x0301, "Property: Friendly Name"},
2200 {0x0302, "Property: Persistent Unique ID"},
2201 {0x0303, "Property: Sensor Status"},
2202 {0x0304, "Property: Minimum Report Interval"},
2203 {0x0305, "Property: Sensor Manufacturer"},
2204 {0x0306, "Property: Sensor Model"},
2205 {0x0307, "Property: Sensor Serial Number"},
2206 {0x0308, "Property: Sensor Description"},
2207 {0x0309, "Property: Sensor Connection Type"},
2208 {0x030A, "Property: Sensor Device Path"},
2209 {0x030B, "Property: Hardware Revision"},
2210 {0x030C, "Property: Firmware Version"},
2211 {0x030D, "Property: Release Date"},
2212 {0x030E, "Property: Report Interval"},
2213 {0x030F, "Property: Change Sensitivity Absolute"},
2214 {0x0310, "Property: Change Sensitivity Percent of Range"},
2215 {0x0311, "Property: Change Sensitivity Percent Relative"},
2216 {0x0312, "Property: Accuracy"},
2217 {0x0313, "Property: Resolution"},
2218 {0x0314, "Property: Maximum"},
2219 {0x0315, "Property: Minimum"},
2220 {0x0316, "Property: Reporting State"},
2221 {0x0317, "Property: Sampling Rate"},
2222 {0x0318, "Property: Response Curve"},
2223 {0x0319, "Property: Power State"},
2224 {0x031A, "Property: Maximum FIFO Events"},
2225 {0x031B, "Property: Report Latency"},
2226 {0x031C, "Property: Flush FIFO Events"},
2227 {0x031D, "Property: Maximum Power Consumption"},
2228 {0x031E, "Property: Is Primary"},
2229 {0x031F, "Property: Human Presence Detection Type"},
2230 {0x0400, "Data Field: Location"},
2231 {0x0401, "Reserved (Data Field: Location)"},
2232 {0x0402, "Data Field: Altitude Antenna Sea Level"},
2233 {0x0403, "Data Field: Differential Reference Station ID"},
2234 {0x0404, "Data Field: Altitude Ellipsoid Error"},
2235 {0x0405, "Data Field: Altitude Ellipsoid"},
2236 {0x0406, "Data Field: Altitude Sea Level Error"},
2237 {0x0407, "Data Field: Altitude Sea Level"},
2238 {0x0408, "Data Field: Differential GPS Data Age"},
2239 {0x0409, "Data Field: Error Radius"},
2240 {0x040A, "Data Field: Fix Quality"},
2241 {0x040B, "Data Field: Fix Type"},
2242 {0x040C, "Data Field: Geoidal Separation"},
2243 {0x040D, "Data Field: GPS Operation Mode"},
2244 {0x040E, "Data Field: GPS Selection Mode"},
2245 {0x040F, "Data Field: GPS Status"},
2246 {0x0410, "Data Field: Position Dilution of Precision"},
2247 {0x0411, "Data Field: Horizontal Dilution of Precision"},
2248 {0x0412, "Data Field: Vertical Dilution of Precision"},
2249 {0x0413, "Data Field: Latitude"},
2250 {0x0414, "Data Field: Longitude"},
2251 {0x0415, "Data Field: True Heading"},
2252 {0x0416, "Data Field: Magnetic Heading"},
2253 {0x0417, "Data Field: Magnetic Variation"},
2254 {0x0418, "Data Field: Speed"},
2255 {0x0419, "Data Field: Satellites in View"},
2256 {0x041A, "Data Field: Satellites in View Azimuth"},
2257 {0x041B, "Data Field: Satellites in View Elevation"},
2258 {0x041C, "Data Field: Satellites in View IDs"},
2259 {0x041D, "Data Field: Satellites in View PRNs"},
2260 {0x041E, "Data Field: Satellites in View S/N Ratios"},
2261 {0x041F, "Data Field: Satellites Used Count"},
2262 {0x0420, "Data Field: Satellites Used PRNs"},
2263 {0x0421, "Data Field: NMEA Sentence"},
2264 {0x0422, "Data Field: Address Line 1"},
2265 {0x0423, "Data Field: Address Line 2"},
2266 {0x0424, "Data Field: City"},
2267 {0x0425, "Data Field: State or Province"},
2268 {0x0426, "Data Field: Country or Region"},
2269 {0x0427, "Data Field: Postal Code"},
2270 {0x042A, "Property: Location"},
2271 {0x042B, "Property: Location Desired Accuracy"},
2272 {0x0430, "Data Field: Environmental"},
2273 {0x0431, "Data Field: Atmospheric Pressure"},
2274 {0x0432, "Reserved (Data Field: Environmental)"},
2275 {0x0433, "Data Field: Relative Humidity"},
2276 {0x0434, "Data Field: Temperature"},
2277 {0x0435, "Data Field: Wind Direction"},
2278 {0x0436, "Data Field: Wind Speed"},
2279 {0x0437, "Data Field: Air Quality Index"},
2280 {0x0438, "Data Field: Equivalent CO2"},
2281 {0x0439, "Data Field: Volatile Organic Compound Concentration"},
2282 {0x043A, "Data Field: Object Presence"},
2283 {0x043B, "Data Field: Object Proximity Range"},
2284 {0x043C, "Data Field: Object Proximity Out of Range"},
2285 {0x0440, "Property: Environmental"},
2286 {0x0441, "Property: Reference Pressure"},
2287 {0x0450, "Data Field: Motion"},
2288 {0x0451, "Data Field: Motion State"},
2289 {0x0452, "Data Field: Acceleration"},
2290 {0x0453, "Data Field: Acceleration Axis X"},
2291 {0x0454, "Data Field: Acceleration Axis Y"},
2292 {0x0455, "Data Field: Acceleration Axis Z"},
2293 {0x0456, "Data Field: Angular Velocity"},
2294 {0x0457, "Data Field: Angular Velocity about X Axis"},
2295 {0x0458, "Data Field: Angular Velocity about Y Axis"},
2296 {0x0459, "Data Field: Angular Velocity about Z Axis"},
2297 {0x045A, "Data Field: Angular Position"},
2298 {0x045B, "Data Field: Angular Position about X Axis"},
2299 {0x045C, "Data Field: Angular Position about Y Axis"},
2300 {0x045D, "Data Field: Angular Position about Z Axis"},
2301 {0x045E, "Data Field: Motion Speed"},
2302 {0x045F, "Data Field: Motion Intensity"},
2303 {0x0470, "Data Field: Orientation"},
2304 {0x0471, "Data Field: Heading"},
2305 {0x0472, "Data Field: Heading X Axis"},
2306 {0x0473, "Data Field: Heading Y Axis"},
2307 {0x0474, "Data Field: Heading Z Axis"},
2308 {0x0475, "Data Field: Heading Compensated Magnetic North"},
2309 {0x0476, "Data Field: Heading Compensated True North"},
2310 {0x0477, "Data Field: Heading Magnetic North"},
2311 {0x0478, "Data Field: Heading True North"},
2312 {0x0479, "Data Field: Distance"},
2313 {0x047A, "Data Field: Distance X Axis"},
2314 {0x047B, "Data Field: Distance Y Axis"},
2315 {0x047C, "Data Field: Distance Z Axis"},
2316 {0x047D, "Data Field: Distance Out-of-Range"},
2317 {0x047E, "Data Field: Tilt"},
2318 {0x047F, "Data Field: Tilt X Axis"},
2319 {0x0480, "Data Field: Tilt Y Axis"},
2320 {0x0481, "Data Field: Tilt Z Axis"},
2321 {0x0482, "Data Field: Rotation Matrix"},
2322 {0x0483, "Data Field: Quaternion"},
2323 {0x0484, "Data Field: Magnetic Flux"},
2324 {0x0485, "Data Field: Magnetic Flux X Axis"},
2325 {0x0486, "Data Field: Magnetic Flux Y Axis"},
2326 {0x0487, "Data Field: Magnetic Flux Z Axis"},
2327 {0x0488, "Data Field: Magnetometer Accuracy"},
2328 {0x0489, "Data Field: Simple Orientation Direction"},
2329 {0x0490, "Data Field: Mechanical"},
2330 {0x0491, "Data Field: Boolean Switch State"},
2331 {0x0492, "Data Field: Boolean Switch Array States"},
2332 {0x0493, "Data Field: Multivalue Switch Value"},
2333 {0x0494, "Data Field: Force"},
2334 {0x0495, "Data Field: Absolute Pressure"},
2335 {0x0496, "Data Field: Gauge Pressure"},
2336 {0x0497, "Data Field: Strain"},
2337 {0x0498, "Data Field: Weight"},
2338 {0x04A0, "Property: Mechanical"},
2339 {0x04A1, "Property: Vibration State"},
2340 {0x04A2, "Property: Forward Vibration Speed"},
2341 {0x04A3, "Property: Backward Vibration Speed"},
2342 {0x04B0, "Data Field: Biometric"},
2343 {0x04B1, "Data Field: Human Presence"},
2344 {0x04B2, "Data Field: Human Proximity Range"},
2345 {0x04B3, "Data Field: Human Proximity Out of Range"},
2346 {0x04B4, "Data Field: Human Touch State"},
2347 {0x04B5, "Data Field: Blood Pressure"},
2348 {0x04B6, "Data Field: Blood Pressure Diastolic"},
2349 {0x04B7, "Data Field: Blood Pressure Systolic"},
2350 {0x04B8, "Data Field: Heart Rate"},
2351 {0x04B9, "Data Field: Resting Heart Rate"},
2352 {0x04BA, "Data Field: Heartbeat Interval"},
2353 {0x04BB, "Data Field: Respiratory Rate"},
2354 {0x04BC, "Data Field: SpO2"},
2355 {0x04BD, "Data Field: Human Attention Detected"},
2356 {0x04BE, "Data Field: Human Head Azimuth"},
2357 {0x04BF, "Data Field: Human Head Altitude"},
2358 {0x04C0, "Data Field: Human Head Roll"},
2359 {0x04C1, "Data Field: Human Head Pitch"},
2360 {0x04C2, "Data Field: Human Head Yaw"},
2361 {0x04C3, "Data Field: Human Correlation Id"},
2362 {0x04D0, "Data Field: Light"},
2363 {0x04D1, "Data Field: Illuminance"},
2364 {0x04D2, "Data Field: Color Temperature"},
2365 {0x04D3, "Data Field: Chromaticity"},
2366 {0x04D4, "Data Field: Chromaticity X"},
2367 {0x04D5, "Data Field: Chromaticity Y"},
2368 {0x04D6, "Data Field: Consumer IR Sentence Receive"},
2369 {0x04D7, "Data Field: Infrared Light"},
2370 {0x04D8, "Data Field: Red Light"},
2371 {0x04D9, "Data Field: Green Light"},
2372 {0x04DA, "Data Field: Blue Light"},
2373 {0x04DB, "Data Field: Ultraviolet A Light"},
2374 {0x04DC, "Data Field: Ultraviolet B Light"},
2375 {0x04DD, "Data Field: Ultraviolet Index"},
2376 {0x04DE, "Data Field: Near Infrared Light"},
2377 {0x04DF, "Property: Light"},
2378 {0x04E0, "Property: Consumer IR Sentence Send"},
2379 {0x04E2, "Property: Auto Brightness Preferred"},
2380 {0x04E3, "Property: Auto Color Preferred"},
2381 {0x04F0, "Data Field: Scanner"},
2382 {0x04F1, "Data Field: RFID Tag 40 Bit"},
2383 {0x04F2, "Data Field: NFC Sentence Receive"},
2384 {0x04F8, "Property: Scanner"},
2385 {0x04F9, "Property: NFC Sentence Send"},
2386 {0x0500, "Data Field: Electrical"},
2387 {0x0501, "Data Field: Capacitance"},
2388 {0x0502, "Data Field: Current"},
2389 {0x0503, "Data Field: Electrical Power"},
2390 {0x0504, "Data Field: Inductance"},
2391 {0x0505, "Data Field: Resistance"},
2392 {0x0506, "Data Field: Voltage"},
2393 {0x0507, "Data Field: Frequency"},
2394 {0x0508, "Data Field: Period"},
2395 {0x0509, "Data Field: Percent of Range"},
2396 {0x0520, "Data Field: Time"},
2397 {0x0521, "Data Field: Year"},
2398 {0x0522, "Data Field: Month"},
2399 {0x0523, "Data Field: Day"},
2400 {0x0524, "Data Field: Day of Week"},
2401 {0x0525, "Data Field: Hour"},
2402 {0x0526, "Data Field: Minute"},
2403 {0x0527, "Data Field: Second"},
2404 {0x0528, "Data Field: Millisecond"},
2405 {0x0529, "Data Field: Timestamp"},
2406 {0x052A, "Data Field: Julian Day of Year"},
2407 {0x052B, "Data Field: Time Since System Boot"},
2408 {0x0530, "Property: Time"},
2409 {0x0531, "Property: Time Zone Offset from UTC"},
2410 {0x0532, "Property: Time Zone Name"},
2411 {0x0533, "Property: Daylight Savings Time Observed"},
2412 {0x0534, "Property: Time Trim Adjustment"},
2413 {0x0535, "Property: Arm Alarm"},
2414 {0x0540, "Data Field: Custom"},
2415 {0x0541, "Data Field: Custom Usage"},
2416 {0x0542, "Data Field: Custom Boolean Array"},
2417 {0x0543, "Data Field: Custom Value"},
2418 {0x0544, "Data Field: Custom Value 1"},
2419 {0x0545, "Data Field: Custom Value 2"},
2420 {0x0546, "Data Field: Custom Value 3"},
2421 {0x0547, "Data Field: Custom Value 4"},
2422 {0x0548, "Data Field: Custom Value 5"},
2423 {0x0549, "Data Field: Custom Value 6"},
2424 {0x054A, "Data Field: Custom Value 7"},
2425 {0x054B, "Data Field: Custom Value 8"},
2426 {0x054C, "Data Field: Custom Value 9"},
2427 {0x054D, "Data Field: Custom Value 10"},
2428 {0x054E, "Data Field: Custom Value 11"},
2429 {0x054F, "Data Field: Custom Value 12"},
2430 {0x0550, "Data Field: Custom Value 13"},
2431 {0x0551, "Data Field: Custom Value 14"},
2432 {0x0552, "Data Field: Custom Value 15"},
2433 {0x0553, "Data Field: Custom Value 16"},
2434 {0x0554, "Data Field: Custom Value 17"},
2435 {0x0555, "Data Field: Custom Value 18"},
2436 {0x0556, "Data Field: Custom Value 19"},
2437 {0x0557, "Data Field: Custom Value 20"},
2438 {0x0558, "Data Field: Custom Value 21"},
2439 {0x0559, "Data Field: Custom Value 22"},
2440 {0x055A, "Data Field: Custom Value 23"},
2441 {0x055B, "Data Field: Custom Value 24"},
2442 {0x055C, "Data Field: Custom Value 25"},
2443 {0x055D, "Data Field: Custom Value 26"},
2444 {0x055E, "Data Field: Custom Value 27"},
2445 {0x055F, "Data Field: Custom Value 28"},
2446 {0x0560, "Data Field: Generic"},
2447 {0x0561, "Data Field: Generic GUID or PROPERTYKEY"},
2448 {0x0562, "Data Field: Generic Category GUID"},
2449 {0x0563, "Data Field: Generic Type GUID"},
2450 {0x0564, "Data Field: Generic Event PROPERTYKEY"},
2451 {0x0565, "Data Field: Generic Property PROPERTYKEY"},
2452 {0x0566, "Data Field: Generic Data Field PROPERTYKEY"},
2453 {0x0567, "Data Field: Generic Event"},
2454 {0x0568, "Data Field: Generic Property"},
2455 {0x0569, "Data Field: Generic Data Field"},
2456 {0x056A, "Data Field: Enumerator Table Row Index"},
2457 {0x056B, "Data Field: Enumerator Table Row Count"},
2458 {0x056C, "Data Field: Generic GUID or PROPERTYKEY kind"},
2459 {0x056D, "Data Field: Generic GUID"},
2460 {0x056E, "Data Field: Generic PROPERTYKEY"},
2461 {0x056F, "Data Field: Generic Top Level Collection ID"},
2462 {0x0570, "Data Field: Generic Report ID"},
2463 {0x0571, "Data Field: Generic Report Item Position Index"},
2464 {0x0572, "Data Field: Generic Firmware VARTYPE"},
2465 {0x0573, "Data Field: Generic Unit of Measure"},
2466 {0x0574, "Data Field: Generic Unit Exponent"},
2467 {0x0575, "Data Field: Generic Report Size"},
2468 {0x0576, "Data Field: Generic Report Count"},
2469 {0x0580, "Property: Generic"},
2470 {0x0581, "Property: Enumerator Table Row Index"},
2471 {0x0582, "Property: Enumerator Table Row Count"},
2472 {0x0590, "Data Field: Personal Activity"},
2473 {0x0591, "Data Field: Activity Type"},
2474 {0x0592, "Data Field: Activity State"},
2475 {0x0593, "Data Field: Device Position"},
2476 {0x0594, "Data Field: Step Count"},
2477 {0x0595, "Data Field: Step Count Reset"},
2478 {0x0596, "Data Field: Step Duration"},
2479 {0x0597, "Data Field: Step Type"},
2480 {0x05A0, "Property: Minimum Activity Detection Interval"},
2481 {0x05A1, "Property: Supported Activity Types"},
2482 {0x05A2, "Property: Subscribed Activity Types"},
2483 {0x05A3, "Property: Supported Step Types"},
2484 {0x05A4, "Property: Subscribed Step Types"},
2485 {0x05A5, "Property: Floor Height"},
2486 {0x05B0, "Data Field: Custom Type ID"},
2487 {0x05C0, "Property: Custom"},
2488 {0x05C1, "Property: Custom Value 1"},
2489 {0x05C2, "Property: Custom Value 2"},
2490 {0x05C3, "Property: Custom Value 3"},
2491 {0x05C4, "Property: Custom Value 4"},
2492 {0x05C5, "Property: Custom Value 5"},
2493 {0x05C6, "Property: Custom Value 6"},
2494 {0x05C7, "Property: Custom Value 7"},
2495 {0x05C8, "Property: Custom Value 8"},
2496 {0x05C9, "Property: Custom Value 9"},
2497 {0x05CA, "Property: Custom Value 10"},
2498 {0x05CB, "Property: Custom Value 11"},
2499 {0x05CC, "Property: Custom Value 12"},
2500 {0x05CD, "Property: Custom Value 13"},
2501 {0x05CE, "Property: Custom Value 14"},
2502 {0x05CF, "Property: Custom Value 15"},
2503 {0x05D0, "Property: Custom Value 16"},
2504 {0x05E0, "Data Field: Hinge"},
2505 {0x05E1, "Data Field: Hinge Angle"},
2506 {0x05F0, "Data Field: Gesture Sensor"},
2507 {0x05F1, "Data Field: Gesture State"},
2508 {0x05F2, "Data Field: Hinge Fold Initial Angle"},
2509 {0x05F3, "Data Field: Hinge Fold Final Angle"},
2510 {0x05F4, "Data Field: Hinge Fold Contributing Panel"},
2511 {0x05F5, "Data Field: Hinge Fold Type"},
2512 {0x0800, "Sensor State: Undefined"},
2513 {0x0801, "Sensor State: Ready"},
2514 {0x0802, "Sensor State: Not Available"},
2515 {0x0803, "Sensor State: No Data"},
2516 {0x0804, "Sensor State: Initializing"},
2517 {0x0805, "Sensor State: Access Denied"},
2518 {0x0806, "Sensor State: Error"},
2519 {0x0810, "Sensor Event: Unknown"},
2520 {0x0811, "Sensor Event: State Changed"},
2521 {0x0812, "Sensor Event: Property Changed"},
2522 {0x0813, "Sensor Event: Data Updated"},
2523 {0x0814, "Sensor Event: Poll Response"},
2524 {0x0815, "Sensor Event: Change Sensitivity"},
2525 {0x0816, "Sensor Event: Range Maximum Reached"},
2526 {0x0817, "Sensor Event: Range Minimum Reached"},
2527 {0x0818, "Sensor Event: High Threshold Cross Upward"},
2528 {0x0819, "Sensor Event: High Threshold Cross Downward"},
2529 {0x081A, "Sensor Event: Low Threshold Cross Upward"},
2530 {0x081B, "Sensor Event: Low Threshold Cross Downward"},
2531 {0x081C, "Sensor Event: Zero Threshold Cross Upward"},
2532 {0x081D, "Sensor Event: Zero Threshold Cross Downward"},
2533 {0x081E, "Sensor Event: Period Exceeded"},
2534 {0x081F, "Sensor Event: Frequency Exceeded"},
2535 {0x0820, "Sensor Event: Complex Trigger"},
2536 {0x0830, "Connection Type: PC Integrated"},
2537 {0x0831, "Connection Type: PC Attached"},
2538 {0x0832, "Connection Type: PC External"},
2539 {0x0840, "Reporting State: Report No Events"},
2540 {0x0841, "Reporting State: Report All Events"},
2541 {0x0842, "Reporting State: Report Threshold Events"},
2542 {0x0843, "Reporting State: Wake On No Events"},
2543 {0x0844, "Reporting State: Wake On All Events"},
2544 {0x0845, "Reporting State: Wake On Threshold Events"},
2545 {0x0846, "Reporting State: Anytime"},
2546 {0x0850, "Power State: Undefined"},
2547 {0x0851, "Power State: D0 Full Power"},
2548 {0x0852, "Power State: D1 Low Power"},
2549 {0x0853, "Power State: D2 Standby Power with Wakeup"},
2550 {0x0854, "Power State: D3 Sleep with Wakeup"},
2551 {0x0855, "Power State: D4 Power Off"},
2552 {0x0860, "Accuracy: Default"},
2553 {0x0861, "Accuracy: High"},
2554 {0x0862, "Accuracy: Medium"},
2555 {0x0863, "Accuracy: Low"},
2556 {0x0870, "Fix Quality: No Fix"},
2557 {0x0871, "Fix Quality: GPS"},
2558 {0x0872, "Fix Quality: DGPS"},
2559 {0x0880, "Fix Type: No Fix"},
2560 {0x0881, "Fix Type: GPS SPS Mode, Fix Valid"},
2561 {0x0882, "Fix Type: DGPS SPS Mode, Fix Valid"},
2562 {0x0883, "Fix Type: GPS PPS Mode, Fix Valid"},
2563 {0x0884, "Fix Type: Real Time Kinematic"},
2564 {0x0885, "Fix Type: Float RTK"},
2565 {0x0886, "Fix Type: Estimated (dead reckoned)"},
2566 {0x0887, "Fix Type: Manual Input Mode"},
2567 {0x0888, "Fix Type: Simulator Mode"},
2568 {0x0890, "GPS Operation Mode: Manual"},
2569 {0x0891, "GPS Operation Mode: Automatic"},
2570 {0x08A0, "GPS Selection Mode: Autonomous"},
2571 {0x08A1, "GPS Selection Mode: DGPS"},
2572 {0x08A2, "GPS Selection Mode: Estimated (dead reckoned)"},
2573 {0x08A3, "GPS Selection Mode: Manual Input"},
2574 {0x08A4, "GPS Selection Mode: Simulator"},
2575 {0x08A5, "GPS Selection Mode: Data Not Valid"},
2576 {0x08B0, "GPS Status Data: Valid"},
2577 {0x08B1, "GPS Status Data: Not Valid"},
2578 {0x08C0, "Day of Week: Sunday"},
2579 {0x08C1, "Day of Week: Monday"},
2580 {0x08C2, "Day of Week: Tuesday"},
2581 {0x08C3, "Day of Week: Wednesday"},
2582 {0x08C4, "Day of Week: Thursday"},
2583 {0x08C5, "Day of Week: Friday"},
2584 {0x08C6, "Day of Week: Saturday"},
2585 {0x08D0, "Kind: Category"},
2586 {0x08D1, "Kind: Type"},
2587 {0x08D2, "Kind: Event"},
2588 {0x08D3, "Kind: Property"},
2589 {0x08D4, "Kind: Data Field"},
2590 {0x08E0, "Magnetometer Accuracy: Low"},
2591 {0x08E1, "Magnetometer Accuracy: Medium"},
2592 {0x08E2, "Magnetometer Accuracy: High"},
2593 {0x08F0, "Simple Orientation Direction: Not Rotated"},
2594 {0x08F1, "Simple Orientation Direction: Rotated 90 Degrees CCW"},
2595 {0x08F2, "Simple Orientation Direction: Rotated 180 Degrees CCW"},
2596 {0x08F3, "Simple Orientation Direction: Rotated 270 Degrees CCW"},
2597 {0x08F4, "Simple Orientation Direction: Face Up"},
2598 {0x08F5, "Simple Orientation Direction: Face Down"},
2599 {0x0900, "VT_NULL: Empty"},
2600 {0x0901, "VT_BOOL: Boolean"},
2601 {0x0902, "VT_UI1: Byte"},
2602 {0x0903, "VT_I1: Character"},
2603 {0x0904, "VT_UI2: Unsigned Short"},
2604 {0x0905, "VT_I2: Short"},
2605 {0x0906, "VT_UI4: Unsigned Long"},
2606 {0x0907, "VT_I4: Long"},
2607 {0x0908, "VT_UI8: Unsigned Long Long"},
2608 {0x0909, "VT_I8: Long Long"},
2609 {0x090A, "VT_R4: Float"},
2610 {0x090B, "VT_R8: Double"},
2611 {0x090C, "VT_WSTR: Wide String"},
2612 {0x090D, "VT_STR: Narrow String"},
2613 {0x090E, "VT_CLSID: Guid"},
2614 {0x090F, "VT_VECTOR|VT_UI1: Opaque Structure"},
2615 {0x0910, "VT_F16E0: HID 16-bit Float with Unit Exponent 0"},
2616 {0x0911, "VT_F16E1: HID 16-bit Float with Unit Exponent 1"},
2617 {0x0912, "VT_F16E2: HID 16-bit Float with Unit Exponent 2"},
2618 {0x0913, "VT_F16E3: HID 16-bit Float with Unit Exponent 3"},
2619 {0x0914, "VT_F16E4: HID 16-bit Float with Unit Exponent 4"},
2620 {0x0915, "VT_F16E5: HID 16-bit Float with Unit Exponent 5"},
2621 {0x0916, "VT_F16E6: HID 16-bit Float with Unit Exponent 6"},
2622 {0x0917, "VT_F16E7: HID 16-bit Float with Unit Exponent 7"},
2623 {0x0918, "VT_F16E8: HID 16-bit Float with Unit Exponent 8"},
2624 {0x0919, "VT_F16E9: HID 16-bit Float with Unit Exponent 9"},
2625 {0x091A, "VT_F16EA: HID 16-bit Float with Unit Exponent A"},
2626 {0x091B, "VT_F16EB: HID 16-bit Float with Unit Exponent B"},
2627 {0x091C, "VT_F16EC: HID 16-bit Float with Unit Exponent C"},
2628 {0x091D, "VT_F16ED: HID 16-bit Float with Unit Exponent D"},
2629 {0x091E, "VT_F16EE: HID 16-bit Float with Unit Exponent E"},
2630 {0x091F, "VT_F16EF: HID 16-bit Float with Unit Exponent F"},
2631 {0x0920, "VT_F32E0: HID 32-bit Float with Unit Exponent 0"},
2632 {0x0921, "VT_F32E1: HID 32-bit Float with Unit Exponent 1"},
2633 {0x0922, "VT_F32E2: HID 32-bit Float with Unit Exponent 2"},
2634 {0x0923, "VT_F32E3: HID 32-bit Float with Unit Exponent 3"},
2635 {0x0924, "VT_F32E4: HID 32-bit Float with Unit Exponent 4"},
2636 {0x0925, "VT_F32E5: HID 32-bit Float with Unit Exponent 5"},
2637 {0x0926, "VT_F32E6: HID 32-bit Float with Unit Exponent 6"},
2638 {0x0927, "VT_F32E7: HID 32-bit Float with Unit Exponent 7"},
2639 {0x0928, "VT_F32E8: HID 32-bit Float with Unit Exponent 8"},
2640 {0x0929, "VT_F32E9: HID 32-bit Float with Unit Exponent 9"},
2641 {0x092A, "VT_F32EA: HID 32-bit Float with Unit Exponent A"},
2642 {0x092B, "VT_F32EB: HID 32-bit Float with Unit Exponent B"},
2643 {0x092C, "VT_F32EC: HID 32-bit Float with Unit Exponent C"},
2644 {0x092D, "VT_F32ED: HID 32-bit Float with Unit Exponent D"},
2645 {0x092E, "VT_F32EE: HID 32-bit Float with Unit Exponent E"},
2646 {0x092F, "VT_F32EF: HID 32-bit Float with Unit Exponent F"},
2647 {0x0930, "Activity Type: Unknown"},
2648 {0x0931, "Activity Type: Stationary"},
2649 {0x0932, "Activity Type: Fidgeting"},
2650 {0x0933, "Activity Type: Walking"},
2651 {0x0934, "Activity Type: Running"},
2652 {0x0935, "Activity Type: In Vehicle"},
2653 {0x0936, "Activity Type: Biking"},
2654 {0x0937, "Activity Type: Idle"},
2655 {0x0940, "Unit: Not Specified"},
2656 {0x0941, "Unit: Lux"},
2657 {0x0942, "Unit: Degrees Kelvin"},
2658 {0x0943, "Unit: Degrees Celsius"},
2659 {0x0944, "Unit: Pascal"},
2660 {0x0945, "Unit: Newton"},
2661 {0x0946, "Unit: Meters/Second"},
2662 {0x0947, "Unit: Kilogram"},
2663 {0x0948, "Unit: Meter"},
2664 {0x0949, "Unit: Meters/Second/Second"},
2665 {0x094A, "Unit: Farad"},
2666 {0x094B, "Unit: Ampere"},
2667 {0x094C, "Unit: Watt"},
2668 {0x094D, "Unit: Henry"},
2669 {0x094E, "Unit: Ohm"},
2670 {0x094F, "Unit: Volt"},
2671 {0x0950, "Unit: Hertz"},
2672 {0x0951, "Unit: Bar"},
2673 {0x0952, "Unit: Degrees Anti-clockwise"},
2674 {0x0953, "Unit: Degrees Clockwise"},
2675 {0x0954, "Unit: Degrees"},
2676 {0x0955, "Unit: Degrees/Second"},
2677 {0x0956, "Unit: Degrees/Second/Second"},
2678 {0x0957, "Unit: Knot"},
2679 {0x0958, "Unit: Percent"},
2680 {0x0959, "Unit: Second"},
2681 {0x095A, "Unit: Millisecond"},
2682 {0x095B, "Unit: G"},
2683 {0x095C, "Unit: Bytes"},
2684 {0x095D, "Unit: Milligauss"},
2685 {0x095E, "Unit: Bits"},
2686 {0x0960, "Activity State: No State Change"},
2687 {0x0961, "Activity State: Start Activity"},
2688 {0x0962, "Activity State: End Activity"},
2689 {0x0970, "Exponent 0: 1"},
2690 {0x0971, "Exponent 1: 10"},
2691 {0x0972, "Exponent 2: 100"},
2692 {0x0973, "Exponent 3: 1 000"},
2693 {0x0974, "Exponent 4: 10 000"},
2694 {0x0975, "Exponent 5: 100 000"},
2695 {0x0976, "Exponent 6: 1 000 000"},
2696 {0x0977, "Exponent 7: 10 000 000"},
2697 {0x0978, "Exponent 8: 0.00 000 001"},
2698 {0x0979, "Exponent 9: 0.0 000 001"},
2699 {0x097A, "Exponent A: 0.000 001"},
2700 {0x097B, "Exponent B: 0.00 001"},
2701 {0x097C, "Exponent C: 0.0 001"},
2702 {0x097D, "Exponent D: 0.001"},
2703 {0x097E, "Exponent E: 0.01"},
2704 {0x097F, "Exponent F: 0.1"},
2705 {0x0980, "Device Position: Unknown"},
2706 {0x0981, "Device Position: Unchanged"},
2707 {0x0982, "Device Position: On Desk"},
2708 {0x0983, "Device Position: In Hand"},
2709 {0x0984, "Device Position: Moving in Bag"},
2710 {0x0985, "Device Position: Stationary in Bag"},
2711 {0x0990, "Step Type: Unknown"},
2712 {0x0991, "Step Type: Running"},
2713 {0x0992, "Step Type: Walking"},
2714 {0x09A0, "Gesture State: Unknown"},
2715 {0x09A1, "Gesture State: Started"},
2716 {0x09A2, "Gesture State: Completed"},
2717 {0x09A3, "Gesture State: Cancelled"},
2718 {0x09B0, "Hinge Fold Contributing Panel: Unknown"},
2719 {0x09B1, "Hinge Fold Contributing Panel: Panel 1"},
2720 {0x09B2, "Hinge Fold Contributing Panel: Panel 2"},
2721 {0x09B3, "Hinge Fold Contributing Panel: Both"},
2722 {0x09B4, "Hinge Fold Type: Unknown"},
2723 {0x09B5, "Hinge Fold Type: Increasing"},
2724 {0x09B6, "Hinge Fold Type: Decreasing"},
2725 {0x09C0, "Human Presence Detection: Vendor-Defined Non-Biometric"},
2726 {0x09C1, "Human Presence Detection: Vendor-Defined Biometric"},
2727 {0x09C2, "Human Presence Detection: Facial Biometric"},
2728 {0x09C3, "Human Presence Detection: Audio Biometric"},
2729 {0x1000, "Modifier: Change Sensitivity Absolute"},
2730 {0x2000, "Modifier: Maximum"},
2731 {0x3000, "Modifier: Minimum"},
2732 {0x4000, "Modifier: Accuracy"},
2733 {0x5000, "Modifier: Resolution"},
2734 {0x6000, "Modifier: Threshold High"},
2735 {0x7000, "Modifier: Threshold Low"},
2736 {0x8000, "Modifier: Calibration Offset"},
2737 {0x9000, "Modifier: Calibration Multiplier"},
2738 {0xA000, "Modifier: Report Interval"},
2739 {0xB000, "Modifier: Frequency Max"},
2740 {0xC000, "Modifier: Period Max"},
2741 {0xD000, "Modifier: Change Sensitivity Percent of Range"},
2742 {0xE000, "Modifier: Change Sensitivity Percent Relative"},
2743 {0xF000, "Modifier: Vendor Reserved"},
2744 {0, NULL}
2746 static const range_string usb_hid_sensor_usage_page_ranges[] = {
2747 {0x001A, 0x001F, "Reserved (Biometric)"},
2748 {0x002A, 0x002F, "Reserved (Electrical)"},
2749 {0x003C, 0x003F, "Reserved (Environmental)"},
2750 {0x0046, 0x004F, "Reserved (Light)"},
2751 {0x0058, 0x005F, "Reserved (Location)"},
2752 {0x006A, 0x006F, "Reserved (Mechanical)"},
2753 {0x007D, 0x007F, "Reserved (Motion)"},
2754 {0x0094, 0x009F, "Reserved (Scanner)"},
2755 {0x00A3, 0x00AF, "Reserved (Time)"},
2756 {0x00B5, 0x00BF, "Reserved (Personal Activity)"},
2757 {0x00C3, 0x00CF, "Reserved (Orientation Extended)"},
2758 {0x00D3, 0x00DF, "Reserved (Gesture)"},
2759 {0x00E5, 0x00EF, "Reserved (Other)"},
2760 {0x00F0, 0x00FF, "Reserved for Vendors/OEMs"},
2761 {0x031F, 0x03FF, "Reserved (Property)"},
2762 {0x0428, 0x0429, "Reserved (Data Field: Location)"},
2763 {0x042C, 0x042F, "Reserved (Property: Location)"},
2764 {0x043D, 0x043F, "Reserved (Data Field: Environmental)"},
2765 {0x0442, 0x044F, "Reserved (Property: Environmental)"},
2766 {0x0460, 0x046F, "Reserved (Data Field: Motion)"},
2767 {0x048A, 0x048F, "Reserved (Data Field: Orientation)"},
2768 {0x0499, 0x049F, "Reserved (Data Field: Mechanical)"},
2769 {0x04A4, 0x04AF, "Reserved (Property: Mechanical)"},
2770 {0x04BD, 0x04CF, "Reserved (Data Field: Biometric)"},
2771 {0x04E4, 0x04EF, "Reserved (Property: Light)"},
2772 {0x04F3, 0x04F7, "Reserved (Data Field: Scanner)"},
2773 {0x04FA, 0x04FF, "Reserved (Property: Scanner)"},
2774 {0x050A, 0x051F, "Reserved (Data Field: Electrical)"},
2775 {0x052C, 0x052F, "Reserved (Data Field: Time)"},
2776 {0x0536, 0x053F, "Reserved (Property: Time)"},
2777 {0x0577, 0x057F, "Reserved (Data Field: Generic)"},
2778 {0x0583, 0x058F, "Reserved (Property: Generic)"},
2779 {0x0598, 0x059F, "Reserved (Data Field: Personal Activity)"},
2780 {0x05A6, 0x05AF, "Reserved (Property: Personal Activity)"},
2781 {0x05B1, 0x05BF, "Reserved (Data Field: Custom)"},
2782 {0x05C0, 0x07FF, "Reserved for future use as Sensor Types, Data Fields and Properties"},
2783 {0x0800, 0x09FF, "Reserved for use as Selection Values"},
2784 {0x1100, 0x17FF, "Reserved for use as Change Sensitivity Absolute modifier range"},
2785 {0x2100, 0x27FF, "Reserved for use as Maximum modifier range"},
2786 {0x3100, 0x37FF, "Reserved for use as Minimum modifier range"},
2787 {0x4100, 0x47FF, "Reserved for use as Accuracy modifier range"},
2788 {0x5100, 0x57FF, "Reserved for use as Resolution modifier range"},
2789 {0x6100, 0x67FF, "Reserved for use as Threshold High modifier range"},
2790 {0x7100, 0x77FF, "Reserved for use as Threshold Low modifier range"},
2791 {0x8100, 0x87FF, "Reserved for use as Calibration Offset modifier range"},
2792 {0x9100, 0x97FF, "Reserved for use as Calibration Multiplier modifier range"},
2793 {0xA100, 0xA7FF, "Reserved for use as Report Interval modifier range"},
2794 {0xB100, 0xB7FF, "Reserved for use as Frequency Max modifier range"},
2795 {0xC100, 0xC7FF, "Reserved for use as Period Max modifier range"},
2796 {0xD100, 0xD7FF, "Reserved for use as Change Sensitivity Percent modifier range"},
2797 {0xE100, 0xE7FF, "Reserved for use as Change Sensitivity Percent modifier range"},
2798 {0xF100, 0xF7FF, "Reserved for use as Vendor Reserved modifier range"},
2799 /* More generic (and overlapping) ranges in case a better match isn't found above */
2800 {0x1000, 0xEFFF, "Reserved for use as \"Data Fields with Modifiers\""},
2801 {0xF000, 0xFFFF, "Reserved for Vendors/OEMs"},
2802 {0, 0, NULL}
2804 static const value_string usb_hid_medical_instrument_usage_page_vals[] = {
2805 {0x00, "Undefined"},
2806 {0x01, "Medical Ultrasound"},
2807 {0x20, "VCR/Acquisition"},
2808 {0x21, "Freeze/Thaw"},
2809 {0x22, "Clip Store"},
2810 {0x23, "Update"},
2811 {0x24, "Next"},
2812 {0x25, "Save"},
2813 {0x26, "Print"},
2814 {0x27, "Microphone Enable"},
2815 {0x40, "Cine"},
2816 {0x41, "Transmit Power"},
2817 {0x42, "Volume"},
2818 {0x43, "Focus"},
2819 {0x44, "Depth"},
2820 {0x60, "Soft Step - Primary"},
2821 {0x61, "Soft Step - Secondary"},
2822 {0x70, "Depth Gain Compensation"},
2823 {0x80, "Zoom Select"},
2824 {0x81, "Zoom Adjust"},
2825 {0x82, "Spectral Doppler Mode Select"},
2826 {0x83, "Spectral Doppler Adjust"},
2827 {0x84, "Color Doppler Mode Select"},
2828 {0x85, "Color Doppler Adjust"},
2829 {0x86, "Motion Mode Select"},
2830 {0x87, "Motion Mode Adjust"},
2831 {0x88, "2-D Mode Select"},
2832 {0x89, "2-D Mode Adjust"},
2833 {0xA0, "Soft Control Select"},
2834 {0xA1, "Soft Control Adjust"},
2835 {0, NULL}
2837 static const value_string usb_hid_braille_display_usage_page_vals[] = {
2838 {0x000, "Undefined"},
2839 {0x001, "Braille Display"},
2840 {0x002, "Braille Row"},
2841 {0x003, "8 Dot Braille Cell"},
2842 {0x004, "6 Dot Braille Cell"},
2843 {0x005, "Number of Braille Cells"},
2844 {0x006, "Screen Reader Control"},
2845 {0x007, "Screen Reader Identifier"},
2846 {0x0FA, "Router Set 1"},
2847 {0x0FB, "Router Set 2"},
2848 {0x0FC, "Router Set 3"},
2849 {0x100, "Router Key"},
2850 {0x101, "Row Router Key"},
2851 {0x200, "Braille Buttons"},
2852 {0x201, "Braille Keyboard Dot 1"},
2853 {0x202, "Braille Keyboard Dot 2"},
2854 {0x203, "Braille Keyboard Dot 3"},
2855 {0x204, "Braille Keyboard Dot 4"},
2856 {0x205, "Braille Keyboard Dot 5"},
2857 {0x206, "Braille Keyboard Dot 6"},
2858 {0x207, "Braille Keyboard Dot 7"},
2859 {0x208, "Braille Keyboard Dot 8"},
2860 {0x209, "Braille Keyboard Space"},
2861 {0x20A, "Braille Keyboard Left Space"},
2862 {0x20B, "Braille Keyboard Right Space"},
2863 {0x20C, "Braille Face Controls"},
2864 {0x20D, "Braille Left Controls"},
2865 {0x20E, "Braille Right Controls"},
2866 {0x20F, "Braille Top Controls"},
2867 {0x210, "Braille Joystick Center"},
2868 {0x211, "Braille Joystick Up"},
2869 {0x212, "Braille Joystick Down"},
2870 {0x213, "Braille Joystick Left"},
2871 {0x214, "Braille Joystick Right"},
2872 {0x215, "Braille D-Pad Center"},
2873 {0x216, "Braille D-Pad Up"},
2874 {0x217, "Braille D-Pad Down"},
2875 {0x218, "Braille D-Pad Left"},
2876 {0x219, "Braille D-Pad Right"},
2877 {0x21A, "Braille Pan Left"},
2878 {0x21B, "Braille Pan Right"},
2879 {0x21C, "Braille Rocker Up"},
2880 {0x21D, "Braille Rocker Down"},
2881 {0x21E, "Braille Rocker Press"},
2882 {0, NULL}
2884 static const value_string usb_hid_lighting_and_illumination_usage_page_vals[] = {
2885 {0x00, "Undefined"},
2886 {0x01, "LampArray"},
2887 {0x02, "LampArrayAttributesReport"},
2888 {0x03, "LampCount"},
2889 {0x04, "BoundingBoxWidthInMicrometers"},
2890 {0x05, "BoundingBoxHeightInMicrometers"},
2891 {0x06, "BoundingBoxDepthInMicrometers"},
2892 {0x07, "LampArrayKind"},
2893 {0x08, "MinUpdateIntervalInMicroseconds"},
2894 {0x20, "LampAttributesRequestReport"},
2895 {0x21, "LampId"},
2896 {0x22, "LampAttributesResponseReport"},
2897 {0x23, "PositionXInMicrometers"},
2898 {0x24, "PositionYInMicrometers"},
2899 {0x25, "PositionZInMicrometers"},
2900 {0x26, "LampPurposes"},
2901 {0x27, "UpdateLatencyInMicroseconds"},
2902 {0x28, "RedLevelCount"},
2903 {0x29, "GreenLevelCount"},
2904 {0x2A, "BlueLevelCount"},
2905 {0x2B, "IntensityLevelCount"},
2906 {0x2C, "IsProgrammable"},
2907 {0x2D, "InputBinding"},
2908 {0x50, "LampMultiUpdateReport"},
2909 {0x51, "RedUpdateChannel"},
2910 {0x52, "GreenUpdateChannel"},
2911 {0x53, "BlueUpdateChannel"},
2912 {0x54, "IntensityUpdateChannel"},
2913 {0x55, "LampUpdateFlags"},
2914 {0x60, "LampRangeUpdateReport"},
2915 {0x61, "LampIdStart"},
2916 {0x62, "LampIdEnd"},
2917 {0x70, "LampArrayControlReport"},
2918 {0x71, "AutonomousMode"},
2919 {0, NULL}
2921 static const value_string usb_hid_monitor_usage_page_vals[] = {
2922 {0x00, "Reserved"},
2923 {0x01, "Monitor Control"},
2924 {0x02, "EDID Information"},
2925 {0x03, "VDIF Information"},
2926 {0x04, "VESA Version"},
2927 {0, NULL}
2929 static const value_string usb_hid_vesa_virtual_control_usage_page_vals[] = {
2930 /* Contiguous Controls */
2931 {0x10, "Brightness"},
2932 {0x12, "Contrast"},
2933 {0x16, "Red Video Gain"},
2934 {0x18, "Green Video Gain"},
2935 {0x1A, "Blue Video Gain"},
2936 {0x1C, "Focus"},
2937 {0x20, "Horizontal Position"},
2938 {0x22, "Horizontal Size"},
2939 {0x24, "Horizontal Pincushion"},
2940 {0x26, "Horizontal Pincushion Balance"},
2941 {0x28, "Horizontal Misconvergence"},
2942 {0x2A, "Horizontal Linearity"},
2943 {0x2C, "Horizontal Linearity Balance"},
2944 {0x30, "Vertical Position"},
2945 {0x32, "Vertical Size"},
2946 {0x34, "Vertical Pincushion"},
2947 {0x36, "Vertical Pincushion Balance"},
2948 {0x38, "Vertical Misconvergence"},
2949 {0x3A, "Vertical Linearity"},
2950 {0x3C, "Vertical Linearity Balance"},
2951 {0x40, "Parallelogram Distortion (Key Balance)"},
2952 {0x42, "Trapezoidal Distortion (Key)"},
2953 {0x44, "Tilt (Rotation)"},
2954 {0x46, "Top Corner Distortion Control"},
2955 {0x48, "Top Corner Distortion Balance"},
2956 {0x4A, "Bottom Corner Distortion Control"},
2957 {0x4C, "Bottom Corner Distortion Balance"},
2958 {0x56, "Horizontal Moire"},
2959 {0x58, "Vertical Moire"},
2960 {0x6C, "Red Video Black Level"},
2961 {0x6E, "Green Video Black Level"},
2962 {0x70, "Blue Video Black Level"},
2963 /* Non-contiguous Controls (Read/Write) */
2964 {0x5E, "Input Level Select"},
2965 {0x60, "Input Source Select"},
2966 {0xCA, "On Screen Display"},
2967 {0xD4, "StereoMode"},
2968 /* Non-contiguous Controls (Read-only) */
2969 {0xA2, "Auto Size Center"},
2970 {0xA4, "Polarity Horizontal Synchronization"},
2971 {0xA6, "Polarity Vertical Synchronization"},
2972 {0xA8, "Synchronization Type"},
2973 {0xAA, "Screen Orientation"},
2974 {0xAC, "Horizontal Frequency"},
2975 {0xAE, "Vertical Frequency"},
2976 /* Non-contiguous Controls (Write-only) */
2977 {0x01, "Degauss"},
2978 {0xB0, "Settings"},
2979 {0, NULL}
2981 static const value_string usb_hid_power_device_usage_page_vals[] = {
2982 {0x00, "Undefined"},
2983 {0x01, "iName"},
2984 {0x02, "PresentStatus"},
2985 {0x03, "ChangedStatus"},
2986 {0x04, "UPS"},
2987 {0x05, "PowerSupply"},
2988 {0x10, "BatterySystem"},
2989 {0x11, "BatterySystemID"},
2990 {0x12, "Battery"},
2991 {0x13, "BatteryID"},
2992 {0x14, "Charger"},
2993 {0x15, "ChargerID"},
2994 {0x16, "PowerConverter"},
2995 {0x17, "PowerConverterID"},
2996 {0x18, "OutletSystem"},
2997 {0x19, "OutletSystemID"},
2998 {0x1A, "Input"},
2999 {0x1B, "InputID"},
3000 {0x1C, "Output"},
3001 {0x1D, "OutputID"},
3002 {0x1E, "Flow"},
3003 {0x1F, "FlowID"},
3004 {0x20, "Outlet"},
3005 {0x21, "OutletID"},
3006 {0x22, "Gang"},
3007 {0x23, "GangID"},
3008 {0x24, "PowerSummary"},
3009 {0x25, "PowerSummaryID"},
3010 {0x30, "Voltage"},
3011 {0x31, "Current"},
3012 {0x32, "Frequency"},
3013 {0x33, "ApparentPower"},
3014 {0x34, "ActivePower"},
3015 {0x35, "PercentLoad"},
3016 {0x36, "Temperature"},
3017 {0x37, "Humidity"},
3018 {0x38, "BadCount"},
3019 {0x40, "ConfigVoltage"},
3020 {0x41, "ConfigCurrent"},
3021 {0x42, "ConfigFrequency"},
3022 {0x43, "ConfigApparentPower"},
3023 {0x44, "ConfigActivePower"},
3024 {0x45, "ConfigPercentLoad"},
3025 {0x46, "ConfigTemperature"},
3026 {0x47, "ConfigHumidity"},
3027 {0x50, "SwitchOnControl"},
3028 {0x51, "SwitchOffControl"},
3029 {0x52, "ToggleControl"},
3030 {0x53, "LowVoltageTransfer"},
3031 {0x54, "HighVoltageTransfer"},
3032 {0x55, "DelayBeforeReboot"},
3033 {0x56, "DelayBeforeStartup"},
3034 {0x57, "DelayBeforeShutdown"},
3035 {0x58, "Test"},
3036 {0x59, "ModuleReset"},
3037 {0x5A, "AudibleAlarmControl"},
3038 {0x60, "Present"},
3039 {0x61, "Good"},
3040 {0x62, "InternalFailure"},
3041 {0x63, "VoltageOutOfRange"},
3042 {0x64, "FrequencyOutOfRange"},
3043 {0x65, "Overload"},
3044 {0x66, "OverCharged"},
3045 {0x67, "OverTemperature"},
3046 {0x68, "ShutdownRequested"},
3047 {0x69, "ShutdownImminent"},
3048 {0x6B, "SwitchOn/Off"},
3049 {0x6C, "Switchable"},
3050 {0x6D, "Used"},
3051 {0x6E, "Boost"},
3052 {0x6F, "Buck"},
3053 {0x70, "Initialized"},
3054 {0x71, "Tested"},
3055 {0x72, "AwaitingPower"},
3056 {0x73, "CommunicationLost"},
3057 {0xFD, "iManufacturer"},
3058 {0xFE, "iProduct"},
3059 {0xFF, "iserialNumber"},
3060 {0, NULL}
3062 static const value_string usb_hid_battery_system_usage_page_vals[] = {
3063 {0x00, "Undefined"},
3064 {0x01, "SMBBatteryMode"},
3065 {0x02, "SMBBatteryStatus"},
3066 {0x03, "SMBAlarmWarning"},
3067 {0x04, "SMBChargerMode"},
3068 {0x05, "SMBChargerStatus"},
3069 {0x06, "SMBChargerSpecInfo"},
3070 {0x07, "SMBSelectorState"},
3071 {0x08, "SMBSelectorPresets"},
3072 {0x09, "SMBSelectorInfo"},
3073 {0x10, "OptionalMfgFunction1"},
3074 {0x11, "OptionalMfgFunction2"},
3075 {0x12, "OptionalMfgFunction3"},
3076 {0x13, "OptionalMfgFunction4"},
3077 {0x14, "OptionalMfgFunction5"},
3078 {0x15, "ConnectionToSMBus"},
3079 {0x16, "OutputConnection"},
3080 {0x17, "ChargerConnection"},
3081 {0x18, "BatteryInsertion"},
3082 {0x19, "Usenext"},
3083 {0x1A, "OKToUse"},
3084 {0x1B, "BatterySupported"},
3085 {0x1C, "SelectorRevision"},
3086 {0x1D, "ChargingIndicator"},
3087 {0x28, "ManufacturerAccess"},
3088 {0x29, "RemainingCapacityLimit"},
3089 {0x2A, "RemainingTimeLimit"},
3090 {0x2B, "AtRate"},
3091 {0x2C, "CapacityMode"},
3092 {0x2D, "BroadcastToCharger"},
3093 {0x2E, "PrimaryBattery"},
3094 {0x2F, "ChargeController"},
3095 {0x40, "TerminateCharge"},
3096 {0x41, "TerminateDischarge"},
3097 {0x42, "BelowRemainingCapacityLimit"},
3098 {0x43, "RemainingTimeLimitExpired"},
3099 {0x44, "Charging"},
3100 {0x45, "Discharging"},
3101 {0x46, "FullyCharged"},
3102 {0x47, "FullyDischarged"},
3103 {0x48, "ConditioningFlag"},
3104 {0x49, "AtRateOK"},
3105 {0x4A, "SMBErrorCode"},
3106 {0x4B, "NeedReplacement"},
3107 {0x60, "AtRateTimeToFull"},
3108 {0x61, "AtRateTimeToEmpty"},
3109 {0x62, "AverageCurrent"},
3110 {0x63, "Maxerror"},
3111 {0x64, "RelativeStateOfCharge"},
3112 {0x65, "AbsoluteStateOfCharge"},
3113 {0x66, "RemainingCapacity"},
3114 {0x67, "FullChargeCapacity"},
3115 {0x68, "RunTimeToEmpty"},
3116 {0x69, "AverageTimeToEmpty"},
3117 {0x6A, "AverageTimeToFull"},
3118 {0x6B, "CycleCount"},
3119 {0x80, "BattPackModelLevel"},
3120 {0x81, "InternalChargeController"},
3121 {0x82, "PrimaryBatterySupport"},
3122 {0x83, "DesignCapacity"},
3123 {0x84, "SpecificationInfo"},
3124 {0x85, "ManufacturerDate"},
3125 {0x86, "SerialNumber"},
3126 {0x87, "iManufacturerName"},
3127 {0x88, "iDevicename"},
3128 {0x89, "iDeviceChemistery"},
3129 {0x8A, "ManufacturerData"},
3130 {0x8B, "Rechargeable"},
3131 {0x8C, "WarningCapacityLimit"},
3132 {0x8D, "CapacityGranularity1"},
3133 {0x8E, "CapacityGranularity2"},
3134 {0x8F, "iOEMInformation"},
3135 {0xC0, "InhibitCharge"},
3136 {0xC1, "EnablePolling"},
3137 {0xC2, "ResetToZero"},
3138 {0xD0, "ACPresent"},
3139 {0xD1, "BatteryPresent"},
3140 {0xD2, "PowerFail"},
3141 {0xD3, "AlarmInhibited"},
3142 {0xD4, "ThermistorUnderRange"},
3143 {0xD5, "ThermistorHot"},
3144 {0xD6, "ThermistorCold"},
3145 {0xD7, "ThermistorOverRange"},
3146 {0xD8, "VoltageOutOfRange"},
3147 {0xD9, "CurrentOutOfRange"},
3148 {0xDA, "CurrentNotRegulated"},
3149 {0xDB, "VoltageNotRegulated"},
3150 {0xDC, "MasterMode"},
3151 {0xF0, "ChargerSelectorSupport"},
3152 {0xF1, "ChargerSpec"},
3153 {0xF2, "Level2"},
3154 {0xF3, "Level3"},
3155 {0, NULL}
3157 static const value_string usb_hid_barcode_scanner_usage_page_vals[] = {
3158 {0x000, "Undefined"},
3159 {0x001, "Bar Code Badge Reader"},
3160 {0x002, "Bar Code Scanner"},
3161 {0x003, "Dumb Bar Code Scanner"},
3162 {0x004, "Cordless Scanner Base"},
3163 {0x005, "Bar Code Scanner Cradle"},
3164 {0x010, "Attribute Report"},
3165 {0x011, "Settings Report"},
3166 {0x012, "Scanned Data Report"},
3167 {0x013, "Raw Scanned Data Report"},
3168 {0x014, "Trigger Report"},
3169 {0x015, "Status Report"},
3170 {0x016, "UPC/EAN Control Report"},
3171 {0x017, "EAN 2/3 Label Control Report"},
3172 {0x018, "Code 39 Control Report"},
3173 {0x019, "Interleaved 2 of 5 Control Report"},
3174 {0x01A, "Standard 2 of 5 Control Report"},
3175 {0x01B, "MSI Plessey Control Report"},
3176 {0x01C, "Codabar Control Report"},
3177 {0x01D, "Code 128 Control Report"},
3178 {0x01E, "Misc 1D Control Report"},
3179 {0x01F, "2D Control Report"},
3180 {0x030, "Aiming/Pointer Mode"},
3181 {0x031, "Bar Code Present Sensor"},
3182 {0x032, "Class 1A Laser"},
3183 {0x033, "Class 2 Laser"},
3184 {0x034, "Heater Present"},
3185 {0x035, "Contact Scanner"},
3186 {0x036, "Electronic Article Surveillance Notification"},
3187 {0x037, "Constant Electronic Article Surveillance"},
3188 {0x038, "Error Indication"},
3189 {0x039, "Fixed Beeper"},
3190 {0x03A, "Good Decode Indication"},
3191 {0x03B, "Hands Free Scanning"},
3192 {0x03C, "Intrinsically Safe"},
3193 {0x03D, "Klasse Eins Laser"},
3194 {0x03E, "Long Range Scanner"},
3195 {0x03F, "Mirror Speed Control"},
3196 {0x040, "Not On File Indication"},
3197 {0x041, "Programmable Beeper"},
3198 {0x042, "Triggerless"},
3199 {0x043, "Wand"},
3200 {0x044, "Water Resistant"},
3201 {0x045, "Multi-Range Scanner"},
3202 {0x046, "Proximity Sensor"},
3203 {0x04D, "Fragment Decoding"},
3204 {0x04E, "Scanner Read Confidence"},
3205 {0x04F, "Data Prefix"},
3206 {0x050, "Prefix AIMI"},
3207 {0x051, "Prefix None"},
3208 {0x052, "Prefix Proprietary"},
3209 {0x055, "Active Time"},
3210 {0x056, "Aiming Laser Pattern"},
3211 {0x057, "Bar Code Present"},
3212 {0x058, "Beeper State"},
3213 {0x059, "Laser On Time"},
3214 {0x05A, "Laser State"},
3215 {0x05B, "Lockout Time"},
3216 {0x05C, "Motor State"},
3217 {0x05D, "Motor Timeout"},
3218 {0x05E, "Power On Reset Scanner"},
3219 {0x05F, "Prevent Read of Barcodes"},
3220 {0x060, "Initiate Barcode Read"},
3221 {0x061, "Trigger State"},
3222 {0x062, "Trigger Mode"},
3223 {0x063, "Trigger Mode Blinking Laser On"},
3224 {0x064, "Trigger Mode Continuous Laser On"},
3225 {0x065, "Trigger Mode Laser on while Pulled"},
3226 {0x066, "Trigger Mode Laser stays on after Trigger release"},
3227 {0x06D, "Commit Parameters to NVM"},
3228 {0x06E, "Parameter Scanning"},
3229 {0x06F, "Parameters Changed"},
3230 {0x070, "Set parameter default values"},
3231 {0x075, "Scanner In Cradle"},
3232 {0x076, "Scanner In Range"},
3233 {0x07A, "Aim Duration"},
3234 {0x07B, "Good Read Lamp Duration"},
3235 {0x07C, "Good Read Lamp Intensity"},
3236 {0x07D, "Good Read LED"},
3237 {0x07E, "Good Read Tone Frequency"},
3238 {0x07F, "Good Read Tone Length"},
3239 {0x080, "Good Read Tone Volume"},
3240 {0x082, "No Read Message"},
3241 {0x083, "Not on File Volume"},
3242 {0x084, "Powerup Beep"},
3243 {0x085, "Sound Error Beep"},
3244 {0x086, "Sound Good Read Beep"},
3245 {0x087, "Sound Not On File Beep"},
3246 {0x088, "Good Read When to Write"},
3247 {0x089, "GRWTI After Decode"},
3248 {0x08A, "GRWTI Beep/Lamp after transmit"},
3249 {0x08B, "GRWTI No Beep/Lamp use at all"},
3250 {0x091, "Bookland EAN"},
3251 {0x092, "Convert EAN 8 to 13 Type"},
3252 {0x093, "Convert UPC A to EAN-13"},
3253 {0x094, "Convert UPC-E to A"},
3254 {0x095, "EAN-13"},
3255 {0x096, "EAN-8"},
3256 {0x097, "EAN-99 128_Mandatory"},
3257 {0x098, "EAN-99 P5/128_Optional"},
3258 {0x099, "Enable EAN Two Label"},
3259 {0x09A, "UPC/EAN"},
3260 {0x09B, "UPC/EAN Coupon Code"},
3261 {0x09C, "UPC/EAN Periodicals"},
3262 {0x09D, "UPC-A"},
3263 {0x09E, "UPC-A with 128 Mandatory"},
3264 {0x09F, "UPC-A with 128 Optional"},
3265 {0x0A0, "UPC-A with P5 Optional"},
3266 {0x0A1, "UPC-E"},
3267 {0x0A2, "UPC-E1"},
3268 {0x0A9, "Periodical"},
3269 {0x0AA, "Periodical Auto-Discriminate + 2"},
3270 {0x0AB, "Periodical Only Decode with + 2"},
3271 {0x0AC, "Periodical Ignore + 2"},
3272 {0x0AD, "Periodical Auto-Discriminate + 5"},
3273 {0x0AE, "Periodical Only Decode with + 5"},
3274 {0x0AF, "Periodical Ignore + 5"},
3275 {0x0B0, "Check"},
3276 {0x0B1, "Check Disable Price"},
3277 {0x0B2, "Check Enable 4 digit Price"},
3278 {0x0B3, "Check Enable 5 digit Price"},
3279 {0x0B4, "Check Enable European 4 digit Price"},
3280 {0x0B5, "Check Enable European 5 digit Price"},
3281 {0x0B7, "EAN Two Label"},
3282 {0x0B8, "EAN Three Label"},
3283 {0x0B9, "EAN 8 Flag Digit 1"},
3284 {0x0BA, "EAN 8 Flag Digit 2"},
3285 {0x0BB, "EAN 8 Flag Digit 3"},
3286 {0x0BC, "EAN 13 Flag Digit 1"},
3287 {0x0BD, "EAN 13 Flag Digit 2"},
3288 {0x0BE, "EAN 13 Flag Digit 3"},
3289 {0x0BF, "Add EAN 2/3 Label Definition"},
3290 {0x0C0, "Clear all EAN 2/3 Label Definitions"},
3291 {0x0C3, "Codabar"},
3292 {0x0C4, "Code 128"},
3293 {0x0C7, "Code 39"},
3294 {0x0C8, "Code 93 "},
3295 {0x0C9, "Full ASCII Conversion"},
3296 {0x0CA, "Interleaved 2 of 5"},
3297 {0x0CB, "Italian Pharmacy Code"},
3298 {0x0CC, "MSI/Plessey"},
3299 {0x0CD, "Standard 2 of 5 IATA"},
3300 {0x0CE, "Standard 2 of 5"},
3301 {0x0D3, "Transmit Start/Stop"},
3302 {0x0D4, "Tri-Optic"},
3303 {0x0D5, "UCC/EAN-128"},
3304 {0x0D6, "Check Digit"},
3305 {0x0D7, "Check Digit Disable"},
3306 {0x0D8, "Check Digit Enable Interleaved 2 of 5 OPCC"},
3307 {0x0D9, "Check Digit Enable Interleaved 2 of 5 USS"},
3308 {0x0DA, "Check Digit Enable Standard 2 of 5 OPCC"},
3309 {0x0DB, "Check Digit Enable Standard 2 of 5 USS"},
3310 {0x0DC, "Check Digit Enable One MSI Plessey"},
3311 {0x0DD, "Check Digit Enable Two MSI Plessey"},
3312 {0x0DE, "Check Digit Codabar Enable"},
3313 {0x0DF, "Check Digit Code 39 Enable"},
3314 {0x0F0, "Transmit Check Digit"},
3315 {0x0F1, "Disable Check Digit Transmit"},
3316 {0x0F2, "Enable Check Digit Transmit"},
3317 {0x0FB, "Symbology Identifier 1"},
3318 {0x0FC, "Symbology Identifier 2"},
3319 {0x0FD, "Symbology Identifier 3"},
3320 {0x0FE, "Decoded Data"},
3321 {0x0FF, "Decode Data Continued"},
3322 {0x100, "Bar Space Data"},
3323 {0x101, "Scanner Data Accuracy"},
3324 {0x102, "Raw Data Polarity"},
3325 {0x103, "Polarity Inverted Bar Code"},
3326 {0x104, "Polarity Normal Bar Code"},
3327 {0x106, "Minimum Length to Decode"},
3328 {0x107, "Maximum Length to Decode"},
3329 {0x108, "First Discrete Length to Decode"},
3330 {0x109, "Second Discrete Length to Decode"},
3331 {0x10A, "Data Length Method"},
3332 {0x10B, "DL Method Read any"},
3333 {0x10C, "DL Method Check in Range"},
3334 {0x10D, "DL Method Check for Discrete"},
3335 {0x110, "Aztec Code"},
3336 {0x111, "BC412"},
3337 {0x112, "Channel Code"},
3338 {0x113, "Code 16"},
3339 {0x114, "Code 32"},
3340 {0x115, "Code 49"},
3341 {0x116, "Code One"},
3342 {0x117, "Colorcode"},
3343 {0x118, "Data Matrix"},
3344 {0x119, "MaxiCode"},
3345 {0x11A, "MicroPDF"},
3346 {0x11B, "PDF-417"},
3347 {0x11C, "PosiCode"},
3348 {0x11D, "QR Code"},
3349 {0x11E, "SuperCode"},
3350 {0x11F, "UltraCode"},
3351 {0x120, "USD-5 (Slug Code)"},
3352 {0x121, "VeriCode"},
3353 {0, NULL}
3355 static const value_string usb_hid_weighing_devices_usage_page_vals[] = {
3356 {0x00, "Undefined"},
3357 {0x01, "Weighing Device"},
3358 {0x20, "Scale Device"},
3359 {0x21, "Scale Class I Metric"},
3360 {0x22, "Scale Class I Metric"},
3361 {0x23, "Scale Class II Metric"},
3362 {0x24, "Scale Class III Metric"},
3363 {0x25, "Scale Class IIIL Metric"},
3364 {0x26, "Scale Class IV Metric"},
3365 {0x27, "Scale Class III English"},
3366 {0x28, "Scale Class IIIL English"},
3367 {0x29, "Scale Class IV English"},
3368 {0x2A, "Scale Class Generic"},
3369 {0x30, "Scale Attribute Report"},
3370 {0x31, "Scale Control Report"},
3371 {0x32, "Scale Data Report"},
3372 {0x33, "Scale Status Report"},
3373 {0x34, "Scale Weight Limit Report"},
3374 {0x35, "Scale Statistics Report"},
3375 {0x40, "Data Weight"},
3376 {0x41, "Data Scaling"},
3377 {0x50, "Weight Unit"},
3378 {0x51, "Weight Unit Milligram"},
3379 {0x52, "Weight Unit Gram"},
3380 {0x53, "Weight Unit Kilogram"},
3381 {0x54, "Weight Unit Carats"},
3382 {0x55, "Weight Unit Taels"},
3383 {0x56, "Weight Unit Grains"},
3384 {0x57, "Weight Unit Pennyweights"},
3385 {0x58, "Weight Unit Metric Ton"},
3386 {0x59, "Weight Unit Avoir Ton"},
3387 {0x5A, "Weight Unit Troy Ounce"},
3388 {0x5B, "Weight Unit Ounce"},
3389 {0x5C, "Weight Unit Pound"},
3390 {0x60, "Calibration Count"},
3391 {0x61, "Re-Zero Count"},
3392 {0x70, "Scale Status"},
3393 {0x71, "Scale Status Fault"},
3394 {0x72, "Scale Status Stable at Center of Zero"},
3395 {0x73, "Scale Status In Motion"},
3396 {0x74, "Scale Status Weight Stable"},
3397 {0x75, "Scale Status Under Zero"},
3398 {0x76, "Scale Status Over Weight Limit"},
3399 {0x77, "Scale Status Requires Calibration"},
3400 {0x78, "Scale Status Requires Re- zeroing"},
3401 {0x80, "Zero Scale"},
3402 {0x81, "Enforced Zero Return"},
3403 {0, NULL}
3405 static const value_string usb_hid_magnetic_stripe_reader_usage_page_vals[] = {
3406 {0x00, "Undefined"},
3407 {0x01, "MSR Device Read-Only"},
3408 {0x11, "Track 1 Length"},
3409 {0x12, "Track 2 Length"},
3410 {0x13, "Track 3 Length"},
3411 {0x14, "Track JIS Length"},
3412 {0x20, "Track Data"},
3413 {0x21, "Track 1 Data"},
3414 {0x22, "Track 2 Data"},
3415 {0x23, "Track 3 Data"},
3416 {0x24, "Track JIS Data"},
3417 {0, NULL}
3419 static const value_string usb_hid_camera_control_usage_page_vals[] = {
3420 {0x00, "Undefined"},
3421 {0x20, "Camera Auto-focus"},
3422 {0x21, "Camera Shutter"},
3423 {0, NULL}
3425 static const value_string usb_hid_arcade_usage_page_vals[] = {
3426 {0x00, "Undefined"},
3427 {0x01, "General Purpose IO Card"},
3428 {0x02, "Coin Door"},
3429 {0x03, "Watchdog Timer"},
3430 {0x30, "General Purpose Analog Input State"},
3431 {0x31, "General Purpose Digital Input State"},
3432 {0x32, "General Purpose Optical Input State"},
3433 {0x33, "General Purpose Digital Output State"},
3434 {0x34, "Number of Coin Doors"},
3435 {0x35, "Coin Drawer Drop Count"},
3436 {0x36, "Coin Drawer Start"},
3437 {0x37, "Coin Drawer Service"},
3438 {0x38, "Coin Drawer Tilt"},
3439 {0x39, "Coin Door Test"},
3440 {0x3F, "[Undefined]"},
3441 {0x40, "Coin Door Lockout"},
3442 {0x41, "Watchdog Timeout"},
3443 {0x42, "Watchdog Action"},
3444 {0x43, "Watchdog Reboot"},
3445 {0x44, "Watchdog Restart"},
3446 {0x45, "Alarm Input"},
3447 {0x46, "Coin Door Counter"},
3448 {0x47, "I/O Direction Mapping"},
3449 {0x48, "Set I/O Direction"},
3450 {0x49, "Extended Optical Input State"},
3451 {0x4A, "Pin Pad Input State"},
3452 {0x4B, "Pin Pad Status"},
3453 {0x4C, "Pin Pad Output"},
3454 {0x4D, "Pin Pad Command"},
3455 {0, NULL}
3457 static const value_string usb_hid_fido_alliance_usage_page_vals[] = {
3458 {0x00, "Undefined"},
3459 {0x01, "U2F Authenticator Device"},
3460 {0x20, "Input Report Data"},
3461 {0x21, "Output Report Data"},
3462 {0, NULL}
3465 static const value_string keycode_vals[] = {
3466 {0x00, "<ACTION KEY UP>"},
3467 {0x01, "ErrorRollOver"},
3468 {0x02, "POSTFail"},
3469 {0x03, "ErrorUndefined"},
3471 {0x04, "a"},
3472 {0x05, "b"},
3473 {0x06, "c"},
3474 {0x07, "d"},
3475 {0x08, "e"},
3476 {0x09, "f"},
3477 {0x0A, "g"},
3478 {0x0B, "h"},
3479 {0x0C, "i"},
3480 {0x0D, "j"},
3481 {0x0E, "k"},
3482 {0x0F, "l"},
3483 {0x10, "m"},
3484 {0x11, "n"},
3485 {0x12, "o"},
3486 {0x13, "p"},
3487 {0x14, "q"},
3488 {0x15, "r"},
3489 {0x16, "s"},
3490 {0x17, "t"},
3491 {0x18, "u"},
3492 {0x19, "v"},
3493 {0x1A, "w"},
3494 {0x1B, "x"},
3495 {0x1C, "y"},
3496 {0x1D, "z"},
3498 {0x1E, "1"},
3499 {0x1F, "2"},
3500 {0x20, "3"},
3501 {0x21, "4"},
3502 {0x22, "5"},
3503 {0x23, "6"},
3504 {0x24, "7"},
3505 {0x25, "8"},
3506 {0x26, "9"},
3507 {0x27, "0"},
3509 {0x28, "ENTER"},
3510 {0x29, "Escape"},
3511 {0x2A, "Backspace"},
3512 {0x2B, "Tab"},
3513 {0x2C, "Spacebar"},
3515 {0x2D, "-"},
3516 {0x2E, "="},
3517 {0x2F, "["},
3518 {0x30, "]"},
3519 {0x31, "\\"},
3520 {0x32, "NonUS #/~"},
3521 {0x33, ";"},
3522 {0x34, "'"},
3523 {0x35, "`"},
3524 {0x36, ","},
3525 {0x37, "."},
3526 {0x38, "/"},
3527 {0x39, "CapsLock"},
3528 {0x3A, "F1"},
3529 {0x3B, "F2"},
3530 {0x3C, "F3"},
3531 {0x3D, "F4"},
3532 {0x3E, "F5"},
3533 {0x3F, "F6"},
3534 {0x40, "F7"},
3535 {0x41, "F8"},
3536 {0x42, "F9"},
3537 {0x43, "F10"},
3538 {0x44, "F11"},
3539 {0x45, "F12"},
3540 {0x46, "PrintScreen"},
3541 {0x47, "ScrollLock"},
3542 {0x48, "Pause"},
3543 {0x49, "Insert"},
3544 {0x4A, "Home"},
3545 {0x4B, "PageUp"},
3546 {0x4C, "DeleteForward"},
3547 {0x4D, "End"},
3548 {0x4E, "PageDown"},
3549 {0x4F, "RightArrow"},
3550 {0x50, "LeftArrow"},
3551 {0x51, "DownArrow"},
3552 {0x52, "UpArrow"},
3553 {0x53, "NumLock"},
3555 /* Keypad */
3556 {0x54, "Keypad /"},
3557 {0x55, "Keypad *"},
3558 {0x56, "Keypad -"},
3559 {0x57, "Keypad +"},
3560 {0x58, "Keypad ENTER"},
3561 {0x59, "Keypad 1"},
3562 {0x5A, "Keypad 2"},
3563 {0x5B, "Keypad 3"},
3564 {0x5C, "Keypad 4"},
3565 {0x5D, "Keypad 5"},
3566 {0x5E, "Keypad 6"},
3567 {0x5F, "Keypad 7"},
3568 {0x60, "Keypad 8"},
3569 {0x61, "Keypad 9"},
3570 {0x62, "Keypad 0"},
3571 {0x63, "Keypad ."},
3573 /* non PC AT */
3574 {0x64, "NonUS \\/|"},
3575 {0x65, "Application"},
3576 {0x66, "Power"},
3577 {0x67, "Keypad ="},
3578 {0x68, "F13"},
3579 {0x69, "F14"},
3580 {0x6A, "F15"},
3581 {0x6B, "F16"},
3582 {0x6C, "F17"},
3583 {0x6D, "F18"},
3584 {0x6E, "F19"},
3585 {0x6F, "F20"},
3587 {0x70, "F21"},
3588 {0x71, "F22"},
3589 {0x72, "F23"},
3590 {0x73, "F24"},
3591 {0x74, "Execute"},
3592 {0x75, "Help"},
3593 {0x76, "Menu"},
3594 {0x77, "Select"},
3595 {0x78, "Stop"},
3596 {0x79, "Again"},
3597 {0x7A, "Undo"},
3598 {0x7B, "Cut"},
3599 {0x7C, "Copy"},
3600 {0x7D, "Paste"},
3601 {0x7E, "Find"},
3602 {0x7F, "Mute"},
3604 {0x80, "VolumeUp"},
3605 {0x81, "VolumeDown"},
3606 {0x82, "Locking CapsLock"},
3607 {0x83, "Locking NumLock"},
3608 {0x84, "Locking ScrollLock"},
3609 {0x85, "Keypad Comma"},
3610 {0x86, "Keypad EqualSign"},
3611 {0x87, "International1"},
3612 {0x88, "International2"},
3613 {0x89, "International3"},
3614 {0x8A, "International4"},
3615 {0x8B, "International5"},
3616 {0x8C, "International6"},
3617 {0x8D, "International7"},
3618 {0x8E, "International8"},
3619 {0x8F, "International9"},
3621 {0x90, "LANG1"},
3622 {0x91, "LANG2"},
3623 {0x92, "LANG3"},
3624 {0x93, "LANG4"},
3625 {0x94, "LANG5"},
3626 {0x95, "LANG6"},
3627 {0x96, "LANG7"},
3628 {0x97, "LANG8"},
3629 {0x98, "LANG9"},
3630 {0x99, "AlternateErase"},
3631 {0x9A, "SysReq/Attention"},
3632 {0x9B, "Cancel"},
3633 {0x9C, "Clear"},
3634 {0x9D, "Prior"},
3635 {0x9E, "Return"},
3636 {0x9F, "Separator"},
3638 {0xA0, "Out"},
3639 {0xA1, "Oper"},
3640 {0xA2, "Clear/Again"},
3641 {0xA3, "CrSel/Props"},
3642 {0xA4, "ExSel"},
3643 /* 0xA5..0xAF - reserved */
3644 {0xB0, "Keypad 00"},
3645 {0xB1, "Keypad 000"},
3646 {0xB2, "ThousandsSeparator"},
3647 {0xB3, "DecimalSeparator"},
3648 {0xB4, "CurrencyUnit"},
3649 {0xB5, "CurrencySubunit"},
3650 {0xB6, "Keypad ("},
3651 {0xB7, "Keypad )"},
3652 {0xB8, "Keypad {"},
3653 {0xB9, "Keypad }"},
3654 {0xBA, "Keypad Tab"},
3655 {0xBB, "Keypad Backspace"},
3656 {0xBC, "Keypad A"},
3657 {0xBD, "Keypad B"},
3658 {0xBE, "Keypad C"},
3659 {0xBF, "Keypad D"},
3661 {0xC0, "Keypad E"},
3662 {0xC1, "Keypad F"},
3663 {0xC2, "Keypad XOR"},
3664 {0xC3, "Keypad ^"},
3665 {0xC4, "Keypad %"},
3666 {0xC5, "Keypad <"},
3667 {0xC6, "Keypad >"},
3668 {0xC7, "Keypad &"},
3669 {0xC8, "Keypad &&"},
3670 {0xC9, "Keypad |"},
3671 {0xCA, "Keypad ||"},
3672 {0xCB, "Keypad :"},
3673 {0xCC, "Keypad #"},
3674 {0xCD, "Keypad Space"},
3675 {0xCE, "Keypad @"},
3676 {0xCF, "Keypad !"},
3678 {0xD0, "Keypad Memory Store"},
3679 {0xD1, "Keypad Memory Recall"},
3680 {0xD2, "Keypad Memory Clear"},
3681 {0xD3, "Keypad Memory Add"},
3682 {0xD4, "Keypad Memory Subtract"},
3683 {0xD5, "Keypad Memory Multiply"},
3684 {0xD6, "Keypad Memory Divide"},
3685 {0xD7, "Keypad +/-"},
3686 {0xD8, "Keypad Clear"},
3687 {0xD9, "Keypad Clear Entry"},
3688 {0xDA, "Keypad Binary"},
3689 {0xDB, "Keypad Octal"},
3690 {0xDC, "Keypad Decimal"},
3691 {0xDD, "Keypad Hexadecimal"},
3692 /* 0xDE..0xDF - reserved, */
3693 {0xE0, "LeftControl"},
3694 {0xE1, "LeftShift"},
3695 {0xE2, "LeftAlt"},
3696 {0xE3, "LeftGUI"},
3697 {0xE4, "RightControl"},
3698 {0xE5, "RightShift"},
3699 {0xE6, "RightAlt"},
3700 {0xE7, "RightGUI"},
3702 {0, NULL}
3704 static value_string_ext keycode_vals_ext = VALUE_STRING_EXT_INIT(keycode_vals);
3706 static uint32_t
3707 hid_unpack_value(uint8_t *data, unsigned int idx, unsigned int size)
3709 uint32_t value = 0;
3711 for(unsigned int i = 1; i <= size; i++)
3712 value |= data[idx + i] << (8 * (i - 1));
3714 return value;
3717 static bool
3718 hid_unpack_signed(uint8_t *data, unsigned int idx, unsigned int size, int32_t *value)
3720 if (size == 1)
3721 *value = (int8_t) hid_unpack_value(data, idx, size);
3722 else if (size == 2)
3723 *value = (int16_t) hid_unpack_value(data, idx, size);
3724 else if (size == 4)
3725 *value = (int32_t) hid_unpack_value(data, idx, size);
3726 else
3727 return true;
3729 return false;
3732 static bool
3733 parse_report_descriptor(report_descriptor_t *rdesc)
3735 hid_field_t field;
3736 uint8_t *data = rdesc->desc_body;
3737 unsigned int tag, type, size;
3738 uint8_t prefix;
3739 uint32_t defined = 0, usage_page = 0, usage = 0, usage_min = 0, usage_max = 0;
3740 wmem_allocator_t *scope = wmem_file_scope();
3741 bool first_item = true;
3743 memset(&field, 0, sizeof(field));
3744 field.usages = wmem_array_new(scope, sizeof(uint32_t));
3745 rdesc->fields_in = wmem_array_new(scope, sizeof(hid_field_t));
3746 rdesc->fields_out = wmem_array_new(scope, sizeof(hid_field_t));
3748 int i = 0;
3749 while (i < rdesc->desc_length)
3751 prefix = data[i];
3752 tag = (prefix & 0b11110000) >> 4;
3753 type = (prefix & 0b00001100) >> 2;
3754 size = prefix & 0b00000011;
3756 if (size == 3) /* HID spec: 6.2.2.2 - Short Items */
3757 size = 4;
3759 switch (type)
3761 case USBHID_ITEMTYPE_MAIN:
3762 switch (tag)
3764 case USBHID_MAINITEM_TAG_INPUT:
3765 field.properties = hid_unpack_value(data, i, size);
3767 if ((defined & HID_REQUIRED_MASK) != HID_REQUIRED_MASK)
3768 goto err;
3770 /* new field */
3771 wmem_array_append_one(rdesc->fields_in, field);
3773 field.usages = wmem_array_new(scope, sizeof(uint32_t));
3774 first_item = false;
3776 /* only keep the global items */
3777 defined &= HID_GLOBAL_MASK;
3778 break;
3780 case USBHID_MAINITEM_TAG_OUTPUT:
3781 field.properties = hid_unpack_value(data, i, size);
3783 if ((defined & HID_REQUIRED_MASK) != HID_REQUIRED_MASK)
3784 goto err;
3786 /* new field */
3787 wmem_array_append_one(rdesc->fields_out, field);
3789 field.usages = wmem_array_new(scope, sizeof(uint32_t));
3790 first_item = false;
3792 defined &= HID_GLOBAL_MASK;
3793 break;
3795 case USBHID_MAINITEM_TAG_FEATURE:
3797 field.properties = hid_unpack_value(data, i, size);
3798 TODO
3800 break;
3802 case USBHID_MAINITEM_TAG_COLLECTION:
3803 /* clear usages */
3804 wmem_free(scope, field.usages);
3805 field.usages = wmem_array_new(scope, sizeof(uint32_t));
3806 break;
3808 default:
3809 break;
3811 break;
3813 case USBHID_ITEMTYPE_GLOBAL:
3814 switch (tag)
3816 case USBHID_GLOBALITEM_TAG_USAGE_PAGE:
3817 usage_page = hid_unpack_value(data, i, size);
3818 if (usage_page > UINT16_MAX)
3819 goto err;
3820 defined |= HID_USAGE_PAGE;
3821 break;
3823 case USBHID_GLOBALITEM_TAG_LOG_MIN:
3824 if (hid_unpack_signed(data, i, size, &field.logical_min))
3825 goto err;
3826 defined |= HID_LOGICAL_MIN;
3827 break;
3829 case USBHID_GLOBALITEM_TAG_LOG_MAX:
3830 if (hid_unpack_signed(data, i, size, &field.logical_max))
3831 goto err;
3832 defined |= HID_LOGICAL_MAX;
3833 break;
3835 case USBHID_GLOBALITEM_TAG_REPORT_SIZE:
3836 field.report_size = hid_unpack_value(data, i, size);
3837 defined |= HID_REPORT_SIZE;
3838 break;
3840 case USBHID_GLOBALITEM_TAG_REPORT_ID:
3841 if (!first_item && !rdesc->uses_report_id)
3842 goto err;
3844 rdesc->uses_report_id = true;
3846 field.report_id = hid_unpack_value(data, i, size);
3847 defined |= HID_REPORT_ID;
3848 break;
3850 case USBHID_GLOBALITEM_TAG_REPORT_COUNT:
3851 field.report_count = hid_unpack_value(data, i, size);
3852 defined |= HID_REPORT_COUNT;
3853 break;
3855 case USBHID_GLOBALITEM_TAG_PUSH:
3856 case USBHID_GLOBALITEM_TAG_POP:
3857 /* TODO */
3858 goto err;
3860 default:
3861 break;
3863 break;
3865 case USBHID_ITEMTYPE_LOCAL:
3866 switch (tag)
3868 case USBHID_LOCALITEM_TAG_USAGE:
3869 usage = hid_unpack_value(data, i, size);
3871 /* Extended usage (size 4) combines both usage page and id */
3872 if (size != 4) {
3873 if (!(defined & HID_USAGE_PAGE))
3874 goto err;
3875 usage |= usage_page << 16;
3878 wmem_array_append_one(field.usages, usage);
3879 break;
3881 case USBHID_LOCALITEM_TAG_USAGE_MIN:
3882 usage_min = hid_unpack_value(data, i, size);
3883 if (size == 4) {
3884 /* Usage max must be extended as well */
3885 defined |= HID_EXTENDED_USAGE;
3886 } else {
3887 if (!(defined & HID_USAGE_PAGE))
3888 goto err;
3889 usage_min |= usage_page << 16;
3891 defined |= HID_USAGE_MIN;
3892 break;
3894 case USBHID_LOCALITEM_TAG_USAGE_MAX:
3895 if (!(defined & HID_USAGE_MIN))
3896 goto err;
3898 usage_max = hid_unpack_value(data, i, size);
3899 if (defined & HID_EXTENDED_USAGE) {
3900 /* Fail if max is not extended usage (HID spec 6.2.2.8) */
3901 if (size != 4)
3902 goto err;
3903 } else if (size == 4) {
3904 /* Fail because min wasn't extended, but max is */
3905 goto err;
3906 } else {
3907 if (!(defined & HID_USAGE_PAGE))
3908 goto err;
3909 usage_max |= usage_page << 16;
3912 /* Usage min and max must be on the same page */
3913 if (USAGE_PAGE(usage_min) != USAGE_PAGE(usage_max)) {
3914 goto err;
3917 if (usage_min > usage_max) {
3918 goto err;
3921 /* min and max are inclusive */
3922 wmem_array_grow(field.usages, usage_max - usage_min + 1);
3923 for (uint32_t j = usage_min; j <= usage_max; j++) {
3924 wmem_array_append_one(field.usages, j);
3927 defined &= ~(HID_USAGE_MIN | HID_EXTENDED_USAGE);
3928 break;
3930 default: /* TODO */
3931 goto err;
3933 break;
3935 default: /* reserved */
3936 goto err;
3939 i += size + 1;
3942 return true;
3944 err:
3945 for (unsigned int j = 0; j < wmem_array_get_count(rdesc->fields_in); j++)
3946 wmem_free(scope, ((hid_field_t*) wmem_array_index(rdesc->fields_in, j))->usages);
3948 for (unsigned int j = 0; j < wmem_array_get_count(rdesc->fields_out); j++)
3949 wmem_free(scope, ((hid_field_t*) wmem_array_index(rdesc->fields_out, j))->usages);
3951 wmem_free(scope, rdesc->fields_in);
3952 wmem_free(scope, rdesc->fields_out);
3953 return false;
3957 static bool
3958 is_correct_interface(urb_info_t *urb, report_descriptor_t *report)
3960 return (urb->bus_id == report->bus_id) &&
3961 (urb->device_address == report->device_address) &&
3962 (urb->conv->interfaceNum == report->interface);
3965 /* Returns the report descriptor */
3966 static report_descriptor_t _U_ *
3967 get_report_descriptor(packet_info *pinfo _U_, urb_info_t *urb)
3969 uint32_t bus_id = urb->bus_id;
3970 uint32_t device_address = urb->device_address;
3971 uint32_t interface = urb->conv->interfaceNum;
3972 wmem_tree_key_t key[] = {
3973 {1, &bus_id},
3974 {1, &device_address},
3975 {1, &interface},
3976 {1, &pinfo->num},
3977 {0, NULL}
3980 report_descriptor_t *data = NULL;
3981 data = (report_descriptor_t*) wmem_tree_lookup32_array_le(report_descriptors, key);
3982 if (data && is_correct_interface(urb, data))
3983 return data;
3985 return NULL;
3988 /* Inserts the report descriptor */
3989 static void
3990 insert_report_descriptor(packet_info *pinfo, report_descriptor_t *data)
3992 uint32_t bus_id = data->bus_id;
3993 uint32_t device_address = data->device_address;
3994 uint32_t interface = data->interface;
3995 wmem_tree_key_t key[] = {
3996 {1, &bus_id},
3997 {1, &device_address},
3998 {1, &interface},
3999 {1, &pinfo->num},
4000 {0, NULL}
4003 wmem_tree_insert32_array(report_descriptors, key, data);
4006 /* Returns usage page string */
4007 static const char*
4008 get_usage_page_string(uint32_t usage_page)
4010 const char *str;
4012 str = try_val_to_str(usage_page, usb_hid_item_usage_page_vals);
4013 if (!str) {
4014 if ((usage_page & VENDOR_PAGE_HBYTE) == VENDOR_PAGE_HBYTE)
4015 str = "Vendor";
4016 else
4017 str = "Reserved";
4020 return str;
4023 /* Returns usage page item string */
4024 static char*
4025 get_usage_page_item_string(wmem_allocator_t *pool, uint32_t usage_page, uint32_t id)
4027 const char *str = NULL;
4028 const char *fmt_str = NULL;
4030 switch (usage_page)
4032 case GENERIC_DESKTOP_CONTROLS_PAGE:
4033 str = try_val_to_str(id, usb_hid_generic_desktop_controls_usage_page_vals);
4034 break;
4035 case SIMULATION_CONTROLS_PAGE:
4036 str = try_val_to_str(id, usb_hid_simulation_control_usage_page_vals);
4037 break;
4038 case VR_CONTROLS_PAGE:
4039 str = try_val_to_str(id, usb_hid_vr_controls_usage_page_vals);
4040 break;
4041 case SPORT_CONTROLS_PAGE:
4042 str = try_val_to_str(id, usb_hid_sport_controls_usage_page_vals);
4043 break;
4044 case GAME_CONTROLS_PAGE:
4045 str = try_val_to_str(id, usb_hid_game_controls_usage_page_vals);
4046 break;
4047 case GENERIC_DEVICE_CONTROLS_PAGE:
4048 str = try_val_to_str(id, usb_hid_generic_device_controls_usage_page_vals);
4049 break;
4050 case KEYBOARD_KEYPAD_PAGE:
4051 str = try_val_to_str(id, usb_hid_keyboard_keypad_usage_page_vals);
4052 break;
4053 case LED_PAGE:
4054 str = try_val_to_str(id, usb_hid_led_usage_page_vals);
4055 break;
4056 case BUTTON_PAGE:
4057 str = try_val_to_str(id, usb_hid_button_usage_page_vals);
4058 if (!str)
4059 fmt_str = "Button %u";
4060 break;
4061 case ORDINAL_PAGE:
4062 str = try_val_to_str(id, usb_hid_ordinal_usage_page_vals);
4063 break;
4064 case TELEPHONY_PAGE:
4065 str = try_val_to_str(id, usb_hid_telephony_device_usage_page_vals);
4066 break;
4067 case CONSUMER_PAGE:
4068 str = try_val_to_str(id, usb_hid_consumer_usage_page_vals);
4069 if (!str)
4070 fmt_str = "Instance %u";
4071 break;
4072 case DIGITIZER_PAGE:
4073 str = try_val_to_str(id, usb_hid_digitizers_usage_page_vals);
4074 break;
4075 case HAPTICS_PAGE:
4076 str = try_val_to_str(id, usb_hid_haptic_usage_page_vals);
4077 if (id >= 0x2001 && id <= 0x2FFF)
4078 str = "Vendor Waveforms";
4079 break;
4080 case PID_PAGE:
4081 str = try_val_to_str(id, usb_hid_physical_input_device_usage_page_vals);
4082 break;
4083 case UNICODE_PAGE:
4084 fmt_str = "Character U+%04X";
4085 break;
4086 case SOC_PAGE:
4087 str = try_val_to_str(id, usb_hid_soc_usage_page_vals);
4088 break;
4089 case EYE_AND_HEAD_TRACKER_PAGE:
4090 str = try_val_to_str(id, usb_hid_eye_and_head_tracker_usage_page_vals);
4091 break;
4092 case ALPHANUMERIC_DISPLAY_PAGE:
4093 str = try_val_to_str(id, usb_hid_alphanumeric_display_usage_page_vals);
4094 break;
4095 case SENSOR_PAGE:
4096 str = try_val_to_str(id, usb_hid_sensor_usage_page_vals);
4097 if (!str)
4098 str = try_rval_to_str(id, usb_hid_sensor_usage_page_ranges);
4099 break;
4100 case MEDICAL_INSTRUMENTS_PAGE:
4101 str = try_val_to_str(id, usb_hid_medical_instrument_usage_page_vals);
4102 break;
4103 case BRAILLE_DISPLAY_PAGE:
4104 str = try_val_to_str(id, usb_hid_braille_display_usage_page_vals);
4105 break;
4106 case LIGHTING_AND_ILLUMINATION_PAGE:
4107 str = try_val_to_str(id, usb_hid_lighting_and_illumination_usage_page_vals);
4108 break;
4109 case USB_MONITOR_PAGE:
4110 str = try_val_to_str(id, usb_hid_monitor_usage_page_vals);
4111 break;
4112 case USB_ENUMERATED_VALUES_PAGE:
4113 fmt_str = "ENUM_%u";
4114 break;
4115 case VESA_VIRTUAL_CONTROLS_PAGE:
4116 str = try_val_to_str(id, usb_hid_vesa_virtual_control_usage_page_vals);
4117 break;
4118 case POWER_DEVICE_PAGE:
4119 str = try_val_to_str(id, usb_hid_power_device_usage_page_vals);
4120 break;
4121 case BATTERY_SYSTEM_PAGE:
4122 str = try_val_to_str(id, usb_hid_battery_system_usage_page_vals);
4123 break;
4124 case BARCODE_SCANNER_PAGE:
4125 str = try_val_to_str(id, usb_hid_barcode_scanner_usage_page_vals);
4126 break;
4127 case WEIGHING_PAGE:
4128 str = try_val_to_str(id, usb_hid_weighing_devices_usage_page_vals);
4129 break;
4130 case MSR_PAGE:
4131 str = try_val_to_str(id, usb_hid_magnetic_stripe_reader_usage_page_vals);
4132 break;
4133 case CAMERA_CONTROL_PAGE:
4134 str = try_val_to_str(id, usb_hid_camera_control_usage_page_vals);
4135 break;
4136 case ARCADE_PAGE:
4137 str = try_val_to_str(id, usb_hid_arcade_usage_page_vals);
4138 break;
4139 case FIDO_ALLIANCE_PAGE:
4140 str = try_val_to_str(id, usb_hid_fido_alliance_usage_page_vals);
4141 break;
4142 default:
4143 if ((usage_page & VENDOR_PAGE_HBYTE) == VENDOR_PAGE_HBYTE)
4144 str = "Vendor";
4145 break;
4148 if (fmt_str) {
4149 return wmem_strdup_printf(pool, fmt_str, id);
4151 if (!str) {
4152 str = "Reserved";
4154 return wmem_strdup_printf(pool, "%s", str);
4157 /* Dissector for the data in a HID main report. */
4158 static int
4159 dissect_usb_hid_report_mainitem_data(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, unsigned int bSize, unsigned int bTag)
4161 proto_item *ti = proto_tree_get_parent(tree);
4162 uint32_t val = 0;
4164 switch (bTag) {
4165 case USBHID_MAINITEM_TAG_INPUT:
4166 case USBHID_MAINITEM_TAG_OUTPUT:
4167 case USBHID_MAINITEM_TAG_FEATURE:
4168 proto_tree_add_item(tree, hf_usb_hid_mainitem_bit0, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
4169 proto_tree_add_item(tree, hf_usb_hid_mainitem_bit1, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
4170 proto_tree_add_item(tree, hf_usb_hid_mainitem_bit2, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
4171 proto_tree_add_item(tree, hf_usb_hid_mainitem_bit3, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
4172 proto_tree_add_item(tree, hf_usb_hid_mainitem_bit4, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
4173 proto_tree_add_item(tree, hf_usb_hid_mainitem_bit5, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
4174 proto_tree_add_item(tree, hf_usb_hid_mainitem_bit6, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
4175 if (bTag == USBHID_MAINITEM_TAG_INPUT)
4176 proto_tree_add_item(tree, hf_usb_hid_mainitem_bit7_input, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
4177 else
4178 proto_tree_add_item(tree, hf_usb_hid_mainitem_bit7, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
4179 if (bSize > 1)
4180 proto_tree_add_item(tree, hf_usb_hid_mainitem_bit8, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
4181 else
4182 proto_tree_add_boolean_format_value(tree, hf_usb_hid_mainitem_bit8, tvb, offset, 0, false, "Buffered bytes (default, no second byte present)");
4184 val = tvb_get_uint8(tvb, offset);
4185 if (val & (1 << 0))
4186 proto_item_append_text(ti, " (Const,");
4187 else
4188 proto_item_append_text(ti, " (Data,");
4189 if (val & (1 << 1))
4190 proto_item_append_text(ti, "Var,");
4191 else
4192 proto_item_append_text(ti, "Array,");
4193 if (val & (1 << 2))
4194 proto_item_append_text(ti, "Rel");
4195 else
4196 proto_item_append_text(ti, "Abs");
4197 if (val & (1 << 3))
4198 proto_item_append_text(ti, ",Wrap");
4199 if (val & (1 << 4))
4200 proto_item_append_text(ti, ",NonLinear");
4201 if (val & (1 << 5))
4202 proto_item_append_text(ti, ",NoPref");
4203 if (val & (1 << 6))
4204 proto_item_append_text(ti, ",Null");
4205 if ((bTag == USBHID_MAINITEM_TAG_OUTPUT || bTag == USBHID_MAINITEM_TAG_FEATURE) && val & (1 << 7))
4206 proto_item_append_text(ti, ",Volatile");
4207 if (val & (1 << 8))
4208 proto_item_append_text(ti, ",BuffBytes");
4209 proto_item_append_text(ti, ")");
4210 break;
4211 case USBHID_MAINITEM_TAG_COLLECTION:
4212 proto_tree_add_item_ret_uint(tree, hf_usb_hid_mainitem_colltype, tvb, offset, 1, ENC_LITTLE_ENDIAN, &val);
4213 proto_item_append_text(ti, " (%s)", rval_to_str_const(val, usb_hid_mainitem_colltype_vals, "Unknown"));
4214 break;
4215 case USBHID_MAINITEM_TAG_ENDCOLLECTION:
4216 /* No item data */
4217 break;
4218 default:
4219 proto_tree_add_item(tree, hf_usb_hid_item_unk_data, tvb, offset, bSize, ENC_NA);
4220 proto_item_append_text(ti, " (Unknown)");
4221 break;
4223 offset += bSize;
4224 return offset;
4227 /* Dissector for the data in a HID main report. */
4228 static int
4229 dissect_usb_hid_report_globalitem_data(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, unsigned int bSize, unsigned int bTag, struct usb_hid_global_state *global)
4231 const char *str = NULL;
4232 proto_item *ti = proto_tree_get_parent(tree);
4233 uint32_t val = 0;
4234 int32_t val_sig = 0;
4236 switch (bTag) {
4237 case USBHID_GLOBALITEM_TAG_USAGE_PAGE:
4238 switch (bSize) {
4239 case 1: global->usage_page = tvb_get_uint8(tvb, offset); break;
4240 case 2: global->usage_page = tvb_get_letohs(tvb, offset); break;
4241 case 3: global->usage_page = tvb_get_letoh24(tvb, offset); break;
4242 case 4: global->usage_page = tvb_get_letohl(tvb, offset); break;
4243 default: global->usage_page = 0; break;
4245 str = get_usage_page_string(global->usage_page);
4246 proto_tree_add_uint_format(tree, hf_usb_hid_globalitem_usage, tvb, offset, bSize, global->usage_page, "Usage Page: %s (0x%02x)", str, global->usage_page);
4247 proto_item_append_text(ti, " (%s)", str);
4248 break;
4249 case USBHID_GLOBALITEM_TAG_LOG_MIN:
4250 proto_tree_add_item_ret_int(tree, hf_usb_hid_globalitem_log_min, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val_sig);
4251 proto_item_append_text(ti, " (%d)", val_sig);
4252 break;
4253 case USBHID_GLOBALITEM_TAG_LOG_MAX:
4254 proto_tree_add_item_ret_int(tree, hf_usb_hid_globalitem_log_max, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val_sig);
4255 proto_item_append_text(ti, " (%d)", val_sig);
4256 break;
4257 case USBHID_GLOBALITEM_TAG_PHY_MIN:
4258 proto_tree_add_item_ret_int(tree, hf_usb_hid_globalitem_phy_min, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val_sig);
4259 proto_item_append_text(ti, " (%d)", val_sig);
4260 break;
4261 case USBHID_GLOBALITEM_TAG_PHY_MAX:
4262 proto_tree_add_item_ret_int(tree, hf_usb_hid_globalitem_phy_max, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val_sig);
4263 proto_item_append_text(ti, " (%d)", val_sig);
4264 break;
4265 case USBHID_GLOBALITEM_TAG_UNIT_EXP:
4266 proto_tree_add_item_ret_uint(tree, hf_usb_hid_globalitem_unit_exp, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val);
4267 if (val >= 7)
4268 proto_item_append_text(ti, " (%u)", val);
4269 else
4270 proto_item_append_text(ti, " (%d)", -(16 - (int) val));
4271 break;
4272 case USBHID_GLOBALITEM_TAG_UNIT:
4273 proto_tree_add_item(tree, hf_usb_hid_globalitem_unit_sys, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
4274 proto_tree_add_item(tree, hf_usb_hid_globalitem_unit_len, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
4275 proto_tree_add_item(tree, hf_usb_hid_globalitem_unit_mass, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
4276 proto_tree_add_item(tree, hf_usb_hid_globalitem_unit_time, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
4277 proto_tree_add_item(tree, hf_usb_hid_globalitem_unit_temp, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
4278 proto_tree_add_item(tree, hf_usb_hid_globalitem_unit_current, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
4279 proto_tree_add_item(tree, hf_usb_hid_globalitem_unit_brightness, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
4280 proto_item_append_text(ti, " (0x%02x)", tvb_get_uint8(tvb, offset));
4281 break;
4282 case USBHID_GLOBALITEM_TAG_REPORT_SIZE:
4283 proto_tree_add_item_ret_uint(tree, hf_usb_hid_globalitem_report_size, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val);
4284 proto_item_append_text(ti, " (%u)", val);
4285 break;
4286 case USBHID_GLOBALITEM_TAG_REPORT_ID:
4287 proto_tree_add_item_ret_uint(tree, hf_usb_hid_globalitem_report_id, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val);
4288 proto_item_append_text(ti, " (0x%02x)", val);
4289 break;
4290 case USBHID_GLOBALITEM_TAG_REPORT_COUNT:
4291 proto_tree_add_item_ret_uint(tree, hf_usb_hid_globalitem_report_count, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val);
4292 proto_item_append_text(ti, " (%u)", val);
4293 break;
4294 case USBHID_GLOBALITEM_TAG_PUSH:
4295 // Push and Pop have no data, but the HID spec 6.2.2.7 doesn't prohibit it.
4296 if(bSize > 0) {
4297 proto_tree_add_item_ret_uint(tree, hf_usb_hid_globalitem_push, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val);
4298 proto_item_append_text(ti, " (%u)", val);
4300 break;
4301 case USBHID_GLOBALITEM_TAG_POP:
4302 // Push and Pop have no data, but the HID spec 6.2.2.7 doesn't prohibit it.
4303 if(bSize > 0) {
4304 proto_tree_add_item_ret_uint(tree, hf_usb_hid_globalitem_pop, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val);
4305 proto_item_append_text(ti, " (%u)", val);
4307 break;
4308 default:
4309 proto_tree_add_item(tree, hf_usb_hid_item_unk_data, tvb, offset, bSize, ENC_NA);
4310 proto_item_append_text(ti, " (Unknown)");
4311 break;
4313 offset += bSize;
4314 return offset;
4317 /* Dissector for the data in a HID main report. */
4318 static int
4319 dissect_usb_hid_report_localitem_data(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, unsigned int bSize, unsigned int bTag, struct usb_hid_global_state *global)
4321 uint32_t id = 0xffff;
4322 proto_item *ti = proto_tree_get_parent(tree);
4323 char *str = NULL;
4324 uint32_t val = 0;
4326 switch (bTag) {
4327 case USBHID_LOCALITEM_TAG_USAGE:
4328 if (bSize > 2) {
4329 /* Full page ID */
4330 proto_tree_add_item(tree, hf_usb_hid_localitem_usage, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
4331 } else {
4332 /* Only lower few bits given, need to combine with last global ID */
4333 if (bSize == 1)
4334 id = tvb_get_uint8(tvb, offset);
4335 else if (bSize == 2)
4336 id = tvb_get_ntohs(tvb, offset);
4337 str = get_usage_page_item_string(pinfo->pool, global->usage_page, id);
4338 proto_tree_add_uint_format(tree, hf_usb_hid_localitem_usage, tvb, offset, bSize, id, "Usage: %s (0x%02x)", str, id);
4339 proto_item_append_text(ti, " (%s)", str);
4341 break;
4342 case USBHID_LOCALITEM_TAG_USAGE_MIN:
4343 proto_tree_add_item_ret_uint(tree, hf_usb_hid_localitem_usage_min, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val);
4344 proto_item_append_text(ti, " (0x%02x)", val);
4345 break;
4346 case USBHID_LOCALITEM_TAG_USAGE_MAX:
4347 proto_tree_add_item_ret_uint(tree, hf_usb_hid_localitem_usage_max, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val);
4348 proto_item_append_text(ti, " (0x%02x)", val);
4349 break;
4350 case USBHID_LOCALITEM_TAG_DESIG_INDEX:
4351 proto_tree_add_item_ret_uint(tree, hf_usb_hid_localitem_desig_index, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val);
4352 proto_item_append_text(ti, " (0x%02x)", val);
4353 break;
4354 case USBHID_LOCALITEM_TAG_DESIG_MIN:
4355 proto_tree_add_item_ret_uint(tree, hf_usb_hid_localitem_desig_min, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val);
4356 proto_item_append_text(ti, " (0x%02x)", val);
4357 break;
4358 case USBHID_LOCALITEM_TAG_DESIG_MAX:
4359 proto_tree_add_item_ret_uint(tree, hf_usb_hid_localitem_desig_max, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val);
4360 proto_item_append_text(ti, " (0x%02x)", val);
4361 break;
4362 case USBHID_LOCALITEM_TAG_STRING_INDEX:
4363 proto_tree_add_item_ret_uint(tree, hf_usb_hid_localitem_string_index, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val);
4364 proto_item_append_text(ti, " (0x%02x)", val);
4365 break;
4366 case USBHID_LOCALITEM_TAG_STRING_MIN:
4367 proto_tree_add_item_ret_uint(tree, hf_usb_hid_localitem_string_min, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val);
4368 proto_item_append_text(ti, " (0x%02x)", val);
4369 break;
4370 case USBHID_LOCALITEM_TAG_STRING_MAX:
4371 proto_tree_add_item_ret_uint(tree, hf_usb_hid_localitem_string_max, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val);
4372 proto_item_append_text(ti, " (0x%02x)", val);
4373 break;
4374 case USBHID_LOCALITEM_TAG_DELIMITER:
4375 proto_tree_add_item_ret_uint(tree, hf_usb_hid_localitem_delimiter, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val);
4376 proto_item_append_text(ti, " (0x%02x)", val);
4377 break;
4378 default:
4379 proto_tree_add_item(tree, hf_usb_hid_item_unk_data, tvb, offset, bSize, ENC_NA);
4380 proto_item_append_text(ti, " (Unknown)");
4381 break;
4383 offset += bSize;
4385 return offset;
4388 /* Dissector for individual HID report items. Recursive. */
4389 static int
4390 // NOLINTNEXTLINE(misc-no-recursion)
4391 dissect_usb_hid_report_item(packet_info *pinfo _U_, proto_tree *parent_tree, tvbuff_t *tvb, int offset, urb_info_t *urb, const struct usb_hid_global_state *global)
4393 proto_item *subitem;
4394 proto_tree *tree, *subtree;
4395 int old_offset;
4396 unsigned int tmp;
4397 unsigned int bSize, bType, bTag;
4398 const value_string *usb_hid_cur_bTag_vals;
4399 int hf_usb_hid_curitem_bTag;
4400 struct usb_hid_global_state cur_global;
4401 memcpy(&cur_global, global, sizeof(struct usb_hid_global_state));
4403 while (tvb_reported_length_remaining(tvb, offset) > 0)
4405 old_offset=offset;
4407 tmp = tvb_get_uint8(tvb, offset);
4408 bSize = tmp & USBHID_SIZE_MASK;
4409 if (bSize == 3) bSize++; /* 3 == four bytes */
4410 bType = (tmp & USBHID_TYPE_MASK) >> 2;
4411 bTag = (tmp & USBHID_TAG_MASK) >> 4;
4413 switch (bType) {
4414 case USBHID_ITEMTYPE_MAIN:
4415 hf_usb_hid_curitem_bTag = hf_usb_hid_mainitem_bTag;
4416 usb_hid_cur_bTag_vals = usb_hid_mainitem_bTag_vals;
4417 break;
4418 case USBHID_ITEMTYPE_GLOBAL:
4419 hf_usb_hid_curitem_bTag = hf_usb_hid_globalitem_bTag;
4420 usb_hid_cur_bTag_vals = usb_hid_globalitem_bTag_vals;
4421 break;
4422 case USBHID_ITEMTYPE_LOCAL:
4423 hf_usb_hid_curitem_bTag = hf_usb_hid_localitem_bTag;
4424 usb_hid_cur_bTag_vals = usb_hid_localitem_bTag_vals;
4425 break;
4426 default: /* Only USBHID_ITEMTYPE_LONG, but keep compiler happy */
4427 hf_usb_hid_curitem_bTag = hf_usb_hid_longitem_bTag;
4428 usb_hid_cur_bTag_vals = usb_hid_longitem_bTag_vals;
4429 break;
4432 subtree = proto_tree_add_subtree_format(parent_tree, tvb, offset, bSize + 1, ett_usb_hid_item_header, &subitem, "%s", val_to_str(bTag, usb_hid_cur_bTag_vals, "Unknown/%u tag"));
4434 tree = proto_tree_add_subtree(subtree, tvb, offset, 1, ett_usb_hid_item_header, NULL, "Header");
4435 proto_tree_add_item(tree, hf_usb_hid_item_bSize, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4436 proto_tree_add_item(tree, hf_usb_hid_item_bType, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4437 proto_tree_add_item(tree, hf_usb_hid_curitem_bTag, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4438 offset++;
4439 if ((bType == 3) && (bTag == 16)) {
4440 /* Long item */
4441 bSize = tvb_get_uint8(tvb, offset);
4442 proto_tree_add_item(subtree, hf_usb_hid_item_bDataSize, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4443 offset++;
4444 proto_tree_add_item(subtree, hf_usb_hid_item_bLongItemTag, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4445 offset++;
4446 proto_tree_add_item(subtree, hf_usb_hid_item_unk_data, tvb, offset, bSize, ENC_NA);
4447 offset += bSize;
4448 } else {
4449 /* Short item */
4450 switch (bType) {
4451 case USBHID_ITEMTYPE_MAIN:
4452 offset = dissect_usb_hid_report_mainitem_data(pinfo, subtree, tvb, offset, bSize, bTag);
4453 break;
4454 case USBHID_ITEMTYPE_GLOBAL:
4455 offset = dissect_usb_hid_report_globalitem_data(pinfo, subtree, tvb, offset, bSize, bTag, &cur_global);
4456 break;
4457 case USBHID_ITEMTYPE_LOCAL:
4458 offset = dissect_usb_hid_report_localitem_data(pinfo, subtree, tvb, offset, bSize, bTag, &cur_global);
4459 break;
4460 default: /* Only USBHID_ITEMTYPE_LONG, but keep compiler happy */
4461 proto_tree_add_item(subtree, hf_usb_hid_item_unk_data, tvb, offset, bSize, ENC_NA);
4462 offset += bSize;
4463 break;
4467 if (bType == USBHID_ITEMTYPE_MAIN) {
4468 if (bTag == USBHID_MAINITEM_TAG_COLLECTION) {
4469 /* Begin collection, nest following elements under us */
4470 increment_dissection_depth(pinfo);
4471 offset = dissect_usb_hid_report_item(pinfo, subtree, tvb, offset, urb, &cur_global);
4472 decrement_dissection_depth(pinfo);
4473 proto_item_set_len(subitem, offset-old_offset);
4474 } else if (bTag == USBHID_MAINITEM_TAG_ENDCOLLECTION) {
4475 /* End collection, break out to parent tree item */
4476 break;
4480 return offset;
4483 /* Dissector for HID "GET DESCRIPTOR" subtype. */
4485 dissect_usb_hid_get_report_descriptor(packet_info *pinfo _U_, proto_tree *parent_tree, tvbuff_t *tvb, int offset, urb_info_t *urb)
4487 proto_item *item;
4488 proto_tree *tree;
4489 int old_offset=offset;
4490 struct usb_hid_global_state initial_global;
4492 memset(&initial_global, 0, sizeof(struct usb_hid_global_state));
4494 item = proto_tree_add_protocol_format(parent_tree, proto_usb_hid, tvb, offset,
4495 -1, "HID Report");
4496 tree = proto_item_add_subtree(item, ett_usb_hid_report);
4497 offset = dissect_usb_hid_report_item(pinfo, tree, tvb, offset, urb, &initial_global);
4499 /* only insert report descriptor the first time we parse it */
4500 if (!PINFO_FD_VISITED(pinfo) && urb && urb->conv) {
4501 wmem_allocator_t *scope = wmem_file_scope();
4502 report_descriptor_t *data = wmem_new0(scope, report_descriptor_t);
4504 data->bus_id = urb->bus_id;
4505 data->device_address = urb->device_address;
4506 data->interface = urb->conv->interfaceNum;
4507 data->desc_length = offset - old_offset;
4508 data->desc_body = (uint8_t*) tvb_memdup(scope, tvb, old_offset, data->desc_length);
4510 if (parse_report_descriptor(data)) {
4511 insert_report_descriptor(pinfo, data);
4512 } else {
4513 wmem_free(scope, data->desc_body);
4514 wmem_free(scope, data);
4518 proto_item_set_len(item, offset-old_offset);
4520 return offset;
4523 /* Dissector for HID GET_REPORT request. See USBHID 1.11, Chapter 7.2.1 Get_Report Request */
4524 static void
4525 dissect_usb_hid_get_report(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, bool is_request, urb_info_t *urb _U_)
4527 proto_item *item;
4528 proto_tree *subtree;
4530 if (!is_request)
4531 return;
4533 item = proto_tree_add_item(tree, hf_usb_hid_value, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4534 subtree = proto_item_add_subtree(item, ett_usb_hid_wValue);
4536 /* Report Type in the high byte, Report ID in the low byte */
4537 proto_tree_add_item(subtree, hf_usb_hid_report_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4538 offset++;
4539 proto_tree_add_item(subtree, hf_usb_hid_report_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4540 offset++;
4542 proto_tree_add_item(tree, hf_usb_hid_index, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4543 offset += 2;
4545 proto_tree_add_item(tree, hf_usb_hid_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4546 /*offset += 2;*/
4549 /* Dissector for HID SET_REPORT request. See USBHID 1.11, Chapter 7.2.2 Set_Report Request */
4550 static void
4551 dissect_usb_hid_set_report(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, bool is_request, urb_info_t *urb _U_)
4553 proto_item *item;
4554 proto_tree *subtree;
4556 if (!is_request)
4557 return;
4559 item = proto_tree_add_item(tree, hf_usb_hid_value, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4560 subtree = proto_item_add_subtree(item, ett_usb_hid_wValue);
4562 proto_tree_add_item(subtree, hf_usb_hid_report_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4563 offset++;
4564 proto_tree_add_item(subtree, hf_usb_hid_report_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4565 offset++;
4567 proto_tree_add_item(tree, hf_usb_hid_index, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4568 offset += 2;
4570 proto_tree_add_item(tree, hf_usb_hid_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4571 /*offset += 2;*/
4575 /* Dissector for HID GET_IDLE request. See USBHID 1.11, Chapter 7.2.3 Get_Idle Request */
4576 static void
4577 dissect_usb_hid_get_idle(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, bool is_request, urb_info_t *urb _U_)
4579 proto_item *item;
4580 proto_tree *subtree;
4582 if (!is_request)
4583 return;
4585 item = proto_tree_add_item(tree, hf_usb_hid_value, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4586 subtree = proto_item_add_subtree(item, ett_usb_hid_wValue);
4588 proto_tree_add_item(subtree, hf_usb_hid_report_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4589 offset++;
4590 proto_tree_add_item(subtree, hf_usb_hid_zero, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4591 offset++;
4593 proto_tree_add_item(tree, hf_usb_hid_index, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4594 offset += 2;
4596 proto_tree_add_item(tree, hf_usb_hid_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4597 /*offset += 2;*/
4600 /* Dissector for HID SET_IDLE request. See USBHID 1.11, Chapter 7.2.4 Set_Idle Request */
4601 static void
4602 dissect_usb_hid_set_idle(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, bool is_request, urb_info_t *urb _U_)
4604 proto_item *item;
4605 proto_tree *subtree;
4607 if (!is_request)
4608 return;
4610 item = proto_tree_add_item(tree, hf_usb_hid_value, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4611 subtree = proto_item_add_subtree(item, ett_usb_hid_wValue);
4613 /* Duration in the high byte, Report ID in the low byte */
4614 proto_tree_add_item(subtree, hf_usb_hid_report_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4615 offset++;
4616 proto_tree_add_item(subtree, hf_usb_hid_duration, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4617 offset++;
4619 proto_tree_add_item(tree, hf_usb_hid_index, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4620 offset += 2;
4622 proto_tree_add_item(tree, hf_usb_hid_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4623 /*offset += 2;*/
4626 /* Dissector for HID GET_PROTOCOL request. See USBHID 1.11, Chapter 7.2.5 Get_Protocol Request */
4627 static void
4628 dissect_usb_hid_get_protocol(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, bool is_request, urb_info_t *urb _U_)
4630 if (!is_request)
4631 return;
4633 proto_tree_add_item(tree, hf_usb_hid_value, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4634 offset += 2;
4636 proto_tree_add_item(tree, hf_usb_hid_index, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4637 offset += 2;
4639 proto_tree_add_item(tree, hf_usb_hid_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4640 /*offset += 2;*/
4643 /* Dissector for HID SET_PROTOCOL request. See USBHID 1.11, Chapter 7.2.6 Set_Protocol Request */
4644 static void
4645 dissect_usb_hid_set_protocol(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, bool is_request, urb_info_t *urb _U_)
4647 if (!is_request)
4648 return;
4650 proto_tree_add_item(tree, hf_usb_hid_value, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4651 offset += 2;
4653 proto_tree_add_item(tree, hf_usb_hid_index, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4654 offset += 2;
4656 proto_tree_add_item(tree, hf_usb_hid_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4657 /*offset += 2;*/
4661 typedef void (*usb_setup_dissector)(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, bool is_request, urb_info_t *urb);
4663 typedef struct _usb_setup_dissector_table_t {
4664 uint8_t request;
4665 usb_setup_dissector dissector;
4666 } usb_setup_dissector_table_t;
4669 /* USBHID 1.11, Chapter 7.2 Class-Specific Requests */
4670 #define USB_HID_SETUP_GET_REPORT 0x01
4671 #define USB_HID_SETUP_GET_IDLE 0x02
4672 #define USB_HID_SETUP_GET_PROTOCOL 0x03
4673 /* 0x04..0x08: Reserved */
4674 #define USB_HID_SETUP_SET_REPORT 0x09
4675 #define USB_HID_SETUP_SET_IDLE 0x0A
4676 #define USB_HID_SETUP_SET_PROTOCOL 0x0B
4678 static const usb_setup_dissector_table_t setup_dissectors[] = {
4679 { USB_HID_SETUP_GET_REPORT, dissect_usb_hid_get_report },
4680 { USB_HID_SETUP_GET_IDLE, dissect_usb_hid_get_idle },
4681 { USB_HID_SETUP_GET_PROTOCOL, dissect_usb_hid_get_protocol },
4682 { USB_HID_SETUP_SET_REPORT, dissect_usb_hid_set_report },
4683 { USB_HID_SETUP_SET_IDLE, dissect_usb_hid_set_idle },
4684 { USB_HID_SETUP_SET_PROTOCOL, dissect_usb_hid_set_protocol },
4685 { 0, NULL }
4688 static const value_string setup_request_names_vals[] = {
4689 { USB_HID_SETUP_GET_REPORT, "GET_REPORT" },
4690 { USB_HID_SETUP_GET_IDLE, "GET_IDLE" },
4691 { USB_HID_SETUP_GET_PROTOCOL, "GET_PROTOCOL" },
4692 { USB_HID_SETUP_SET_REPORT, "SET_REPORT" },
4693 { USB_HID_SETUP_SET_IDLE, "SET_IDLE" },
4694 { USB_HID_SETUP_SET_PROTOCOL, "SET_PROTOCOL" },
4695 { 0, NULL }
4698 static const value_string usb_hid_report_type_vals[] = {
4699 { 1, "Input" },
4700 { 2, "Output" },
4701 { 3, "Feature" },
4702 { 0, NULL }
4705 static int
4706 dissect_usb_hid_boot_keyboard_input_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
4708 int offset = 0;
4709 bool shortcut_helper = false;
4710 unsigned modifier;
4711 unsigned keycode;
4713 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_modifier_right_gui, tvb, offset, 1, ENC_BIG_ENDIAN);
4714 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_modifier_right_alt, tvb, offset, 1, ENC_BIG_ENDIAN);
4715 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_modifier_right_shift, tvb, offset, 1, ENC_BIG_ENDIAN);
4716 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_modifier_right_ctrl, tvb, offset, 1, ENC_BIG_ENDIAN);
4717 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_modifier_left_gui, tvb, offset, 1, ENC_BIG_ENDIAN);
4718 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_modifier_left_alt, tvb, offset, 1, ENC_BIG_ENDIAN);
4719 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_modifier_left_shift, tvb, offset, 1, ENC_BIG_ENDIAN);
4720 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_modifier_left_ctrl, tvb, offset, 1, ENC_BIG_ENDIAN);
4721 modifier = tvb_get_uint8(tvb, offset);
4723 col_append_str(pinfo->cinfo, COL_INFO, " - ");
4724 if (modifier & 0x80) {
4725 col_append_str(pinfo->cinfo, COL_INFO, "RIGHT GUI");
4726 shortcut_helper = true;
4728 if (modifier & 0x40) {
4729 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, " + ");
4730 col_append_str(pinfo->cinfo, COL_INFO, "RIGHT ALT");
4731 shortcut_helper = true;
4733 if (modifier & 0x20) {
4734 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, " + ");
4735 col_append_str(pinfo->cinfo, COL_INFO, "RIGHT SHIFT");
4736 shortcut_helper = true;
4738 if (modifier & 0x10) {
4739 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, " + ");
4740 col_append_str(pinfo->cinfo, COL_INFO, "RIGHT CTRL");
4741 shortcut_helper = true;
4743 if (modifier & 0x08) {
4744 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, " + ");
4745 col_append_str(pinfo->cinfo, COL_INFO, "LEFT GUI");
4746 shortcut_helper = true;
4748 if (modifier & 0x04) {
4749 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, " + ");
4750 col_append_str(pinfo->cinfo, COL_INFO, "LEFT ALT");
4751 shortcut_helper = true;
4753 if (modifier & 0x02) {
4754 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, " + ");
4755 col_append_str(pinfo->cinfo, COL_INFO, "LEFT SHIFT");
4756 shortcut_helper = true;
4758 if (modifier & 0x01) {
4759 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, " + ");
4760 col_append_str(pinfo->cinfo, COL_INFO, "LEFT CTRL");
4761 shortcut_helper = true;
4763 offset += 1;
4765 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
4766 offset += 1;
4768 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_keycode_1, tvb, offset, 1, ENC_BIG_ENDIAN);
4769 keycode = tvb_get_uint8(tvb, offset);
4770 offset += 1;
4772 if (keycode) {
4773 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, " + ");
4774 col_append_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(keycode, &keycode_vals_ext, "Unknown"));
4775 shortcut_helper = true;
4778 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_keycode_2, tvb, offset, 1, ENC_BIG_ENDIAN);
4779 keycode = tvb_get_uint8(tvb, offset);
4780 offset += 1;
4782 if (keycode) {
4783 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, " + ");
4784 col_append_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(keycode, &keycode_vals_ext, "Unknown"));
4785 shortcut_helper = true;
4788 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_keycode_3, tvb, offset, 1, ENC_BIG_ENDIAN);
4789 keycode = tvb_get_uint8(tvb, offset);
4790 offset += 1;
4792 if (keycode) {
4793 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, " + ");
4794 col_append_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(keycode, &keycode_vals_ext, "Unknown"));
4795 shortcut_helper = true;
4798 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_keycode_4, tvb, offset, 1, ENC_BIG_ENDIAN);
4799 keycode = tvb_get_uint8(tvb, offset);
4800 offset += 1;
4802 if (keycode) {
4803 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, " + ");
4804 col_append_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(keycode, &keycode_vals_ext, "Unknown"));
4805 shortcut_helper = true;
4808 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_keycode_5, tvb, offset, 1, ENC_BIG_ENDIAN);
4809 keycode = tvb_get_uint8(tvb, offset);
4810 offset += 1;
4812 if (keycode) {
4813 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, " + ");
4814 col_append_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(keycode, &keycode_vals_ext, "Unknown"));
4815 shortcut_helper = true;
4818 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_keycode_6, tvb, offset, 1, ENC_BIG_ENDIAN);
4819 keycode = tvb_get_uint8(tvb, offset);
4820 offset += 1;
4822 if (keycode) {
4823 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, " + ");
4824 col_append_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(keycode, &keycode_vals_ext, "Unknown"));
4825 shortcut_helper = true;
4828 if (shortcut_helper == false) {
4829 col_append_str(pinfo->cinfo, COL_INFO, "<action key up>");
4832 return offset;
4835 static int
4836 dissect_usb_hid_boot_keyboard_output_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
4838 int offset = 0;
4839 bool shortcut_helper = false;
4840 unsigned leds;
4842 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_leds_constants, tvb, offset, 1, ENC_BIG_ENDIAN);
4843 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_leds_kana, tvb, offset, 1, ENC_BIG_ENDIAN);
4844 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_leds_compose, tvb, offset, 1, ENC_BIG_ENDIAN);
4845 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_leds_scroll_lock, tvb, offset, 1, ENC_BIG_ENDIAN);
4846 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_leds_caps_lock, tvb, offset, 1, ENC_BIG_ENDIAN);
4847 proto_tree_add_item(tree, hf_usbhid_boot_report_keyboard_leds_num_lock, tvb, offset, 1, ENC_BIG_ENDIAN);
4848 leds = tvb_get_uint8(tvb, offset);
4850 col_append_str(pinfo->cinfo, COL_INFO, " - LEDs: ");
4851 if (leds & 0x01) {
4852 col_append_str(pinfo->cinfo, COL_INFO, "NumLock");
4853 shortcut_helper = true;
4855 if (leds & 0x02) {
4856 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, ", ");
4857 col_append_str(pinfo->cinfo, COL_INFO, "CapsLock");
4858 shortcut_helper = true;
4860 if (leds & 0x04) {
4861 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, ", ");
4862 col_append_str(pinfo->cinfo, COL_INFO, "ScrollLock");
4863 shortcut_helper = true;
4865 if (leds & 0x08) {
4866 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, ", ");
4867 col_append_str(pinfo->cinfo, COL_INFO, "Compose");
4868 shortcut_helper = true;
4870 if (leds & 0x10) {
4871 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, ", ");
4872 col_append_str(pinfo->cinfo, COL_INFO, "Kana");
4873 shortcut_helper = true;
4875 if (leds & 0x20) {
4876 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, ", ");
4877 col_append_str(pinfo->cinfo, COL_INFO, "Constant1");
4878 shortcut_helper = true;
4880 if (leds & 0x40) {
4881 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, ", ");
4882 col_append_str(pinfo->cinfo, COL_INFO, "Constant2");
4883 shortcut_helper = true;
4885 if (leds & 0x80) {
4886 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, ", ");
4887 col_append_str(pinfo->cinfo, COL_INFO, "Constant3");
4888 /*shortcut_helper = true;*/
4890 if (!leds) {
4891 col_append_str(pinfo->cinfo, COL_INFO, "none");
4894 offset += 1;
4896 return offset;
4899 static int
4900 dissect_usb_hid_boot_mouse_input_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
4902 int offset = 0;
4903 bool shortcut_helper = false;
4904 unsigned buttons;
4906 proto_tree_add_item(tree, hf_usbhid_boot_report_mouse_button_8, tvb, offset, 1, ENC_BIG_ENDIAN);
4907 proto_tree_add_item(tree, hf_usbhid_boot_report_mouse_button_7, tvb, offset, 1, ENC_BIG_ENDIAN);
4908 proto_tree_add_item(tree, hf_usbhid_boot_report_mouse_button_6, tvb, offset, 1, ENC_BIG_ENDIAN);
4909 proto_tree_add_item(tree, hf_usbhid_boot_report_mouse_button_5, tvb, offset, 1, ENC_BIG_ENDIAN);
4910 proto_tree_add_item(tree, hf_usbhid_boot_report_mouse_button_4, tvb, offset, 1, ENC_BIG_ENDIAN);
4911 proto_tree_add_item(tree, hf_usbhid_boot_report_mouse_button_middle, tvb, offset, 1, ENC_BIG_ENDIAN);
4912 proto_tree_add_item(tree, hf_usbhid_boot_report_mouse_button_right, tvb, offset, 1, ENC_BIG_ENDIAN);
4913 proto_tree_add_item(tree, hf_usbhid_boot_report_mouse_button_left, tvb, offset, 1, ENC_BIG_ENDIAN);
4914 buttons = tvb_get_uint8(tvb, offset);
4915 offset += 1;
4917 if (buttons) col_append_str(pinfo->cinfo, COL_INFO, " - ");
4918 if (buttons & 0x01) {
4919 col_append_str(pinfo->cinfo, COL_INFO, "Button LEFT");
4920 shortcut_helper = true;
4922 if (buttons & 0x02) {
4923 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, " + ");
4924 col_append_str(pinfo->cinfo, COL_INFO, "Button RIGHT");
4925 shortcut_helper = true;
4927 if (buttons & 0x04) {
4928 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, " + ");
4929 col_append_str(pinfo->cinfo, COL_INFO, "Button MIDDLE");
4931 if (buttons & 0x08) {
4932 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, " + ");
4933 col_append_str(pinfo->cinfo, COL_INFO, "Button 4");
4934 shortcut_helper = true;
4936 if (buttons & 0x10) {
4937 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, " + ");
4938 col_append_str(pinfo->cinfo, COL_INFO, "Button 5");
4939 shortcut_helper = true;
4941 if (buttons & 0x20) {
4942 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, " + ");
4943 col_append_str(pinfo->cinfo, COL_INFO, "Button 6");
4944 shortcut_helper = true;
4946 if (buttons & 0x40) {
4947 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, " + ");
4948 col_append_str(pinfo->cinfo, COL_INFO, "Button 7");
4949 shortcut_helper = true;
4951 if (buttons & 0x80) {
4952 if (shortcut_helper) col_append_str(pinfo->cinfo, COL_INFO, " + ");
4953 col_append_str(pinfo->cinfo, COL_INFO, "Button 8");
4954 /* Not necessary, this is the last case where it is used
4955 * shortcut_helper = true;
4959 proto_tree_add_item(tree, hf_usbhid_boot_report_mouse_x_displacement, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4960 offset += 1;
4962 proto_tree_add_item(tree, hf_usbhid_boot_report_mouse_y_displacement, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4963 offset += 1;
4965 /* not really in HID Specification */
4966 if (tvb_reported_length_remaining(tvb, offset)) {
4967 proto_tree_add_item(tree, hf_usbhid_boot_report_mouse_horizontal_scroll_wheel, tvb, offset, 1, ENC_BIG_ENDIAN);
4968 offset += 1;
4971 /* not really in HID Specification */
4972 if (tvb_reported_length_remaining(tvb, offset)) {
4973 proto_tree_add_item(tree, hf_usbhid_boot_report_mouse_vertical_scroll_wheel, tvb, offset, 1, ENC_BIG_ENDIAN);
4974 offset += 1;
4977 if (tvb_reported_length_remaining(tvb, offset)) {
4978 proto_tree_add_item(tree, hf_usbhid_data, tvb, offset, -1, ENC_NA);
4979 offset += tvb_captured_length_remaining(tvb, offset);
4982 return offset;
4986 /* dissect a "standard" control message that's sent to an interface */
4987 static int
4988 dissect_usb_hid_control_std_intf(tvbuff_t *tvb, packet_info *pinfo,
4989 proto_tree *tree, urb_info_t *urb)
4991 int offset = 0;
4992 usb_trans_info_t *usb_trans_info;
4993 uint8_t req;
4995 usb_trans_info = urb->usb_trans_info;
4997 /* XXX - can we do some plausibility checks here? */
4999 col_set_str(pinfo->cinfo, COL_PROTOCOL, "USBHID");
5001 /* we can't use urb->is_request since urb
5002 was replaced with the interface conversation */
5003 if (usb_trans_info->request_in == pinfo->num) {
5004 /* the tvb that we see here is the setup packet
5005 without the request type byte */
5007 req = tvb_get_uint8(tvb, offset);
5008 if (req != USB_SETUP_GET_DESCRIPTOR)
5009 return offset;
5010 col_clear(pinfo->cinfo, COL_INFO);
5011 col_append_str(pinfo->cinfo, COL_INFO, "GET DESCRIPTOR Request");
5012 offset += 1;
5014 proto_tree_add_item(tree, hf_usb_hid_bDescriptorIndex, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5015 usb_trans_info->u.get_descriptor.usb_index = tvb_get_uint8(tvb, offset);
5016 offset += 1;
5018 proto_tree_add_item(tree, hf_usb_hid_bDescriptorType, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5019 usb_trans_info->u.get_descriptor.type = tvb_get_uint8(tvb, offset);
5020 col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
5021 val_to_str_ext(usb_trans_info->u.get_descriptor.type,
5022 &hid_descriptor_type_vals_ext, "Unknown type %u"));
5023 offset += 1;
5025 proto_tree_add_item(tree, hf_usb_hid_wInterfaceNumber, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5026 offset += 2;
5028 proto_tree_add_item(tree, hf_usb_hid_wDescriptorLength, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5029 offset += 2;
5031 else {
5032 col_clear(pinfo->cinfo, COL_INFO);
5033 col_append_str(pinfo->cinfo, COL_INFO, "GET DESCRIPTOR Response");
5034 col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
5035 val_to_str_ext(usb_trans_info->u.get_descriptor.type,
5036 &hid_descriptor_type_vals_ext, "Unknown type %u"));
5037 if (usb_trans_info->u.get_descriptor.type == USB_DT_HID_REPORT)
5038 offset = dissect_usb_hid_get_report_descriptor(pinfo, tree, tvb, offset, urb);
5041 return offset;
5044 /* dissect a class-specific control message that's sent to an interface */
5045 static int
5046 dissect_usb_hid_control_class_intf(tvbuff_t *tvb, packet_info *pinfo,
5047 proto_tree *tree, urb_info_t *urb)
5049 usb_trans_info_t *usb_trans_info;
5050 bool is_request;
5051 int offset = 0;
5052 usb_setup_dissector dissector = NULL;
5053 const usb_setup_dissector_table_t *tmp;
5055 usb_trans_info = urb->usb_trans_info;
5057 is_request = (pinfo->srcport==NO_ENDPOINT);
5059 /* Check valid values for bmRequestType. See Chapter 7.2 in USBHID 1.11 */
5060 for (tmp = setup_dissectors; tmp->dissector; tmp++) {
5061 if (tmp->request == usb_trans_info->setup.request) {
5062 dissector = tmp->dissector;
5063 break;
5066 /* No, we could not find any class specific dissector for this request
5067 * return 0 and let USB try any of the standard requests.
5069 if (!dissector)
5070 return 0;
5072 col_set_str(pinfo->cinfo, COL_PROTOCOL, "USBHID");
5074 col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s",
5075 val_to_str(usb_trans_info->setup.request, setup_request_names_vals, "Unknown type %x"),
5076 is_request ? "Request" : "Response");
5078 if (is_request) {
5079 proto_tree_add_item(tree, hf_usb_hid_request, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5080 offset += 1;
5083 dissector(pinfo, tree, tvb, offset, is_request, urb);
5084 return tvb_captured_length(tvb);
5087 /* unpack a HID logical report field */
5088 static int hid_unpack_logical(tvbuff_t *tvb, int bit_offset, uint32_t size, int32_t min, int32_t *val)
5090 if (size > 32)
5091 return -1;
5093 *val = tvb_get_bits32(tvb, bit_offset, size, ENC_LITTLE_ENDIAN);
5095 if (min < 0)
5096 *val = ws_sign_ext32(*val, size);
5098 return 0;
5101 static int
5102 dissect_usb_hid_int_dynamic_value_variable(tvbuff_t *tvb, proto_tree *tree, hid_field_t *field,
5103 int bit_offset, int hf)
5105 int32_t val = 0;
5107 if (hid_unpack_logical(tvb, bit_offset, field->report_size, field->logical_min, &val))
5108 return -1;
5110 proto_tree_add_int_bits_format_value(tree, hf, tvb, bit_offset, field->report_size, val, ENC_LITTLE_ENDIAN, "%d", val);
5111 return 0;
5114 /* dissect the Generic Desktop Controls (0x0001) usage page */
5115 static int
5116 dissect_usb_hid_generic_desktop_controls_page(tvbuff_t *tvb, packet_info _U_ *pinfo,
5117 proto_tree *tree, hid_field_t *field, unsigned usage, int bit_offset)
5119 int ret = 0;
5121 DISSECTOR_ASSERT(USAGE_PAGE(usage) == GENERIC_DESKTOP_CONTROLS_PAGE);
5122 usage = USAGE_ID(usage);
5123 switch (usage)
5125 case USBHID_GENERIC_DESKTOP_CONTROLS_X:
5126 ret = dissect_usb_hid_int_dynamic_value_variable(tvb, tree, field, bit_offset, hf_usbhid_axis_x);
5127 break;
5129 case USBHID_GENERIC_DESKTOP_CONTROLS_Y:
5130 ret = dissect_usb_hid_int_dynamic_value_variable(tvb, tree, field, bit_offset, hf_usbhid_axis_y);
5131 break;
5133 case USBHID_GENERIC_DESKTOP_CONTROLS_Z:
5134 ret = dissect_usb_hid_int_dynamic_value_variable(tvb, tree, field, bit_offset, hf_usbhid_axis_z);
5135 break;
5137 case USBHID_GENERIC_DESKTOP_CONTROLS_RX:
5138 ret = dissect_usb_hid_int_dynamic_value_variable(tvb, tree, field, bit_offset, hf_usbhid_axis_rx);
5139 break;
5141 case USBHID_GENERIC_DESKTOP_CONTROLS_RY:
5142 ret = dissect_usb_hid_int_dynamic_value_variable(tvb, tree, field, bit_offset, hf_usbhid_axis_ry);
5143 break;
5145 case USBHID_GENERIC_DESKTOP_CONTROLS_RZ:
5146 ret = dissect_usb_hid_int_dynamic_value_variable(tvb, tree, field, bit_offset, hf_usbhid_axis_rz);
5147 break;
5149 case USBHID_GENERIC_DESKTOP_CONTROLS_SLIDER:
5150 ret = dissect_usb_hid_int_dynamic_value_variable(tvb, tree, field, bit_offset, hf_usbhid_axis_slider);
5151 break;
5153 case USBHID_GENERIC_DESKTOP_CONTROLS_VX:
5154 ret = dissect_usb_hid_int_dynamic_value_variable(tvb, tree, field, bit_offset, hf_usbhid_axis_vx);
5155 break;
5157 case USBHID_GENERIC_DESKTOP_CONTROLS_VY:
5158 ret = dissect_usb_hid_int_dynamic_value_variable(tvb, tree, field, bit_offset, hf_usbhid_axis_vy);
5159 break;
5161 case USBHID_GENERIC_DESKTOP_CONTROLS_VZ:
5162 ret = dissect_usb_hid_int_dynamic_value_variable(tvb, tree, field, bit_offset, hf_usbhid_axis_vz);
5163 break;
5165 case USBHID_GENERIC_DESKTOP_CONTROLS_VBRX:
5166 ret = dissect_usb_hid_int_dynamic_value_variable(tvb, tree, field, bit_offset, hf_usbhid_axis_vbrx);
5167 break;
5169 case USBHID_GENERIC_DESKTOP_CONTROLS_VBRY:
5170 ret = dissect_usb_hid_int_dynamic_value_variable(tvb, tree, field, bit_offset, hf_usbhid_axis_vbry);
5171 break;
5173 case USBHID_GENERIC_DESKTOP_CONTROLS_VBRZ:
5174 ret = dissect_usb_hid_int_dynamic_value_variable(tvb, tree, field, bit_offset, hf_usbhid_axis_vbrz);
5175 break;
5177 case USBHID_GENERIC_DESKTOP_CONTROLS_VNO:
5178 ret = dissect_usb_hid_int_dynamic_value_variable(tvb, tree, field, bit_offset, hf_usbhid_axis_vno);
5179 break;
5181 default:
5182 ret = -1;
5183 break;
5186 return ret;
5189 /* dissect the Keyboard/Keypad (0x0007) usage page */
5190 static int
5191 dissect_usb_hid_keyboard_page(tvbuff_t *tvb, packet_info _U_ *pinfo,
5192 proto_tree *tree, hid_field_t *field, uint32_t usage, int bit_offset)
5194 int32_t val = 0;
5196 /* the data is a boolean state for the usage (eg. KEY_SHIFT = 1, KEY_CONTROL = 0) */
5197 if (hid_unpack_logical(tvb, bit_offset, field->report_size, field->logical_min, &val))
5198 return -1;
5200 DISSECTOR_ASSERT(USAGE_PAGE(usage) == KEYBOARD_KEYPAD_PAGE);
5201 usage = USAGE_ID(usage);
5203 proto_tree_add_boolean_bits_format_value(tree, hf_usbhid_key, tvb, bit_offset, field->report_size, val, ENC_LITTLE_ENDIAN,
5204 "%s (0x%02x): %s", val_to_str_ext_const(usage, &keycode_vals_ext, "Unknown"), usage, val ? "DOWN" : "UP");
5205 return 0;
5208 /* dissect the Button (0x0009) usage page */
5209 static int
5210 dissect_usb_hid_button_page(tvbuff_t *tvb, packet_info _U_ *pinfo,
5211 proto_tree *tree, hid_field_t *field, uint32_t usage, int bit_offset)
5213 int32_t val = 0;
5214 proto_item *ti;
5216 DISSECTOR_ASSERT(USAGE_PAGE(usage) == BUTTON_PAGE);
5217 usage = USAGE_ID(usage);
5219 if (hid_unpack_logical(tvb, bit_offset, field->report_size, field->logical_min, &val))
5220 return -1;
5222 ti = proto_tree_add_boolean_bits_format_value(tree, hf_usbhid_button, tvb, bit_offset, field->report_size, val, ENC_LITTLE_ENDIAN, "%u", usage);
5224 if (usage == 0)
5225 proto_item_append_text(ti, " (No button pressed)");
5226 else if (usage == 1)
5227 proto_item_append_text(ti, " (primary/trigger)");
5228 else if (usage == 2)
5229 proto_item_append_text(ti, " (secondary)");
5230 else if (usage == 3)
5231 proto_item_append_text(ti, " (tertiary)");
5233 proto_item_append_text(ti, ": %s", val ? "DOWN" : "UP");
5234 return 0;
5237 static void
5238 dissect_hid_variable(tvbuff_t* tvb, packet_info _U_* pinfo, proto_tree* tree, hid_field_t* field,
5239 uint32_t usage, int bit_offset)
5241 int ret = 0;
5243 /* vendor data (0xff00 - 0xffff) */
5244 if ((USAGE_PAGE(usage) & 0xff00) == 0xff00) {
5245 proto_tree_add_bits_item(tree, hf_usbhid_vendor_data, tvb, bit_offset, field->report_size, ENC_LITTLE_ENDIAN);
5246 return;
5249 switch (USAGE_PAGE(usage))
5251 case GENERIC_DESKTOP_CONTROLS_PAGE:
5252 ret = dissect_usb_hid_generic_desktop_controls_page(tvb, pinfo, tree, field, usage, bit_offset);
5253 break;
5255 case KEYBOARD_KEYPAD_PAGE:
5256 ret = dissect_usb_hid_keyboard_page(tvb, pinfo, tree, field, usage, bit_offset);
5257 break;
5259 case BUTTON_PAGE:
5260 ret = dissect_usb_hid_button_page(tvb, pinfo, tree, field, usage, bit_offset);
5261 break;
5263 default:
5264 ret = -1;
5265 break;
5268 if (ret) {
5269 uint32_t val = 0;
5270 proto_item *ti =
5271 proto_tree_add_uint_bits_format_value(tree, hf_usb_hid_localitem_usage, tvb, bit_offset, field->report_size,
5272 usage, ENC_LITTLE_ENDIAN, "%s", get_usage_page_item_string(pinfo->pool, USAGE_PAGE(usage), USAGE_ID(usage)));
5273 if (0 == hid_unpack_logical(tvb, bit_offset, field->report_size, field->logical_min, &val))
5274 proto_item_append_text(ti, ": %d", val);
5278 static bool hid_get_usage_from_array(hid_field_t *field, int32_t idx, uint32_t *out)
5280 if ((idx >= field->logical_min) && (idx <= field->logical_max)) {
5281 idx -= field->logical_min;
5282 if ((uint32_t)idx < wmem_array_get_count(field->usages)) {
5283 *out = (*((uint32_t*) wmem_array_index(field->usages, idx)));
5284 return true;
5287 return false;
5290 static int
5291 dissect_hid_field(tvbuff_t *tvb, packet_info _U_ *pinfo, proto_tree *tree, hid_field_t *field, int bit_offset)
5293 int start_offset = bit_offset;
5295 if ((field->properties & HID_MAIN_TYPE) == HID_MAIN_ARRAY) {
5296 proto_item *array_ti;
5297 proto_tree *array_tree;
5299 array_ti = proto_tree_add_bits_item(tree, hf_usbhid_array, tvb, bit_offset,
5300 field->report_size * field->report_count, ENC_LITTLE_ENDIAN);
5301 array_tree = proto_item_add_subtree(array_ti, ett_usb_hid_array);
5303 for(unsigned int j = 0; j < field->report_count; j++) {
5304 uint32_t val = 0;
5305 bool in_range;
5306 if (hid_unpack_logical(tvb, bit_offset, field->report_size, field->logical_min, &val)) {
5307 in_range = false;
5308 } else {
5309 in_range = hid_get_usage_from_array(field, val, &val);
5311 if (in_range) {
5312 proto_tree_add_boolean_bits_format_value(array_tree, hf_usbhid_array_usage, tvb, bit_offset, field->report_size,
5313 val, ENC_LITTLE_ENDIAN, "%s (0x%04x, 0x%04x)", get_usage_page_item_string(pinfo->pool, USAGE_PAGE(val), USAGE_ID(val)),
5314 USAGE_PAGE(val), USAGE_ID(val));
5315 } else {
5316 proto_tree_add_boolean_bits_format_value(array_tree, hf_usbhid_array_usage, tvb, bit_offset, field->report_size,
5317 val, ENC_LITTLE_ENDIAN, "No controls asserted");
5319 bit_offset += field->report_size;
5321 } else {
5322 unsigned int i;
5323 unsigned int count = wmem_array_get_count(field->usages);
5324 if (count > field->report_count) {
5325 count = field->report_count;
5327 for(i = 0; i < count; i++) {
5328 uint32_t usage = *((uint32_t*) wmem_array_index(field->usages, i));
5329 dissect_hid_variable(tvb, pinfo, tree, field, usage, bit_offset);
5330 bit_offset += field->report_size;
5332 if (field->report_count > count) {
5333 int remaining_bits = (field->report_count - count) * field->report_size;
5334 proto_tree_add_bits_item(tree, hf_usbhid_padding, tvb, bit_offset, remaining_bits, ENC_LITTLE_ENDIAN);
5335 bit_offset += remaining_bits;
5339 return bit_offset - start_offset;
5342 /* Dissect USB HID data/reports */
5343 static int
5344 dissect_usb_hid_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5346 unsigned offset = 0, hid_bit_offset;
5347 proto_item *hid_ti;
5348 proto_tree *hid_tree;
5349 wmem_array_t *fields;
5350 urb_info_t *usb_data = (urb_info_t*) data;
5351 report_descriptor_t *rdesc = get_report_descriptor(pinfo, usb_data);
5352 unsigned remaining = tvb_reported_length_remaining(tvb, offset);
5354 if (remaining) {
5355 hid_ti = proto_tree_add_item(tree, hf_usbhid_data, tvb, offset, -1, ENC_NA);
5356 hid_tree = proto_item_add_subtree(hid_ti, ett_usb_hid_data);
5357 hid_bit_offset = offset * 8;
5358 offset += remaining;
5359 uint8_t report_id = tvb_get_bits8(tvb, hid_bit_offset, 8);
5361 if (rdesc) {
5362 if (rdesc->uses_report_id) {
5363 proto_tree_add_item(hid_tree, hf_usbhid_report_id, tvb, hid_bit_offset / 8, 1, ENC_NA);
5364 hid_bit_offset += 8;
5367 if (usb_data->direction == P2P_DIR_RECV)
5368 fields = rdesc->fields_in;
5369 else
5370 fields = rdesc->fields_out;
5372 for(unsigned int i = 0; i < wmem_array_get_count(fields); i++) {
5373 hid_field_t *field = (hid_field_t*) wmem_array_index(fields, i);
5374 unsigned int data_size = field->report_size * field->report_count;
5376 /* skip items with invalid report IDs */
5377 if (rdesc->uses_report_id && field->report_id != report_id)
5378 continue;
5380 /* if the item has no usages, it is padding - HID spec 6.2.2.9 */
5381 if (wmem_array_get_count(field->usages) == 0) {
5382 proto_tree_add_bits_item(hid_tree, hf_usbhid_padding, tvb, hid_bit_offset, data_size, ENC_LITTLE_ENDIAN);
5383 hid_bit_offset += data_size;
5384 continue;
5387 hid_bit_offset += dissect_hid_field(tvb, pinfo, hid_tree, field, hid_bit_offset);
5392 return offset;
5395 /* Dissector for HID class-specific control request as defined in
5396 * USBHID 1.11, Chapter 7.2.
5397 * returns the number of bytes consumed */
5398 static int
5399 dissect_usb_hid_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5401 urb_info_t *urb;
5402 usb_trans_info_t *usb_trans_info;
5403 uint8_t type, recip;
5405 urb = (urb_info_t *)data;
5406 if (!urb)
5407 return 0;
5408 usb_trans_info = urb->usb_trans_info;
5409 if (!usb_trans_info)
5410 return 0;
5412 type = USB_TYPE(usb_trans_info->setup.requesttype);
5413 recip = USB_RECIPIENT(usb_trans_info->setup.requesttype);
5415 if (recip == RQT_SETUP_RECIPIENT_INTERFACE) {
5416 if (type == RQT_SETUP_TYPE_STANDARD)
5417 return dissect_usb_hid_control_std_intf(tvb, pinfo, tree, urb);
5418 else if (type == RQT_SETUP_TYPE_CLASS)
5419 return dissect_usb_hid_control_class_intf(tvb, pinfo, tree, urb);
5422 return dissect_usb_hid_data(tvb, pinfo, tree, data);
5425 /* dissect a descriptor that is specific to the HID class */
5426 static int
5427 dissect_usb_hid_class_descriptors(tvbuff_t *tvb, packet_info *pinfo _U_,
5428 proto_tree *tree, void *data _U_)
5430 uint8_t type;
5431 int offset = 0;
5432 proto_item *ti;
5433 proto_tree *desc_tree;
5434 uint8_t num_desc;
5435 unsigned i;
5437 type = tvb_get_uint8(tvb, 1);
5439 /* for now, we only handle the HID descriptor here */
5440 if (type != USB_DT_HID)
5441 return 0;
5443 desc_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_usb_hid_descriptor, &ti, "HID DESCRIPTOR");
5445 dissect_usb_descriptor_header(desc_tree, tvb, offset, &hid_descriptor_type_vals_ext);
5446 offset += 2;
5447 proto_tree_add_item(desc_tree, hf_usb_hid_bcdHID, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5448 offset += 2;
5449 proto_tree_add_item(desc_tree, hf_usb_hid_bCountryCode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5450 offset++;
5451 num_desc = tvb_get_uint8(tvb, offset);
5452 proto_tree_add_item(desc_tree, hf_usb_hid_bNumDescriptors, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5453 offset++;
5454 for (i=0;i<num_desc;i++) {
5455 proto_tree_add_item(desc_tree, hf_usb_hid_bDescriptorType, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5456 offset++;
5457 proto_tree_add_item(desc_tree, hf_usb_hid_wDescriptorLength, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5458 offset += 2;
5461 proto_item_set_len(ti, offset);
5462 return offset;
5466 void
5467 proto_register_usb_hid(void)
5469 static hf_register_info hf[] = {
5470 { &hf_usb_hid_item_bSize,
5471 { "bSize", "usbhid.item.bSize", FT_UINT8, BASE_DEC,
5472 VALS(usb_hid_item_bSize_vals), USBHID_SIZE_MASK, NULL, HFILL }},
5474 { &hf_usb_hid_item_bType,
5475 { "bType", "usbhid.item.bType", FT_UINT8, BASE_DEC,
5476 VALS(usb_hid_item_bType_vals), USBHID_TYPE_MASK, NULL, HFILL }},
5478 { &hf_usb_hid_mainitem_bTag,
5479 { "bTag", "usbhid.item.bTag", FT_UINT8, BASE_HEX,
5480 VALS(usb_hid_mainitem_bTag_vals), USBHID_TAG_MASK, NULL, HFILL }},
5482 { &hf_usb_hid_globalitem_bTag,
5483 { "bTag", "usbhid.item.bTag", FT_UINT8, BASE_HEX,
5484 VALS(usb_hid_globalitem_bTag_vals), USBHID_TAG_MASK, NULL, HFILL }},
5486 { &hf_usb_hid_localitem_bTag,
5487 { "bTag", "usbhid.item.bTag", FT_UINT8, BASE_HEX,
5488 VALS(usb_hid_localitem_bTag_vals), USBHID_TAG_MASK, NULL, HFILL }},
5490 { &hf_usb_hid_longitem_bTag,
5491 { "bTag", "usbhid.item.bTag", FT_UINT8, BASE_HEX,
5492 VALS(usb_hid_longitem_bTag_vals), USBHID_TAG_MASK, NULL, HFILL }},
5494 { &hf_usb_hid_item_bDataSize,
5495 { "bDataSize", "usbhid.item.bDataSize", FT_UINT8, BASE_DEC,
5496 NULL, 0, NULL, HFILL }},
5498 { &hf_usb_hid_item_bLongItemTag,
5499 { "bTag", "usbhid.item.bLongItemTag", FT_UINT8, BASE_HEX,
5500 NULL, 0, NULL, HFILL }},
5502 /* Main-report item data */
5504 { &hf_usb_hid_mainitem_bit0,
5505 { "Data/constant", "usbhid.item.main.readonly", FT_BOOLEAN, 9,
5506 TFS(&tfs_mainitem_bit0), 1<<0, NULL, HFILL }},
5508 { &hf_usb_hid_mainitem_bit1,
5509 { "Data type", "usbhid.item.main.variable", FT_BOOLEAN, 9,
5510 TFS(&tfs_mainitem_bit1), 1<<1, NULL, HFILL }},
5512 { &hf_usb_hid_mainitem_bit2,
5513 { "Coordinates", "usbhid.item.main.relative", FT_BOOLEAN, 9,
5514 TFS(&tfs_mainitem_bit2), 1<<2, NULL, HFILL }},
5516 { &hf_usb_hid_mainitem_bit3,
5517 { "Min/max wraparound", "usbhid.item.main.wrap", FT_BOOLEAN, 9,
5518 TFS(&tfs_mainitem_bit3), 1<<3, NULL, HFILL }},
5520 { &hf_usb_hid_mainitem_bit4,
5521 { "Physical relationship to data", "usbhid.item.main.nonlinear", FT_BOOLEAN, 9,
5522 TFS(&tfs_mainitem_bit4), 1<<4, NULL, HFILL }},
5524 { &hf_usb_hid_mainitem_bit5,
5525 { "Preferred state", "usbhid.item.main.no_preferred_state", FT_BOOLEAN, 9,
5526 TFS(&tfs_mainitem_bit5), 1<<5, NULL, HFILL }},
5528 { &hf_usb_hid_mainitem_bit6,
5529 { "Has null position", "usbhid.item.main.nullstate", FT_BOOLEAN, 9,
5530 TFS(&tfs_mainitem_bit6), 1<<6, NULL, HFILL }},
5532 { &hf_usb_hid_mainitem_bit7,
5533 { "(Non)-volatile", "usbhid.item.main.volatile", FT_BOOLEAN, 9,
5534 TFS(&tfs_mainitem_bit7), 1<<7, NULL, HFILL }},
5536 { &hf_usb_hid_mainitem_bit7_input,
5537 { "[Reserved]", "usbhid.item.main.reserved", FT_BOOLEAN, 9,
5538 NULL, 1<<7, NULL, HFILL }},
5540 { &hf_usb_hid_mainitem_bit8,
5541 { "Bits or bytes", "usbhid.item.main.buffered_bytes", FT_BOOLEAN, 9,
5542 TFS(&tfs_mainitem_bit8), 1<<8, NULL, HFILL }},
5544 { &hf_usb_hid_mainitem_colltype,
5545 { "Collection type", "usbhid.item.main.colltype", FT_UINT8, BASE_RANGE_STRING|BASE_HEX,
5546 RVALS(usb_hid_mainitem_colltype_vals), 0, NULL, HFILL }},
5548 /* Global-report item data */
5550 { &hf_usb_hid_globalitem_usage,
5551 { "Usage page", "usbhid.item.global.usage", FT_UINT8, BASE_RANGE_STRING|BASE_HEX,
5552 NULL, 0, NULL, HFILL }},
5554 { &hf_usb_hid_globalitem_log_min,
5555 { "Logical minimum", "usbhid.item.global.log_min", FT_INT32, BASE_DEC,
5556 NULL, 0, NULL, HFILL }},
5558 { &hf_usb_hid_globalitem_log_max,
5559 { "Logical maximum", "usbhid.item.global.log_max", FT_INT32, BASE_DEC,
5560 NULL, 0, NULL, HFILL }},
5562 { &hf_usb_hid_globalitem_phy_min,
5563 { "Physical minimum", "usbhid.item.global.phy_min", FT_INT32, BASE_DEC,
5564 NULL, 0, NULL, HFILL }},
5566 { &hf_usb_hid_globalitem_phy_max,
5567 { "Physical maximum", "usbhid.item.global.phy_max", FT_INT32, BASE_DEC,
5568 NULL, 0, NULL, HFILL }},
5570 { &hf_usb_hid_globalitem_unit_exp,
5571 { "Unit exponent", "usbhid.item.global.unit_exp", FT_UINT8, BASE_DEC,
5572 NULL, 0, NULL, HFILL }},
5574 { &hf_usb_hid_globalitem_unit_sys,
5575 { "System", "usbhid.item.global.unit.system", FT_UINT32, BASE_HEX,
5576 VALS(usb_hid_globalitem_unit_exp_vals), 0x0000000F, NULL, HFILL }},
5578 { &hf_usb_hid_globalitem_unit_len,
5579 { "Length", "usbhid.item.global.unit.length", FT_UINT32, BASE_HEX,
5580 VALS(usb_hid_globalitem_unit_exp_vals), 0x000000F0, NULL, HFILL }},
5582 { &hf_usb_hid_globalitem_unit_mass,
5583 { "Mass", "usbhid.item.global.unit.mass", FT_UINT32, BASE_HEX,
5584 VALS(usb_hid_globalitem_unit_exp_vals), 0x00000F00, NULL, HFILL }},
5586 { &hf_usb_hid_globalitem_unit_time,
5587 { "Time", "usbhid.item.global.unit.time", FT_UINT32, BASE_HEX,
5588 VALS(usb_hid_globalitem_unit_exp_vals), 0x0000F000, NULL, HFILL }},
5590 { &hf_usb_hid_globalitem_unit_temp,
5591 { "Temperature", "usbhid.item.global.unit.temperature", FT_UINT32, BASE_HEX,
5592 VALS(usb_hid_globalitem_unit_exp_vals), 0x000F0000, NULL, HFILL }},
5594 { &hf_usb_hid_globalitem_unit_current,
5595 { "Current", "usbhid.item.global.unit.current", FT_UINT32, BASE_HEX,
5596 VALS(usb_hid_globalitem_unit_exp_vals), 0x00F00000, NULL, HFILL }},
5598 { &hf_usb_hid_globalitem_unit_brightness,
5599 { "Luminous intensity", "usbhid.item.global.unit.brightness", FT_UINT32, BASE_HEX,
5600 VALS(usb_hid_globalitem_unit_exp_vals), 0x0F000000, NULL, HFILL }},
5602 { &hf_usb_hid_globalitem_report_size,
5603 { "Report size", "usbhid.item.global.report_size", FT_UINT8, BASE_DEC,
5604 NULL, 0, NULL, HFILL }},
5606 { &hf_usb_hid_globalitem_report_id,
5607 { "Report ID", "usbhid.item.global.report_id", FT_UINT8, BASE_HEX,
5608 NULL, 0, NULL, HFILL }},
5610 { &hf_usb_hid_globalitem_report_count,
5611 { "Report count", "usbhid.item.global.report_count", FT_UINT8, BASE_DEC,
5612 NULL, 0, NULL, HFILL }},
5614 { &hf_usb_hid_globalitem_push,
5615 { "Push", "usbhid.item.global.push", FT_UINT8, BASE_HEX,
5616 NULL, 0, NULL, HFILL }},
5618 { &hf_usb_hid_globalitem_pop,
5619 { "Pop", "usbhid.item.global.pop", FT_UINT8, BASE_HEX,
5620 NULL, 0, NULL, HFILL }},
5622 /* Local-report item data */
5624 { &hf_usb_hid_localitem_usage,
5625 { "Usage", "usbhid.item.local.usage", FT_UINT8, BASE_RANGE_STRING|BASE_HEX,
5626 NULL, 0, NULL, HFILL }},
5628 { &hf_usb_hid_localitem_usage_min,
5629 { "Usage minimum", "usbhid.item.local.usage_min", FT_UINT8, BASE_HEX,
5630 NULL, 0, NULL, HFILL }},
5632 { &hf_usb_hid_localitem_usage_max,
5633 { "Usage maximum", "usbhid.item.local.usage_max", FT_UINT8, BASE_HEX,
5634 NULL, 0, NULL, HFILL }},
5636 { &hf_usb_hid_localitem_desig_index,
5637 { "Designator index", "usbhid.item.local.desig_index", FT_UINT8, BASE_HEX,
5638 NULL, 0, NULL, HFILL }},
5640 { &hf_usb_hid_localitem_desig_min,
5641 { "Designator minimum", "usbhid.item.local.desig_min", FT_UINT8, BASE_HEX,
5642 NULL, 0, NULL, HFILL }},
5644 { &hf_usb_hid_localitem_desig_max,
5645 { "Designator maximum", "usbhid.item.local.desig_max", FT_UINT8, BASE_HEX,
5646 NULL, 0, NULL, HFILL }},
5648 { &hf_usb_hid_localitem_string_index,
5649 { "String index", "usbhid.item.local.string_index", FT_UINT8, BASE_HEX,
5650 NULL, 0, NULL, HFILL }},
5652 { &hf_usb_hid_localitem_string_min,
5653 { "String minimum", "usbhid.item.local.string_min", FT_UINT8, BASE_HEX,
5654 NULL, 0, NULL, HFILL }},
5656 { &hf_usb_hid_localitem_string_max,
5657 { "String maximum", "usbhid.item.local.string_max", FT_UINT8, BASE_HEX,
5658 NULL, 0, NULL, HFILL }},
5660 { &hf_usb_hid_localitem_delimiter,
5661 { "Delimiter", "usbhid.item.local.delimiter", FT_UINT8, BASE_HEX,
5662 NULL, 0, NULL, HFILL }},
5665 { &hf_usb_hid_item_unk_data,
5666 { "Item data", "usbhid.item.data", FT_BYTES, BASE_NONE,
5667 NULL, 0, NULL, HFILL }},
5669 /* USB HID specific requests */
5670 { &hf_usb_hid_request,
5671 { "bRequest", "usbhid.setup.bRequest", FT_UINT8, BASE_HEX,
5672 VALS(setup_request_names_vals), 0x0, NULL, HFILL }},
5674 { &hf_usb_hid_value,
5675 { "wValue", "usbhid.setup.wValue", FT_UINT16, BASE_HEX,
5676 NULL, 0x0, NULL, HFILL }},
5678 { &hf_usb_hid_index,
5679 { "wIndex", "usbhid.setup.wIndex", FT_UINT16, BASE_DEC,
5680 NULL, 0x0, NULL, HFILL }},
5682 { &hf_usb_hid_length,
5683 { "wLength", "usbhid.setup.wLength", FT_UINT16, BASE_DEC,
5684 NULL, 0x0, NULL, HFILL }},
5686 { &hf_usb_hid_report_type,
5687 { "ReportType", "usbhid.setup.ReportType", FT_UINT8, BASE_DEC,
5688 VALS(usb_hid_report_type_vals), 0x0, NULL, HFILL }},
5690 { &hf_usb_hid_report_id,
5691 { "ReportID", "usbhid.setup.ReportID", FT_UINT8, BASE_DEC,
5692 NULL, 0x0, NULL, HFILL }},
5694 { &hf_usb_hid_duration,
5695 { "Duration", "usbhid.setup.Duration", FT_UINT8, BASE_DEC,
5696 NULL, 0x0, NULL, HFILL }},
5698 { &hf_usb_hid_zero,
5699 { "(zero)", "usbhid.setup.zero", FT_UINT8, BASE_DEC,
5700 NULL, 0x0, NULL, HFILL }},
5702 /* components of the HID descriptor */
5703 { &hf_usb_hid_bcdHID,
5704 { "bcdHID", "usbhid.descriptor.hid.bcdHID", FT_UINT16, BASE_HEX,
5705 NULL, 0x0, NULL, HFILL }},
5707 { &hf_usb_hid_bCountryCode,
5708 { "bCountryCode", "usbhid.descriptor.hid.bCountryCode", FT_UINT8, BASE_HEX,
5709 VALS(hid_country_code_vals), 0x0, NULL, HFILL }},
5711 { &hf_usb_hid_bNumDescriptors,
5712 { "bNumDescriptors", "usbhid.descriptor.hid.bNumDescriptors", FT_UINT8, BASE_DEC,
5713 NULL, 0x0, NULL, HFILL }},
5715 { &hf_usb_hid_bDescriptorIndex,
5716 { "bDescriptorIndex", "usbhid.descriptor.hid.bDescriptorIndex", FT_UINT8, BASE_HEX,
5717 NULL, 0x0, NULL, HFILL }},
5719 { &hf_usb_hid_bDescriptorType,
5720 { "bDescriptorType", "usbhid.descriptor.hid.bDescriptorType", FT_UINT8, BASE_HEX|BASE_EXT_STRING,
5721 &hid_descriptor_type_vals_ext, 0x00, NULL, HFILL }},
5723 { &hf_usb_hid_wInterfaceNumber,
5724 { "wInterfaceNumber", "usbhid.descriptor.hid.wInterfaceNumber", FT_UINT16, BASE_DEC,
5725 NULL, 0x0, NULL, HFILL }},
5727 { &hf_usb_hid_wDescriptorLength,
5728 { "wDescriptorLength", "usbhid.descriptor.hid.wDescriptorLength", FT_UINT16, BASE_DEC,
5729 NULL, 0x0, NULL, HFILL }},
5731 { &hf_usbhid_boot_report_keyboard_reserved,
5732 { "Reserved", "usbhid.boot_report.keyboard.reserved", FT_UINT8, BASE_HEX,
5733 NULL, 0x00, NULL, HFILL }},
5735 { &hf_usbhid_boot_report_keyboard_keycode_1,
5736 { "Keycode 1", "usbhid.boot_report.keyboard.keycode_1", FT_UINT8, BASE_HEX|BASE_EXT_STRING,
5737 &keycode_vals_ext, 0x00, NULL, HFILL }},
5739 { &hf_usbhid_boot_report_keyboard_keycode_2,
5740 { "Keycode 2", "usbhid.boot_report.keyboard.keycode_2", FT_UINT8, BASE_HEX|BASE_EXT_STRING,
5741 &keycode_vals_ext, 0x00, NULL, HFILL }},
5743 { &hf_usbhid_boot_report_keyboard_keycode_3,
5744 { "Keycode 3", "usbhid.boot_report.keyboard.keycode_3", FT_UINT8, BASE_HEX|BASE_EXT_STRING,
5745 &keycode_vals_ext, 0x00, NULL, HFILL }},
5747 { &hf_usbhid_boot_report_keyboard_keycode_4,
5748 { "Keycode 4", "usbhid.boot_report.keyboard.keycode_4", FT_UINT8, BASE_HEX|BASE_EXT_STRING,
5749 &keycode_vals_ext, 0x00, NULL, HFILL }},
5751 { &hf_usbhid_boot_report_keyboard_keycode_5,
5752 { "Keycode 5", "usbhid.boot_report.keyboard.keycode_5", FT_UINT8, BASE_HEX|BASE_EXT_STRING,
5753 &keycode_vals_ext, 0x00, NULL, HFILL }},
5755 { &hf_usbhid_boot_report_keyboard_keycode_6,
5756 { "Keycode 6", "usbhid.boot_report.keyboard.keycode_6", FT_UINT8, BASE_HEX|BASE_EXT_STRING,
5757 &keycode_vals_ext, 0x00, NULL, HFILL }},
5759 { &hf_usbhid_boot_report_keyboard_modifier_right_gui,
5760 { "Modifier: RIGHT GUI", "usbhid.boot_report.keyboard.modifier.right_gui", FT_BOOLEAN, 8,
5761 NULL, 0x80, NULL, HFILL }},
5763 { &hf_usbhid_boot_report_keyboard_modifier_right_alt,
5764 { "Modifier: RIGHT ALT", "usbhid.boot_report.keyboard.modifier.right_alt", FT_BOOLEAN, 8,
5765 NULL, 0x40, NULL, HFILL }},
5767 { &hf_usbhid_boot_report_keyboard_modifier_right_shift,
5768 { "Modifier: RIGHT SHIFT", "usbhid.boot_report.keyboard.modifier.right_shift", FT_BOOLEAN, 8,
5769 NULL, 0x20, NULL, HFILL }},
5771 { &hf_usbhid_boot_report_keyboard_modifier_right_ctrl,
5772 { "Modifier: RIGHT CTRL", "usbhid.boot_report.keyboard.modifier.right_ctrl", FT_BOOLEAN, 8,
5773 NULL, 0x10,NULL, HFILL }},
5775 { &hf_usbhid_boot_report_keyboard_modifier_left_gui,
5776 { "Modifier: LEFT GUI", "usbhid.boot_report.keyboard.modifier.left_gui", FT_BOOLEAN, 8,
5777 NULL, 0x08, NULL, HFILL }},
5779 { &hf_usbhid_boot_report_keyboard_modifier_left_alt,
5780 { "Modifier: LEFT ALT", "usbhid.boot_report.keyboard.modifier.left_alt", FT_BOOLEAN, 8,
5781 NULL, 0x04, NULL, HFILL }
5784 { &hf_usbhid_boot_report_keyboard_modifier_left_shift,
5785 { "Modifier: LEFT SHIFT", "usbhid.boot_report.keyboard.modifier.left_shift", FT_BOOLEAN, 8,
5786 NULL, 0x02, NULL, HFILL }},
5788 { &hf_usbhid_boot_report_keyboard_modifier_left_ctrl,
5789 { "Modifier: LEFT CTRL", "usbhid.boot_report.keyboard.modifier.left_ctrl", FT_BOOLEAN, 8,
5790 NULL, 0x01, NULL, HFILL }},
5792 { &hf_usbhid_boot_report_keyboard_leds_constants,
5793 { "Constants", "usbhid.boot_report.keyboard.leds.constants", FT_UINT8, BASE_HEX,
5794 NULL, 0xE0, NULL, HFILL }},
5796 { &hf_usbhid_boot_report_keyboard_leds_kana,
5797 { "KANA", "usbhid.boot_report.keyboard.leds.kana", FT_BOOLEAN, 8,
5798 NULL, 0x10, NULL, HFILL }},
5800 { &hf_usbhid_boot_report_keyboard_leds_compose,
5801 { "COMPOSE", "usbhid.boot_report.keyboard.leds.compose", FT_BOOLEAN, 8,
5802 NULL, 0x08, NULL, HFILL }},
5804 { &hf_usbhid_boot_report_keyboard_leds_scroll_lock,
5805 { "SCROLL LOCK", "usbhid.boot_report.keyboard.leds.scroll_lock", FT_BOOLEAN, 8,
5806 NULL, 0x04, NULL, HFILL }},
5808 { &hf_usbhid_boot_report_keyboard_leds_caps_lock,
5809 { "CAPS LOCK", "usbhid.boot_report.keyboard.leds.caps_lock", FT_BOOLEAN, 8,
5810 NULL, 0x02,NULL, HFILL }},
5812 { &hf_usbhid_boot_report_keyboard_leds_num_lock,
5813 { "NUM LOCK", "usbhid.boot_report.keyboard.leds.num_lock", FT_BOOLEAN, 8,
5814 NULL, 0x01, NULL, HFILL }},
5816 { &hf_usbhid_boot_report_mouse_button_8,
5817 { "Button 8", "usbhid.boot_report.mouse.button.8", FT_BOOLEAN, 8,
5818 NULL, 0x80, NULL, HFILL }},
5820 { &hf_usbhid_boot_report_mouse_button_7,
5821 { "Button 7", "usbhid.boot_report.mouse.button.7", FT_BOOLEAN, 8,
5822 NULL, 0x40, NULL, HFILL }},
5824 { &hf_usbhid_boot_report_mouse_button_6,
5825 { "Button 6", "usbhid.boot_report.mouse.button.6", FT_BOOLEAN, 8,
5826 NULL, 0x20, NULL, HFILL }},
5828 { &hf_usbhid_boot_report_mouse_button_5,
5829 { "Button 5", "usbhid.boot_report.mouse.button.5", FT_BOOLEAN, 8,
5830 NULL, 0x10, NULL, HFILL }},
5832 { &hf_usbhid_boot_report_mouse_button_4,
5833 { "Button 4", "usbhid.boot_report.mouse.button.4", FT_BOOLEAN, 8,
5834 NULL, 0x08, NULL, HFILL }},
5836 { &hf_usbhid_boot_report_mouse_button_middle,
5837 { "Button Middle", "usbhid.boot_report.mouse.button.middle", FT_BOOLEAN, 8,
5838 NULL, 0x04, NULL, HFILL }},
5840 { &hf_usbhid_boot_report_mouse_button_right,
5841 { "Button Right", "usbhid.boot_report.mouse.button.right", FT_BOOLEAN, 8,
5842 NULL, 0x02, NULL, HFILL }},
5844 { &hf_usbhid_boot_report_mouse_button_left,
5845 { "Button Left", "usbhid.boot_report.mouse.button.left", FT_BOOLEAN, 8,
5846 NULL, 0x01, NULL, HFILL }},
5848 { &hf_usbhid_boot_report_mouse_x_displacement,
5849 { "X Displacement", "usbhid.boot_report.mouse.x_displacement", FT_INT8, BASE_DEC,
5850 NULL, 0x00, NULL, HFILL }},
5852 { &hf_usbhid_boot_report_mouse_y_displacement,
5853 { "Y Displacement", "usbhid.boot_report.mouse.y_displacement", FT_INT8, BASE_DEC,
5854 NULL, 0x00, NULL, HFILL }},
5856 { &hf_usbhid_boot_report_mouse_horizontal_scroll_wheel,
5857 { "Horizontal Scroll Wheel", "usbhid.boot_report.mouse.scroll_wheel.horizontal", FT_INT8, BASE_DEC,
5858 NULL, 0x00, NULL, HFILL }},
5860 { &hf_usbhid_boot_report_mouse_vertical_scroll_wheel,
5861 { "Vertical Scroll Wheel", "usbhid.boot_report.mouse.scroll_wheel.vertical", FT_INT8, BASE_DEC,
5862 NULL, 0x00, NULL, HFILL }},
5864 { &hf_usbhid_data,
5865 { "HID Data", "usbhid.data", FT_BYTES, BASE_NONE,
5866 NULL, 0x00, NULL, HFILL }},
5868 { &hf_usbhid_unknown_data,
5869 { "Unknown", "usbhid.data.unknown", FT_BYTES, BASE_NONE,
5870 NULL, 0x00, NULL, HFILL }},
5872 { &hf_usbhid_vendor_data,
5873 { "Vendor Data", "usbhid.data.vendor", FT_BYTES, BASE_NONE,
5874 NULL, 0x00, NULL, HFILL }},
5876 { &hf_usbhid_report_id,
5877 { "Report ID", "usbhid.data.report_id", FT_UINT8, BASE_HEX,
5878 NULL, 0x00, NULL, HFILL }},
5880 { &hf_usbhid_padding,
5881 { "Padding", "usbhid.data.padding", FT_BYTES, BASE_NONE,
5882 NULL, 0x00, NULL, HFILL }},
5884 { &hf_usbhid_axis_x,
5885 { "X Axis", "usbhid.data.axis.x", FT_INT32, BASE_DEC,
5886 NULL, 0x00, NULL, HFILL }},
5888 { &hf_usbhid_axis_y,
5889 { "Y Axis", "usbhid.data.axis.y", FT_INT32, BASE_DEC,
5890 NULL, 0x00, NULL, HFILL }},
5892 { &hf_usbhid_axis_z,
5893 { "Z Axis", "usbhid.data.axis.z", FT_INT32, BASE_DEC,
5894 NULL, 0x00, NULL, HFILL }},
5896 { &hf_usbhid_axis_rx,
5897 { "Rx Axis", "usbhid.data.axis.rx", FT_INT32, BASE_DEC,
5898 NULL, 0x00, NULL, HFILL }},
5900 { &hf_usbhid_axis_ry,
5901 { "Ry Axis", "usbhid.data.axis.ry", FT_INT32, BASE_DEC,
5902 NULL, 0x00, NULL, HFILL }},
5904 { &hf_usbhid_axis_rz,
5905 { "Rz Axis", "usbhid.data.axis.rz", FT_INT32, BASE_DEC,
5906 NULL, 0x00, NULL, HFILL }},
5908 { &hf_usbhid_axis_slider,
5909 { "Slider Axis", "usbhid.data.axis.slider", FT_INT32, BASE_DEC,
5910 NULL, 0x00, NULL, HFILL }},
5912 { &hf_usbhid_axis_vx,
5913 { "Vx Axis", "usbhid.data.axis.vx", FT_INT32, BASE_DEC,
5914 NULL, 0x00, NULL, HFILL }},
5916 { &hf_usbhid_axis_vy,
5917 { "Vy Axis", "usbhid.data.axis.vy", FT_INT32, BASE_DEC,
5918 NULL, 0x00, NULL, HFILL }},
5920 { &hf_usbhid_axis_vz,
5921 { "Vz Axis", "usbhid.data.axis.vz", FT_INT32, BASE_DEC,
5922 NULL, 0x00, NULL, HFILL }},
5924 { &hf_usbhid_axis_vbrx,
5925 { "Vbrx Axis", "usbhid.data.axis.vbrx", FT_INT32, BASE_DEC,
5926 NULL, 0x00, NULL, HFILL }},
5928 { &hf_usbhid_axis_vbry,
5929 { "Vbry Axis", "usbhid.data.axis.vbry", FT_INT32, BASE_DEC,
5930 NULL, 0x00, NULL, HFILL }},
5932 { &hf_usbhid_axis_vbrz,
5933 { "Vbrz Axis", "usbhid.data.axis.vbrz", FT_INT32, BASE_DEC,
5934 NULL, 0x00, NULL, HFILL }},
5936 { &hf_usbhid_axis_vno,
5937 { "Vno Axis", "usbhid.data.axis.vno", FT_INT32, BASE_DEC,
5938 NULL, 0x00, NULL, HFILL }},
5940 { &hf_usbhid_button,
5941 { "Button", "usbhid.data.button", FT_BOOLEAN, BASE_NONE,
5942 NULL, 0x00, NULL, HFILL }},
5944 { &hf_usbhid_key,
5945 { "Key", "usbhid.data.key.variable", FT_BOOLEAN, BASE_NONE,
5946 NULL, 0x00, NULL, HFILL }},
5948 { &hf_usbhid_array,
5949 { "Array", "usbhid.data.array", FT_BYTES, BASE_NONE,
5950 NULL, 0x00, NULL, HFILL }},
5952 { &hf_usbhid_array_usage,
5953 { "Usage", "usbhid.data.array.usage", FT_BOOLEAN, BASE_NONE,
5954 NULL, 0x00, NULL, HFILL }},
5957 static int *usb_hid_ett[] = {
5958 &ett_usb_hid_report,
5959 &ett_usb_hid_item_header,
5960 &ett_usb_hid_wValue,
5961 &ett_usb_hid_descriptor,
5962 &ett_usb_hid_data,
5963 &ett_usb_hid_unknown_data,
5964 &ett_usb_hid_array
5967 report_descriptors = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
5969 proto_usb_hid = proto_register_protocol("USB HID", "USBHID", "usbhid");
5970 proto_register_field_array(proto_usb_hid, hf, array_length(hf));
5971 proto_register_subtree_array(usb_hid_ett, array_length(usb_hid_ett));
5973 /*usb_hid_boot_keyboard_input_report_handle =*/ register_dissector("usbhid.boot_report.keyboard.input", dissect_usb_hid_boot_keyboard_input_report, proto_usb_hid);
5974 /*usb_hid_boot_keyboard_output_report_handle =*/ register_dissector("usbhid.boot_report.keyboard.output", dissect_usb_hid_boot_keyboard_output_report, proto_usb_hid);
5975 /*usb_hid_boot_mouse_input_report_handle =*/ register_dissector("usbhid.boot_report.mouse.input", dissect_usb_hid_boot_mouse_input_report, proto_usb_hid);
5976 usb_hid_control_handle = register_dissector("usbhid.control", dissect_usb_hid_control, proto_usb_hid);
5977 usb_hid_interrupt_handle = register_dissector("usbhid.data", dissect_usb_hid_data, proto_usb_hid);
5978 usb_hid_descr_handle = register_dissector("usbhid.class_descriptors", dissect_usb_hid_class_descriptors, proto_usb_hid);
5981 void
5982 proto_reg_handoff_usb_hid(void)
5984 dissector_add_uint("usb.control", IF_CLASS_HID, usb_hid_control_handle);
5985 dissector_add_for_decode_as("usb.device", usb_hid_control_handle);
5986 dissector_add_uint("usb.interrupt", IF_CLASS_HID, usb_hid_interrupt_handle);
5987 dissector_add_uint("usb.descriptor", IF_CLASS_HID, usb_hid_descr_handle);
5991 * Editor modelines - https://www.wireshark.org/tools/modelines.html
5993 * Local variables:
5994 * c-basic-offset: 4
5995 * tab-width: 8
5996 * indent-tabs-mode: nil
5997 * End:
5999 * vi: set shiftwidth=4 tabstop=8 expandtab:
6000 * :indentSize=4:tabSize=8:noTabs=true: