aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2007-03-26 01:41:50 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2007-03-26 01:41:50 +0000
commitf88aa196a04176687633376182caa89f802e152b (patch)
tree70cbda6210d380712d518b8d25c9e873a93dd7ea
parentd3283d23eaa8ef519fe450f7b72deaf9fac2a108 (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. svn path=/trunk/; revision=21197
-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; */
}
}