Bug Summary

File:builds/wireshark/wireshark/epan/dissectors/packet-usb-hid.c
Warning:line 4543, column 9
Value stored to 'offset' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

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