aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-usb.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2008-12-18 09:17:16 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2008-12-18 09:17:16 +0000
commit90c05771caa0f5ead81fd6ec70cdad369f95edc6 (patch)
treefce8bfae59cb29194fc533cd754dd7fdb7727531 /epan/dissectors/packet-usb.c
parentaccaa7d0bfe2095a4830518b8746aab8eb670225 (diff)
The "8 mysterious bytes" are bytes reserved for a setup header - with
the Linux USB capture mechanism, there are always 8 bytes of setup header after the URB, regardless of whether there's a setup header or not; if there is no setup header, we just skip those 8 bytes. Don't skip them *twice*, however. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27046 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-usb.c')
-rw-r--r--epan/dissectors/packet-usb.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/epan/dissectors/packet-usb.c b/epan/dissectors/packet-usb.c
index 2b415d594c..e46eb4cdc5 100644
--- a/epan/dissectors/packet-usb.c
+++ b/epan/dissectors/packet-usb.c
@@ -1792,25 +1792,6 @@ dissect_linux_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent)
}
}
- /* For DLT189 it seems
- * that all INTERRUPT or BULK packets as well as all CONTROL responses
- * are prepended with 8 mysterious bytes.
- */
- switch(type){
- case URB_CONTROL:
- if(pinfo->pseudo_header->linux_usb.event_type!=URB_SUBMIT){
- offset+=8;
- }
- break;
- case URB_BULK:
- case URB_ISOCHRONOUS:
- case URB_INTERRUPT:
- offset+=8;
- break;
- default:
- DISSECTOR_ASSERT_NOT_REACHED();
- }
-
tap_data=ep_alloc(sizeof(usb_tap_data_t));
tap_data->urb_type=(guint8)pinfo->pseudo_header->linux_usb.event_type;
tap_data->transfer_type=(guint8)type;
@@ -1826,6 +1807,10 @@ dissect_linux_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent)
item=proto_tree_add_uint(tree, hf_usb_bInterfaceClass, tvb, 0, 0, usb_conv_info->interfaceClass);
PROTO_ITEM_SET_GENERATED(item);
+
+ /* Skip setup header - it's never present */
+ offset += 8;
+
if(tvb_reported_length_remaining(tvb, offset)){
tvbuff_t *next_tvb;
@@ -1853,6 +1838,9 @@ dissect_linux_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent)
tvbuff_t *next_tvb;
/* this is a request */
+
+ /* Dissect the setup header - it's present */
+
ti = proto_tree_add_protocol_format(tree, proto_usb, tvb, offset, sizeof(struct usb_device_setup_hdr), "URB setup");
setup_tree = proto_item_add_subtree(ti, usb_setup_hdr);
usb_trans_info->requesttype=tvb_get_guint8(tvb, offset);
@@ -1911,12 +1899,18 @@ dissect_linux_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent)
break;
}
} else {
+ /* Skip setup header - it's not present */
+
offset += 8;
}
} else {
tvbuff_t *next_tvb;
/* this is a response */
+
+ /* Skip setup header - it's never present for responses */
+ offset += 8;
+
if(usb_trans_info){
/* Try to find a class specific dissector */
next_tvb=tvb_new_subset(tvb, offset, -1, -1);
@@ -1973,6 +1967,8 @@ dissect_linux_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent)
guint8 requesttype, request;
int type;
+ /* Dissect the setup header - it's present */
+
ti = proto_tree_add_protocol_format(tree, proto_usb, tvb, offset, sizeof(struct usb_device_setup_hdr), "URB setup");
setup_tree = proto_item_add_subtree(ti, usb_setup_hdr);
@@ -1991,6 +1987,8 @@ dissect_linux_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent)
proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, TRUE);
offset += 2;
} else {
+ /* Skip setup header - it's not present */
+
offset += 8;
}
break;