aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-usb-hid.c
diff options
context:
space:
mode:
authorFilipe Laíns <lains@archlinux.org>2020-03-13 14:31:04 +0000
committerTomasz Moń <desowin@gmail.com>2020-03-14 08:46:59 +0000
commit975d99cbacd31bb6146d9ee8feebec0cf466e9ea (patch)
tree6bc0390134648605d56adefb4c36dc1d93ec54e9 /epan/dissectors/packet-usb-hid.c
parent93f5d130c9857052cfc7ec8819c2dc607d345809 (diff)
USB HID: have a consistent style
Change-Id: I2c2b89e6f7d2bce6af3043365d3f4c771044420b Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/36392 Petri-Dish: Tomasz Moń <desowin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Tomasz Moń <desowin@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-usb-hid.c')
-rw-r--r--epan/dissectors/packet-usb-hid.c817
1 files changed, 383 insertions, 434 deletions
diff --git a/epan/dissectors/packet-usb-hid.c b/epan/dissectors/packet-usb-hid.c
index 7ad9e65ad3..52843b9654 100644
--- a/epan/dissectors/packet-usb-hid.c
+++ b/epan/dissectors/packet-usb-hid.c
@@ -152,7 +152,7 @@ struct usb_hid_global_state {
static const value_string hid_descriptor_type_vals[] = {
{USB_DT_HID, "HID"},
{USB_DT_HID_REPORT, "HID Report"},
- {0,NULL}
+ {0, NULL}
};
static value_string_ext hid_descriptor_type_vals_ext =
VALUE_STRING_EXT_INIT(hid_descriptor_type_vals);
@@ -2142,243 +2142,243 @@ static const value_string usb_hid_arcade_usage_page_vals[] = {
};
static const value_string keycode_vals[] = {
- { 0x00, "<ACTION KEY UP>" },
- { 0x01, "ErrorRollOver" },
- { 0x02, "POSTFail" },
- { 0x03, "ErrorUndefined" },
-
- { 0x04, "a" },
- { 0x05, "b" },
- { 0x06, "c" },
- { 0x07, "d" },
- { 0x08, "e" },
- { 0x09, "f" },
- { 0x0A, "g" },
- { 0x0B, "h" },
- { 0x0C, "i" },
- { 0x0D, "j" },
- { 0x0E, "k" },
- { 0x0F, "l" },
- { 0x10, "m" },
- { 0x11, "n" },
- { 0x12, "o" },
- { 0x13, "p" },
- { 0x14, "q" },
- { 0x15, "r" },
- { 0x16, "s" },
- { 0x17, "t" },
- { 0x18, "u" },
- { 0x19, "v" },
- { 0x1A, "w" },
- { 0x1B, "x" },
- { 0x1C, "y" },
- { 0x1D, "z" },
-
- { 0x1E, "1" },
- { 0x1F, "2" },
- { 0x20, "3" },
- { 0x21, "4" },
- { 0x22, "5" },
- { 0x23, "6" },
- { 0x24, "7" },
- { 0x25, "8" },
- { 0x26, "9" },
- { 0x27, "0" },
-
- { 0x28, "ENTER" },
- { 0x29, "Escape" },
- { 0x2A, "Backspace" },
- { 0x2B, "Tab" },
- { 0x2C, "Spacebar" },
-
- { 0x2D, "-" },
- { 0x2E, "=" },
- { 0x2F, "[" },
- { 0x30, "]" },
- { 0x31, "\\" },
- { 0x32, "NonUS #/~" },
- { 0x33, ";" },
- { 0x34, "'" },
- { 0x35, "`" },
- { 0x36, "," },
- { 0x37, "." },
- { 0x38, "/" },
- { 0x39, "CapsLock" },
- { 0x3A, "F1" },
- { 0x3B, "F2" },
- { 0x3C, "F3" },
- { 0x3D, "F4" },
- { 0x3E, "F5" },
- { 0x3F, "F6" },
- { 0x40, "F7" },
- { 0x41, "F8" },
- { 0x42, "F9" },
- { 0x43, "F10" },
- { 0x44, "F11" },
- { 0x45, "F12" },
- { 0x46, "PrintScreen" },
- { 0x47, "ScrollLock" },
- { 0x48, "Pause" },
- { 0x49, "Insert" },
- { 0x4A, "Home" },
- { 0x4B, "PageUp" },
- { 0x4C, "DeleteForward" },
- { 0x4D, "End" },
- { 0x4E, "PageDown" },
- { 0x4F, "RightArrow" },
- { 0x50, "LeftArrow" },
- { 0x51, "DownArrow" },
- { 0x52, "UpArrow" },
- { 0x53, "NumLock" },
+ {0x00, "<ACTION KEY UP>"},
+ {0x01, "ErrorRollOver"},
+ {0x02, "POSTFail"},
+ {0x03, "ErrorUndefined"},
+
+ {0x04, "a"},
+ {0x05, "b"},
+ {0x06, "c"},
+ {0x07, "d"},
+ {0x08, "e"},
+ {0x09, "f"},
+ {0x0A, "g"},
+ {0x0B, "h"},
+ {0x0C, "i"},
+ {0x0D, "j"},
+ {0x0E, "k"},
+ {0x0F, "l"},
+ {0x10, "m"},
+ {0x11, "n"},
+ {0x12, "o"},
+ {0x13, "p"},
+ {0x14, "q"},
+ {0x15, "r"},
+ {0x16, "s"},
+ {0x17, "t"},
+ {0x18, "u"},
+ {0x19, "v"},
+ {0x1A, "w"},
+ {0x1B, "x"},
+ {0x1C, "y"},
+ {0x1D, "z"},
+
+ {0x1E, "1"},
+ {0x1F, "2"},
+ {0x20, "3"},
+ {0x21, "4"},
+ {0x22, "5"},
+ {0x23, "6"},
+ {0x24, "7"},
+ {0x25, "8"},
+ {0x26, "9"},
+ {0x27, "0"},
+
+ {0x28, "ENTER"},
+ {0x29, "Escape"},
+ {0x2A, "Backspace"},
+ {0x2B, "Tab"},
+ {0x2C, "Spacebar"},
+
+ {0x2D, "-"},
+ {0x2E, "="},
+ {0x2F, "["},
+ {0x30, "]"},
+ {0x31, "\\"},
+ {0x32, "NonUS #/~"},
+ {0x33, ";"},
+ {0x34, "'"},
+ {0x35, "`"},
+ {0x36, ","},
+ {0x37, "."},
+ {0x38, "/"},
+ {0x39, "CapsLock"},
+ {0x3A, "F1"},
+ {0x3B, "F2"},
+ {0x3C, "F3"},
+ {0x3D, "F4"},
+ {0x3E, "F5"},
+ {0x3F, "F6"},
+ {0x40, "F7"},
+ {0x41, "F8"},
+ {0x42, "F9"},
+ {0x43, "F10"},
+ {0x44, "F11"},
+ {0x45, "F12"},
+ {0x46, "PrintScreen"},
+ {0x47, "ScrollLock"},
+ {0x48, "Pause"},
+ {0x49, "Insert"},
+ {0x4A, "Home"},
+ {0x4B, "PageUp"},
+ {0x4C, "DeleteForward"},
+ {0x4D, "End"},
+ {0x4E, "PageDown"},
+ {0x4F, "RightArrow"},
+ {0x50, "LeftArrow"},
+ {0x51, "DownArrow"},
+ {0x52, "UpArrow"},
+ {0x53, "NumLock"},
/* Keypad */
- { 0x54, "Keypad /" },
- { 0x55, "Keypad *" },
- { 0x56, "Keypad -" },
- { 0x57, "Keypad +" },
- { 0x58, "Keypad ENTER" },
- { 0x59, "Keypad 1" },
- { 0x5A, "Keypad 2" },
- { 0x5B, "Keypad 3" },
- { 0x5C, "Keypad 4" },
- { 0x5D, "Keypad 5" },
- { 0x5E, "Keypad 6" },
- { 0x5F, "Keypad 7" },
- { 0x60, "Keypad 8" },
- { 0x61, "Keypad 9" },
- { 0x62, "Keypad 0" },
- { 0x63, "Keypad ." },
+ {0x54, "Keypad /"},
+ {0x55, "Keypad *"},
+ {0x56, "Keypad -"},
+ {0x57, "Keypad +"},
+ {0x58, "Keypad ENTER"},
+ {0x59, "Keypad 1"},
+ {0x5A, "Keypad 2"},
+ {0x5B, "Keypad 3"},
+ {0x5C, "Keypad 4"},
+ {0x5D, "Keypad 5"},
+ {0x5E, "Keypad 6"},
+ {0x5F, "Keypad 7"},
+ {0x60, "Keypad 8"},
+ {0x61, "Keypad 9"},
+ {0x62, "Keypad 0"},
+ {0x63, "Keypad ."},
/* non PC AT */
- { 0x64, "NonUS \\/|" },
- { 0x65, "Application" },
- { 0x66, "Power" },
- { 0x67, "Keypad =" },
- { 0x68, "F13" },
- { 0x69, "F14" },
- { 0x6A, "F15" },
- { 0x6B, "F16" },
- { 0x6C, "F17" },
- { 0x6D, "F18" },
- { 0x6E, "F19" },
- { 0x6F, "F20" },
-
- { 0x70, "F21" },
- { 0x71, "F22" },
- { 0x72, "F23" },
- { 0x73, "F24" },
- { 0x74, "Execute" },
- { 0x75, "Help" },
- { 0x76, "Menu" },
- { 0x77, "Select" },
- { 0x78, "Stop" },
- { 0x79, "Again" },
- { 0x7A, "Undo" },
- { 0x7B, "Cut" },
- { 0x7C, "Copy" },
- { 0x7D, "Paste" },
- { 0x7E, "Find" },
- { 0x7F, "Mute" },
-
- { 0x80, "VolumeUp" },
- { 0x81, "VolumeDown" },
- { 0x82, "Locking CapsLock" },
- { 0x83, "Locking NumLock" },
- { 0x84, "Locking ScrollLock" },
- { 0x85, "Keypad Comma" },
- { 0x86, "Keypad EqualSign" },
- { 0x87, "International1" },
- { 0x88, "International2" },
- { 0x89, "International3" },
- { 0x8A, "International4" },
- { 0x8B, "International5" },
- { 0x8C, "International6" },
- { 0x8D, "International7" },
- { 0x8E, "International8" },
- { 0x8F, "International9" },
-
- { 0x90, "LANG1" },
- { 0x91, "LANG2" },
- { 0x92, "LANG3" },
- { 0x93, "LANG4" },
- { 0x94, "LANG5" },
- { 0x95, "LANG6" },
- { 0x96, "LANG7" },
- { 0x97, "LANG8" },
- { 0x98, "LANG9" },
- { 0x99, "AlternateErase" },
- { 0x9A, "SysReq/Attention" },
- { 0x9B, "Cancel" },
- { 0x9C, "Clear" },
- { 0x9D, "Prior" },
- { 0x9E, "Return" },
- { 0x9F, "Separator" },
-
- { 0xA0, "Out" },
- { 0xA1, "Oper" },
- { 0xA2, "Clear/Again" },
- { 0xA3, "CrSel/Props" },
- { 0xA4, "ExSel" },
+ {0x64, "NonUS \\/|"},
+ {0x65, "Application"},
+ {0x66, "Power"},
+ {0x67, "Keypad ="},
+ {0x68, "F13"},
+ {0x69, "F14"},
+ {0x6A, "F15"},
+ {0x6B, "F16"},
+ {0x6C, "F17"},
+ {0x6D, "F18"},
+ {0x6E, "F19"},
+ {0x6F, "F20"},
+
+ {0x70, "F21"},
+ {0x71, "F22"},
+ {0x72, "F23"},
+ {0x73, "F24"},
+ {0x74, "Execute"},
+ {0x75, "Help"},
+ {0x76, "Menu"},
+ {0x77, "Select"},
+ {0x78, "Stop"},
+ {0x79, "Again"},
+ {0x7A, "Undo"},
+ {0x7B, "Cut"},
+ {0x7C, "Copy"},
+ {0x7D, "Paste"},
+ {0x7E, "Find"},
+ {0x7F, "Mute"},
+
+ {0x80, "VolumeUp"},
+ {0x81, "VolumeDown"},
+ {0x82, "Locking CapsLock"},
+ {0x83, "Locking NumLock"},
+ {0x84, "Locking ScrollLock"},
+ {0x85, "Keypad Comma"},
+ {0x86, "Keypad EqualSign"},
+ {0x87, "International1"},
+ {0x88, "International2"},
+ {0x89, "International3"},
+ {0x8A, "International4"},
+ {0x8B, "International5"},
+ {0x8C, "International6"},
+ {0x8D, "International7"},
+ {0x8E, "International8"},
+ {0x8F, "International9"},
+
+ {0x90, "LANG1"},
+ {0x91, "LANG2"},
+ {0x92, "LANG3"},
+ {0x93, "LANG4"},
+ {0x94, "LANG5"},
+ {0x95, "LANG6"},
+ {0x96, "LANG7"},
+ {0x97, "LANG8"},
+ {0x98, "LANG9"},
+ {0x99, "AlternateErase"},
+ {0x9A, "SysReq/Attention"},
+ {0x9B, "Cancel"},
+ {0x9C, "Clear"},
+ {0x9D, "Prior"},
+ {0x9E, "Return"},
+ {0x9F, "Separator"},
+
+ {0xA0, "Out"},
+ {0xA1, "Oper"},
+ {0xA2, "Clear/Again"},
+ {0xA3, "CrSel/Props"},
+ {0xA4, "ExSel"},
/* 0xA5..0xAF - reserved */
- { 0xB0, "Keypad 00" },
- { 0xB1, "Keypad 000" },
- { 0xB2, "ThousandsSeparator" },
- { 0xB3, "DecimalSeparator" },
- { 0xB4, "CurrencyUnit" },
- { 0xB5, "CurrencySubunit" },
- { 0xB6, "Keypad (" },
- { 0xB7, "Keypad )" },
- { 0xB8, "Keypad {" },
- { 0xB9, "Keypad }" },
- { 0xBA, "Keypad Tab" },
- { 0xBB, "Keypad Backspace" },
- { 0xBC, "Keypad A" },
- { 0xBD, "Keypad B" },
- { 0xBE, "Keypad C" },
- { 0xBF, "Keypad D" },
-
- { 0xC0, "Keypad E" },
- { 0xC1, "Keypad F" },
- { 0xC2, "Keypad XOR" },
- { 0xC3, "Keypad ^" },
- { 0xC4, "Keypad %" },
- { 0xC5, "Keypad <" },
- { 0xC6, "Keypad >" },
- { 0xC7, "Keypad &" },
- { 0xC8, "Keypad &&" },
- { 0xC9, "Keypad |" },
- { 0xCA, "Keypad ||" },
- { 0xCB, "Keypad :" },
- { 0xCC, "Keypad #" },
- { 0xCD, "Keypad Space" },
- { 0xCE, "Keypad @" },
- { 0xCF, "Keypad !" },
-
- { 0xD0, "Keypad Memory Store" },
- { 0xD1, "Keypad Memory Recall" },
- { 0xD2, "Keypad Memory Clear" },
- { 0xD3, "Keypad Memory Add" },
- { 0xD4, "Keypad Memory Subtract" },
- { 0xD5, "Keypad Memory Multiply" },
- { 0xD6, "Keypad Memory Divide" },
- { 0xD7, "Keypad +/-" },
- { 0xD8, "Keypad Clear" },
- { 0xD9, "Keypad Clear Entry" },
- { 0xDA, "Keypad Binary" },
- { 0xDB, "Keypad Octal" },
- { 0xDC, "Keypad Decimal" },
- { 0xDD, "Keypad Hexadecimal" },
+ {0xB0, "Keypad 00"},
+ {0xB1, "Keypad 000"},
+ {0xB2, "ThousandsSeparator"},
+ {0xB3, "DecimalSeparator"},
+ {0xB4, "CurrencyUnit"},
+ {0xB5, "CurrencySubunit"},
+ {0xB6, "Keypad ("},
+ {0xB7, "Keypad )"},
+ {0xB8, "Keypad {"},
+ {0xB9, "Keypad }"},
+ {0xBA, "Keypad Tab"},
+ {0xBB, "Keypad Backspace"},
+ {0xBC, "Keypad A"},
+ {0xBD, "Keypad B"},
+ {0xBE, "Keypad C"},
+ {0xBF, "Keypad D"},
+
+ {0xC0, "Keypad E"},
+ {0xC1, "Keypad F"},
+ {0xC2, "Keypad XOR"},
+ {0xC3, "Keypad ^"},
+ {0xC4, "Keypad %"},
+ {0xC5, "Keypad <"},
+ {0xC6, "Keypad >"},
+ {0xC7, "Keypad &"},
+ {0xC8, "Keypad &&"},
+ {0xC9, "Keypad |"},
+ {0xCA, "Keypad ||"},
+ {0xCB, "Keypad :"},
+ {0xCC, "Keypad #"},
+ {0xCD, "Keypad Space"},
+ {0xCE, "Keypad @"},
+ {0xCF, "Keypad !"},
+
+ {0xD0, "Keypad Memory Store"},
+ {0xD1, "Keypad Memory Recall"},
+ {0xD2, "Keypad Memory Clear"},
+ {0xD3, "Keypad Memory Add"},
+ {0xD4, "Keypad Memory Subtract"},
+ {0xD5, "Keypad Memory Multiply"},
+ {0xD6, "Keypad Memory Divide"},
+ {0xD7, "Keypad +/-"},
+ {0xD8, "Keypad Clear"},
+ {0xD9, "Keypad Clear Entry"},
+ {0xDA, "Keypad Binary"},
+ {0xDB, "Keypad Octal"},
+ {0xDC, "Keypad Decimal"},
+ {0xDD, "Keypad Hexadecimal"},
/* 0xDE..0xDF - reserved, */
- { 0xE0, "LeftControl" },
- { 0xE1, "LeftShift" },
- { 0xE2, "LeftAlt" },
- { 0xE3, "LeftGUI" },
- { 0xE4, "RightControl" },
- { 0xE5, "RightShift" },
- { 0xE6, "RightAlt" },
- { 0xE7, "RightGUI" },
+ {0xE0, "LeftControl"},
+ {0xE1, "LeftShift"},
+ {0xE2, "LeftAlt"},
+ {0xE3, "LeftGUI"},
+ {0xE4, "RightControl"},
+ {0xE5, "RightShift"},
+ {0xE6, "RightAlt"},
+ {0xE7, "RightGUI"},
- { 0, NULL }
+ {0, NULL}
};
value_string_ext keycode_vals_ext = VALUE_STRING_EXT_INIT(keycode_vals);
@@ -2492,9 +2492,8 @@ get_usage_page_item_string(guint32 usage_page, guint32 id)
break;
}
- if (!str) {
+ if (!str)
str = "Reserved";
- }
return g_strdup_printf(str, id);
}
@@ -2517,16 +2516,15 @@ dissect_usb_hid_report_mainitem_data(packet_info *pinfo _U_, proto_tree *tree, t
proto_tree_add_item(tree, hf_usb_hid_mainitem_bit4, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
proto_tree_add_item(tree, hf_usb_hid_mainitem_bit5, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
proto_tree_add_item(tree, hf_usb_hid_mainitem_bit6, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
- if (bTag == USBHID_MAINITEM_TAG_INPUT) {
+ if (bTag == USBHID_MAINITEM_TAG_INPUT)
proto_tree_add_item(tree, hf_usb_hid_mainitem_bit7_input, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
- } else {
+ else
proto_tree_add_item(tree, hf_usb_hid_mainitem_bit7, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
- }
- if (bSize > 1) {
+ if (bSize > 1)
proto_tree_add_item(tree, hf_usb_hid_mainitem_bit8, tvb, offset, bSize, ENC_LITTLE_ENDIAN);
- } else {
+ else
proto_tree_add_boolean_format_value(tree, hf_usb_hid_mainitem_bit8, tvb, offset, 0, FALSE, "Buffered bytes (default, no second byte present)");
- }
+
val = tvb_get_guint8(tvb, offset);
if (val & (1 << 0))
proto_item_append_text(ti, " (Const,");
@@ -3341,10 +3339,8 @@ dissect_usb_hid_control_std_intf(tvbuff_t *tvb, packet_info *pinfo,
col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
val_to_str_ext(usb_trans_info->u.get_descriptor.type,
&hid_descriptor_type_vals_ext, "Unknown type %u"));
- if (usb_trans_info->u.get_descriptor.type == USB_DT_HID_REPORT) {
- offset = dissect_usb_hid_get_report_descriptor(
- pinfo, tree, tvb, offset, usb_conv_info);
- }
+ if (usb_trans_info->u.get_descriptor.type == USB_DT_HID_REPORT)
+ offset = dissect_usb_hid_get_report_descriptor(pinfo, tree, tvb, offset, usb_conv_info);
}
return offset;
@@ -3375,15 +3371,14 @@ dissect_usb_hid_control_class_intf(tvbuff_t *tvb, packet_info *pinfo,
/* No, we could not find any class specific dissector for this request
* return 0 and let USB try any of the standard requests.
*/
- if (!dissector) {
+ if (!dissector)
return 0;
- }
col_set_str(pinfo->cinfo, COL_PROTOCOL, "USBHID");
col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s",
- val_to_str(usb_trans_info->setup.request, setup_request_names_vals, "Unknown type %x"),
- is_request ? "Request" : "Response");
+ val_to_str(usb_trans_info->setup.request, setup_request_names_vals, "Unknown type %x"),
+ is_request ? "Request" : "Response");
if (is_request) {
proto_tree_add_item(tree, hf_usb_hid_request, tvb, offset, 1, ENC_LITTLE_ENDIAN);
@@ -3415,14 +3410,10 @@ dissect_usb_hid_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
recip = USB_RECIPIENT(usb_trans_info->setup.requesttype);
if (recip == RQT_SETUP_RECIPIENT_INTERFACE) {
- if (type == RQT_SETUP_TYPE_STANDARD) {
- return dissect_usb_hid_control_std_intf(
- tvb, pinfo, tree, usb_conv_info);
- }
- else if (type == RQT_SETUP_TYPE_CLASS) {
- return dissect_usb_hid_control_class_intf(
- tvb, pinfo, tree, usb_conv_info);
- }
+ if (type == RQT_SETUP_TYPE_STANDARD)
+ return dissect_usb_hid_control_std_intf(tvb, pinfo, tree, usb_conv_info);
+ else if (type == RQT_SETUP_TYPE_CLASS)
+ return dissect_usb_hid_control_class_intf(tvb, pinfo, tree, usb_conv_info);
}
return 0;
@@ -3448,25 +3439,19 @@ dissect_usb_hid_class_descriptors(tvbuff_t *tvb, packet_info *pinfo _U_,
desc_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_usb_hid_descriptor, &ti, "HID DESCRIPTOR");
- dissect_usb_descriptor_header(desc_tree, tvb, offset,
- &hid_descriptor_type_vals_ext);
+ dissect_usb_descriptor_header(desc_tree, tvb, offset, &hid_descriptor_type_vals_ext);
offset += 2;
- proto_tree_add_item(desc_tree, hf_usb_hid_bcdHID,
- tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ proto_tree_add_item(desc_tree, hf_usb_hid_bcdHID, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
- proto_tree_add_item(desc_tree, hf_usb_hid_bCountryCode,
- tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ proto_tree_add_item(desc_tree, hf_usb_hid_bCountryCode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
num_desc = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(desc_tree, hf_usb_hid_bNumDescriptors,
- tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ proto_tree_add_item(desc_tree, hf_usb_hid_bNumDescriptors, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
for (i=0;i<num_desc;i++) {
- proto_tree_add_item(desc_tree, hf_usb_hid_bDescriptorType,
- tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ proto_tree_add_item(desc_tree, hf_usb_hid_bDescriptorType, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
- proto_tree_add_item(desc_tree, hf_usb_hid_wDescriptorLength,
- tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ proto_tree_add_item(desc_tree, hf_usb_hid_wDescriptorLength, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
}
@@ -3682,238 +3667,202 @@ proto_register_usb_hid(void)
/* USB HID specific requests */
{ &hf_usb_hid_request,
- { "bRequest", "usbhid.setup.bRequest", FT_UINT8, BASE_HEX, VALS(setup_request_names_vals), 0x0,
- NULL, HFILL }},
+ { "bRequest", "usbhid.setup.bRequest", FT_UINT8, BASE_HEX,
+ VALS(setup_request_names_vals), 0x0, NULL, HFILL }},
{ &hf_usb_hid_value,
- { "wValue", "usbhid.setup.wValue", FT_UINT16, BASE_HEX, NULL, 0x0,
- NULL, HFILL }},
+ { "wValue", "usbhid.setup.wValue", FT_UINT16, BASE_HEX,
+ NULL, 0x0, NULL, HFILL }},
{ &hf_usb_hid_index,
- { "wIndex", "usbhid.setup.wIndex", FT_UINT16, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
+ { "wIndex", "usbhid.setup.wIndex", FT_UINT16, BASE_DEC,
+ NULL, 0x0, NULL, HFILL }},
{ &hf_usb_hid_length,
- { "wLength", "usbhid.setup.wLength", FT_UINT16, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
+ { "wLength", "usbhid.setup.wLength", FT_UINT16, BASE_DEC,
+ NULL, 0x0, NULL, HFILL }},
{ &hf_usb_hid_report_type,
- { "ReportType", "usbhid.setup.ReportType", FT_UINT8, BASE_DEC,
- VALS(usb_hid_report_type_vals), 0x0,
- NULL, HFILL }},
+ { "ReportType", "usbhid.setup.ReportType", FT_UINT8, BASE_DEC,
+ VALS(usb_hid_report_type_vals), 0x0, NULL, HFILL }},
{ &hf_usb_hid_report_id,
- { "ReportID", "usbhid.setup.ReportID", FT_UINT8, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
+ { "ReportID", "usbhid.setup.ReportID", FT_UINT8, BASE_DEC,
+ NULL, 0x0, NULL, HFILL }},
{ &hf_usb_hid_duration,
- { "Duration", "usbhid.setup.Duration", FT_UINT8, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
+ { "Duration", "usbhid.setup.Duration", FT_UINT8, BASE_DEC,
+ NULL, 0x0, NULL, HFILL }},
{ &hf_usb_hid_zero,
- { "(zero)", "usbhid.setup.zero", FT_UINT8, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
+ { "(zero)", "usbhid.setup.zero", FT_UINT8, BASE_DEC,
+ NULL, 0x0, NULL, HFILL }},
/* components of the HID descriptor */
{ &hf_usb_hid_bcdHID,
- { "bcdHID", "usbhid.descriptor.hid.bcdHID", FT_UINT16, BASE_HEX, NULL, 0x0,
- NULL, HFILL }},
+ { "bcdHID", "usbhid.descriptor.hid.bcdHID", FT_UINT16, BASE_HEX,
+ NULL, 0x0, NULL, HFILL }},
{ &hf_usb_hid_bCountryCode,
- { "bCountryCode", "usbhid.descriptor.hid.bCountryCode", FT_UINT8,
- BASE_HEX, VALS(hid_country_code_vals), 0x0, NULL, HFILL }},
+ { "bCountryCode", "usbhid.descriptor.hid.bCountryCode", FT_UINT8, BASE_HEX,
+ VALS(hid_country_code_vals), 0x0, NULL, HFILL }},
{ &hf_usb_hid_bNumDescriptors,
- { "bNumDescriptors", "usbhid.descriptor.hid.bNumDescriptors", FT_UINT8,
- BASE_DEC, NULL, 0x0, NULL, HFILL }},
+ { "bNumDescriptors", "usbhid.descriptor.hid.bNumDescriptors", FT_UINT8, BASE_DEC,
+ NULL, 0x0, NULL, HFILL }},
{ &hf_usb_hid_bDescriptorIndex,
- { "bDescriptorIndex", "usbhid.descriptor.hid.bDescriptorIndex", FT_UINT8,
- BASE_HEX, NULL, 0x0, NULL, HFILL }},
+ { "bDescriptorIndex", "usbhid.descriptor.hid.bDescriptorIndex", FT_UINT8, BASE_HEX,
+ NULL, 0x0, NULL, HFILL }},
{ &hf_usb_hid_bDescriptorType,
- { "bDescriptorType", "usbhid.descriptor.hid.bDescriptorType", FT_UINT8,
- BASE_HEX|BASE_EXT_STRING, &hid_descriptor_type_vals_ext,
- 0x00, NULL, HFILL }},
+ { "bDescriptorType", "usbhid.descriptor.hid.bDescriptorType", FT_UINT8, BASE_HEX|BASE_EXT_STRING,
+ &hid_descriptor_type_vals_ext, 0x00, NULL, HFILL }},
{ &hf_usb_hid_wInterfaceNumber,
- { "wInterfaceNumber", "usbhid.descriptor.hid.wInterfaceNumber", FT_UINT16,
- BASE_DEC, NULL, 0x0, NULL, HFILL }},
+ { "wInterfaceNumber", "usbhid.descriptor.hid.wInterfaceNumber", FT_UINT16, BASE_DEC,
+ NULL, 0x0, NULL, HFILL }},
{ &hf_usb_hid_wDescriptorLength,
- { "wDescriptorLength", "usbhid.descriptor.hid.wDescriptorLength", FT_UINT16,
- BASE_DEC, NULL, 0x0, NULL, HFILL }},
+ { "wDescriptorLength", "usbhid.descriptor.hid.wDescriptorLength", FT_UINT16, BASE_DEC,
+ NULL, 0x0, NULL, HFILL }},
{ &hf_usbhid_boot_report_keyboard_reserved,
- { "Reserved", "usbhid.boot_report.keyboard.reserved",
- FT_UINT8, BASE_HEX, NULL, 0x00,
- NULL, HFILL }
- },
+ { "Reserved", "usbhid.boot_report.keyboard.reserved", FT_UINT8, BASE_HEX,
+ NULL, 0x00, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_keyboard_keycode_1,
- { "Keycode 1", "usbhid.boot_report.keyboard.keycode_1",
- FT_UINT8, BASE_HEX|BASE_EXT_STRING, &keycode_vals_ext, 0x00,
- NULL, HFILL }
- },
+ { "Keycode 1", "usbhid.boot_report.keyboard.keycode_1", FT_UINT8, BASE_HEX|BASE_EXT_STRING,
+ &keycode_vals_ext, 0x00, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_keyboard_keycode_2,
- { "Keycode 2", "usbhid.boot_report.keyboard.keycode_2",
- FT_UINT8, BASE_HEX|BASE_EXT_STRING, &keycode_vals_ext, 0x00,
- NULL, HFILL }
- },
+ { "Keycode 2", "usbhid.boot_report.keyboard.keycode_2", FT_UINT8, BASE_HEX|BASE_EXT_STRING,
+ &keycode_vals_ext, 0x00, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_keyboard_keycode_3,
- { "Keycode 3", "usbhid.boot_report.keyboard.keycode_3",
- FT_UINT8, BASE_HEX|BASE_EXT_STRING, &keycode_vals_ext, 0x00,
- NULL, HFILL }
- },
+ { "Keycode 3", "usbhid.boot_report.keyboard.keycode_3", FT_UINT8, BASE_HEX|BASE_EXT_STRING,
+ &keycode_vals_ext, 0x00, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_keyboard_keycode_4,
- { "Keycode 4", "usbhid.boot_report.keyboard.keycode_4",
- FT_UINT8, BASE_HEX|BASE_EXT_STRING, &keycode_vals_ext, 0x00,
- NULL, HFILL }
- },
+ { "Keycode 4", "usbhid.boot_report.keyboard.keycode_4", FT_UINT8, BASE_HEX|BASE_EXT_STRING,
+ &keycode_vals_ext, 0x00, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_keyboard_keycode_5,
- { "Keycode 5", "usbhid.boot_report.keyboard.keycode_5",
- FT_UINT8, BASE_HEX|BASE_EXT_STRING, &keycode_vals_ext, 0x00,
- NULL, HFILL }
- },
+ { "Keycode 5", "usbhid.boot_report.keyboard.keycode_5", FT_UINT8, BASE_HEX|BASE_EXT_STRING,
+ &keycode_vals_ext, 0x00, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_keyboard_keycode_6,
- { "Keycode 6", "usbhid.boot_report.keyboard.keycode_6",
- FT_UINT8, BASE_HEX|BASE_EXT_STRING, &keycode_vals_ext, 0x00,
- NULL, HFILL }
- },
+ { "Keycode 6", "usbhid.boot_report.keyboard.keycode_6", FT_UINT8, BASE_HEX|BASE_EXT_STRING,
+ &keycode_vals_ext, 0x00, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_keyboard_modifier_right_gui,
- { "Modifier: RIGHT GUI", "usbhid.boot_report.keyboard.modifier.right_gui",
- FT_BOOLEAN, 8, NULL, 0x80,
- NULL, HFILL }
- },
+ { "Modifier: RIGHT GUI", "usbhid.boot_report.keyboard.modifier.right_gui", FT_BOOLEAN, 8,
+ NULL, 0x80, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_keyboard_modifier_right_alt,
- { "Modifier: RIGHT ALT", "usbhid.boot_report.keyboard.modifier.right_alt",
- FT_BOOLEAN, 8, NULL, 0x40,
- NULL, HFILL }
- },
+ { "Modifier: RIGHT ALT", "usbhid.boot_report.keyboard.modifier.right_alt", FT_BOOLEAN, 8,
+ NULL, 0x40, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_keyboard_modifier_right_shift,
- { "Modifier: RIGHT SHIFT", "usbhid.boot_report.keyboard.modifier.right_shift",
- FT_BOOLEAN, 8, NULL, 0x20,
- NULL, HFILL }
- },
+ { "Modifier: RIGHT SHIFT", "usbhid.boot_report.keyboard.modifier.right_shift", FT_BOOLEAN, 8,
+ NULL, 0x20, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_keyboard_modifier_right_ctrl,
- { "Modifier: RIGHT CTRL", "usbhid.boot_report.keyboard.modifier.right_ctrl",
- FT_BOOLEAN, 8, NULL, 0x10,
- NULL, HFILL }
- },
+ { "Modifier: RIGHT CTRL", "usbhid.boot_report.keyboard.modifier.right_ctrl", FT_BOOLEAN, 8,
+ NULL, 0x10,NULL, HFILL }},
+
{ &hf_usbhid_boot_report_keyboard_modifier_left_gui,
- { "Modifier: LEFT GUI", "usbhid.boot_report.keyboard.modifier.left_gui",
- FT_BOOLEAN, 8, NULL, 0x08,
- NULL, HFILL }
- },
+ { "Modifier: LEFT GUI", "usbhid.boot_report.keyboard.modifier.left_gui", FT_BOOLEAN, 8,
+ NULL, 0x08, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_keyboard_modifier_left_alt,
- { "Modifier: LEFT ALT", "usbhid.boot_report.keyboard.modifier.left_alt",
- FT_BOOLEAN, 8, NULL, 0x04,
- NULL, HFILL }
+ { "Modifier: LEFT ALT", "usbhid.boot_report.keyboard.modifier.left_alt", FT_BOOLEAN, 8,
+ NULL, 0x04, NULL, HFILL }
},
+
{ &hf_usbhid_boot_report_keyboard_modifier_left_shift,
- { "Modifier: LEFT SHIFT", "usbhid.boot_report.keyboard.modifier.left_shift",
- FT_BOOLEAN, 8, NULL, 0x02,
- NULL, HFILL }
- },
+ { "Modifier: LEFT SHIFT", "usbhid.boot_report.keyboard.modifier.left_shift", FT_BOOLEAN, 8,
+ NULL, 0x02, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_keyboard_modifier_left_ctrl,
- { "Modifier: LEFT CTRL", "usbhid.boot_report.keyboard.modifier.left_ctrl",
- FT_BOOLEAN, 8, NULL, 0x01,
- NULL, HFILL }
- },
+ { "Modifier: LEFT CTRL", "usbhid.boot_report.keyboard.modifier.left_ctrl", FT_BOOLEAN, 8,
+ NULL, 0x01, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_keyboard_leds_constants,
- { "Constants", "usbhid.boot_report.keyboard.leds.constants",
- FT_UINT8, BASE_HEX, NULL, 0xE0,
- NULL, HFILL }
- },
+ { "Constants", "usbhid.boot_report.keyboard.leds.constants", FT_UINT8, BASE_HEX,
+ NULL, 0xE0, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_keyboard_leds_kana,
- { "KANA", "usbhid.boot_report.keyboard.leds.kana",
- FT_BOOLEAN, 8, NULL, 0x10,
- NULL, HFILL }
- },
+ { "KANA", "usbhid.boot_report.keyboard.leds.kana", FT_BOOLEAN, 8,
+ NULL, 0x10, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_keyboard_leds_compose,
- { "COMPOSE", "usbhid.boot_report.keyboard.leds.compose",
- FT_BOOLEAN, 8, NULL, 0x08,
- NULL, HFILL }
- },
+ { "COMPOSE", "usbhid.boot_report.keyboard.leds.compose", FT_BOOLEAN, 8,
+ NULL, 0x08, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_keyboard_leds_scroll_lock,
- { "SCROLL LOCK", "usbhid.boot_report.keyboard.leds.scroll_lock",
- FT_BOOLEAN, 8, NULL, 0x04,
- NULL, HFILL }
- },
+ { "SCROLL LOCK", "usbhid.boot_report.keyboard.leds.scroll_lock", FT_BOOLEAN, 8,
+ NULL, 0x04, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_keyboard_leds_caps_lock,
- { "CAPS LOCK", "usbhid.boot_report.keyboard.leds.caps_lock",
- FT_BOOLEAN, 8, NULL, 0x02,
- NULL, HFILL }
- },
+ { "CAPS LOCK", "usbhid.boot_report.keyboard.leds.caps_lock", FT_BOOLEAN, 8,
+ NULL, 0x02,NULL, HFILL }},
+
{ &hf_usbhid_boot_report_keyboard_leds_num_lock,
- { "NUM LOCK", "usbhid.boot_report.keyboard.leds.num_lock",
- FT_BOOLEAN, 8, NULL, 0x01,
- NULL, HFILL }
- },
+ { "NUM LOCK", "usbhid.boot_report.keyboard.leds.num_lock", FT_BOOLEAN, 8,
+ NULL, 0x01, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_mouse_button_8,
- { "Button 8", "usbhid.boot_report.mouse.button.8",
- FT_BOOLEAN, 8, NULL, 0x80,
- NULL, HFILL }
- },
+ { "Button 8", "usbhid.boot_report.mouse.button.8", FT_BOOLEAN, 8,
+ NULL, 0x80, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_mouse_button_7,
- { "Button 7", "usbhid.boot_report.mouse.button.7",
- FT_BOOLEAN, 8, NULL, 0x40,
- NULL, HFILL }
- },
+ { "Button 7", "usbhid.boot_report.mouse.button.7", FT_BOOLEAN, 8,
+ NULL, 0x40, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_mouse_button_6,
- { "Button 6", "usbhid.boot_report.mouse.button.6",
- FT_BOOLEAN, 8, NULL, 0x20,
- NULL, HFILL }
- },
+ { "Button 6", "usbhid.boot_report.mouse.button.6", FT_BOOLEAN, 8,
+ NULL, 0x20, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_mouse_button_5,
- { "Button 5", "usbhid.boot_report.mouse.button.5",
- FT_BOOLEAN, 8, NULL, 0x10,
- NULL, HFILL }
- },
+ { "Button 5", "usbhid.boot_report.mouse.button.5", FT_BOOLEAN, 8,
+ NULL, 0x10, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_mouse_button_4,
- { "Button 4", "usbhid.boot_report.mouse.button.4",
- FT_BOOLEAN, 8, NULL, 0x08,
- NULL, HFILL }
- },
+ { "Button 4", "usbhid.boot_report.mouse.button.4", FT_BOOLEAN, 8,
+ NULL, 0x08, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_mouse_button_middle,
- { "Button Middle", "usbhid.boot_report.mouse.button.middle",
- FT_BOOLEAN, 8, NULL, 0x04,
- NULL, HFILL }
- },
+ { "Button Middle", "usbhid.boot_report.mouse.button.middle", FT_BOOLEAN, 8,
+ NULL, 0x04, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_mouse_button_right,
- { "Button Right", "usbhid.boot_report.mouse.button.right",
- FT_BOOLEAN, 8, NULL, 0x02,
- NULL, HFILL }
- },
+ { "Button Right", "usbhid.boot_report.mouse.button.right", FT_BOOLEAN, 8,
+ NULL, 0x02, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_mouse_button_left,
- { "Button Left", "usbhid.boot_report.mouse.button.left",
- FT_BOOLEAN, 8, NULL, 0x01,
- NULL, HFILL }
- },
+ { "Button Left", "usbhid.boot_report.mouse.button.left", FT_BOOLEAN, 8,
+ NULL, 0x01, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_mouse_x_displacement,
- { "X Displacement", "usbhid.boot_report.mouse.x_displacement",
- FT_INT8, BASE_DEC, NULL, 0x00,
- NULL, HFILL }
- },
+ { "X Displacement", "usbhid.boot_report.mouse.x_displacement", FT_INT8, BASE_DEC,
+ NULL, 0x00, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_mouse_y_displacement,
- { "Y Displacement", "usbhid.boot_report.mouse.y_displacement",
- FT_INT8, BASE_DEC, NULL, 0x00,
- NULL, HFILL }
- },
+ { "Y Displacement", "usbhid.boot_report.mouse.y_displacement", FT_INT8, BASE_DEC,
+ NULL, 0x00, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_mouse_horizontal_scroll_wheel,
- { "Horizontal Scroll Wheel", "usbhid.boot_report.mouse.scroll_wheel.horizontal",
- FT_INT8, BASE_DEC, NULL, 0x00,
- NULL, HFILL }
- },
+ { "Horizontal Scroll Wheel", "usbhid.boot_report.mouse.scroll_wheel.horizontal", FT_INT8, BASE_DEC,
+ NULL, 0x00, NULL, HFILL }},
+
{ &hf_usbhid_boot_report_mouse_vertical_scroll_wheel,
- { "Vertical Scroll Wheel", "usbhid.boot_report.mouse.scroll_wheel.vertical",
- FT_INT8, BASE_DEC, NULL, 0x00,
- NULL, HFILL }
- },
+ { "Vertical Scroll Wheel", "usbhid.boot_report.mouse.scroll_wheel.vertical", FT_INT8, BASE_DEC,
+ NULL, 0x00, NULL, HFILL }},
+
{ &hf_usbhid_data,
- { "Data", "usbhid.data",
- FT_NONE, BASE_NONE, NULL, 0x00,
- NULL, HFILL }
- },
+ { "Data", "usbhid.data", FT_NONE, BASE_NONE,
+ NULL, 0x00, NULL, HFILL }},
};
static gint *usb_hid_subtrees[] = {