aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-usb.c
diff options
context:
space:
mode:
authorsahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>2007-03-26 01:41:50 +0000
committersahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>2007-03-26 01:41:50 +0000
commitf5edd47638a3bc4c258fcdd4d31af83081e811af (patch)
tree70cbda6210d380712d518b8d25c9e873a93dd7ea /epan/dissectors/packet-usb.c
parent996c4bd0f0219f43c76193579f342b36d0f8b424 (diff)
From
Charles Lepple This patch enables packet-usb.c to display all descriptors in the GET CONFIGURATION request, regardless of whether we know how to decode them. (All descriptors in that request share the same first two bytes.) It also adds the HID descriptor type (not the report descriptor, though - that is buried in a class request, not a device request). I am still working on actually decoding this descriptor. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@21197 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-usb.c')
-rw-r--r--epan/dissectors/packet-usb.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/epan/dissectors/packet-usb.c b/epan/dissectors/packet-usb.c
index cf57c80700..cd5ef77b3f 100644
--- a/epan/dissectors/packet-usb.c
+++ b/epan/dissectors/packet-usb.c
@@ -171,6 +171,7 @@ static const value_string usb_urb_type_vals[] = {
#define USB_DT_DEVICE_QUALIFIER 6
#define USB_DT_OTHER_SPEED_CONFIGURATION 7
#define USB_DT_INTERFACE_POWER 8
+#define USB_DT_HID 0x21
static const value_string descriptor_type_vals[] = {
{USB_DT_DEVICE, "DEVICE"},
{USB_DT_CONFIGURATION, "CONFIGURATION"},
@@ -180,6 +181,7 @@ static const value_string descriptor_type_vals[] = {
{USB_DT_DEVICE_QUALIFIER, "DEVICE_QUALIFIER"},
{USB_DT_OTHER_SPEED_CONFIGURATION, "OTHER_SPEED_CONFIGURATION"},
{USB_DT_INTERFACE_POWER, "INTERFACE_POWER"},
+ {USB_DT_HID, "HID"},
{0,NULL}
};
@@ -611,6 +613,37 @@ dissect_usb_endpoint_descriptor(packet_info *pinfo, proto_tree *parent_tree, tvb
return offset;
}
+static int
+dissect_usb_unknown_descriptor(packet_info *pinfo _U_, proto_tree *parent_tree, tvbuff_t *tvb, int offset, usb_trans_info_t *usb_trans_info _U_, usb_conv_info_t *usb_conv_info _U_)
+{
+ proto_item *item=NULL;
+ proto_tree *tree=NULL;
+ int old_offset=offset;
+ guint8 bLength;
+
+ if(parent_tree){
+ item=proto_tree_add_text(parent_tree, tvb, offset, 0, "UNKNOWN DESCRIPTOR");
+ tree=proto_item_add_subtree(item, ett_descriptor_device);
+ }
+
+ /* bLength */
+ proto_tree_add_item(tree, hf_usb_bLength, tvb, offset, 1, TRUE);
+ bLength = tvb_get_guint8(tvb, offset);
+ offset++;
+
+ /* bDescriptorType */
+ proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset, 1, TRUE);
+ offset++;
+
+ offset += bLength - 2;
+
+ if(item){
+ proto_item_set_len(item, offset-old_offset);
+ }
+
+ return offset;
+}
+
/* 9.6.3 */
static const true_false_string tfs_mustbeone = {
"Must be 1 for USB 1.1 and higher",
@@ -707,7 +740,9 @@ dissect_usb_configuration_descriptor(packet_info *pinfo _U_, proto_tree *parent_
offset=dissect_usb_endpoint_descriptor(pinfo, parent_tree, tvb, offset, usb_trans_info, usb_conv_info);
break;
default:
- return offset;
+ offset=dissect_usb_unknown_descriptor(pinfo, parent_tree, tvb, offset, usb_trans_info, usb_conv_info);
+ break;
+ /* was: return offset; */
}
}