diff options
author | Anders Broman <anders.broman@ericsson.com> | 2012-04-27 08:44:36 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2012-04-27 08:44:36 +0000 |
commit | 3b0c9892a07a4b6d9e545c88eeea3e81a3ae7b84 (patch) | |
tree | 5539bceb37f15bb944a712a485bfd5eeb2c80b21 /epan/dissectors/packet-usb.c | |
parent | aec21991ec8fc248a2c66978b37738d9e00768c7 (diff) |
From Steve Magnani:
Add decoding of fields within endpoint descriptor wMaxPacketSize
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7206
svn path=/trunk/; revision=42286
Diffstat (limited to 'epan/dissectors/packet-usb.c')
-rw-r--r-- | epan/dissectors/packet-usb.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/epan/dissectors/packet-usb.c b/epan/dissectors/packet-usb.c index 69b366338a..12e399e545 100644 --- a/epan/dissectors/packet-usb.c +++ b/epan/dissectors/packet-usb.c @@ -118,6 +118,8 @@ static int hf_usb_bEndpointAttributeTransfer = -1; static int hf_usb_bEndpointAttributeSynchonisation = -1; static int hf_usb_bEndpointAttributeBehaviour = -1; static int hf_usb_wMaxPacketSize = -1; +static int hf_usb_wMaxPacketSize_size = -1; +static int hf_usb_wMaxPacketSize_slots = -1; static int hf_usb_bInterval = -1; static int hf_usb_wTotalLength = -1; static int hf_usb_bNumInterfaces = -1; @@ -149,6 +151,7 @@ static gint ett_descriptor_device = -1; static gint ett_configuration_bmAttributes = -1; static gint ett_configuration_bEndpointAddress = -1; static gint ett_endpoint_bmAttributes = -1; +static gint ett_endpoint_wMaxPacketSize = -1; static const int *usb_endpoint_fields[] = { &hf_usb_endpoint_direction, @@ -465,6 +468,14 @@ static const value_string usb_bmAttributes_behaviour_vals[] = { {0,NULL} }; +static const value_string usb_wMaxPacketSize_slots_vals[] = { + {0x00, "1"}, + {0x01, "2"}, + {0x02, "3"}, + {0x03, "Reserved"}, + {0,NULL} +}; + /* from linux/include/asm-generic/errno.h */ #define EPERM 1 /* Operation not permitted */ #define ENOENT 2 /* No such file or directory */ @@ -1129,8 +1140,11 @@ dissect_usb_endpoint_descriptor(packet_info *pinfo, proto_tree *parent_tree, tvb proto_tree *tree=NULL; proto_item *ep_attrib_item=NULL; proto_tree *ep_attrib_tree=NULL; + proto_item *ep_pktsize_item; + proto_tree *ep_pktsize_tree; int old_offset=offset; guint8 endpoint; + guint8 ep_type; guint8 len; if(parent_tree){ @@ -1185,6 +1199,7 @@ dissect_usb_endpoint_descriptor(packet_info *pinfo, proto_tree *parent_tree, tvb } /* bmAttributes */ + ep_type = ENDPOINT_TYPE(tvb_get_guint8(tvb, offset)); if (tree) { ep_attrib_item=proto_tree_add_item(tree, hf_usb_bmAttributes, tvb, offset, 1, ENC_LITTLE_ENDIAN); ep_attrib_tree=proto_item_add_subtree(ep_attrib_item, ett_endpoint_bmAttributes); @@ -1197,7 +1212,12 @@ dissect_usb_endpoint_descriptor(packet_info *pinfo, proto_tree *parent_tree, tvb offset++; /* wMaxPacketSize */ - proto_tree_add_item(tree, hf_usb_wMaxPacketSize, tvb, offset, 2, ENC_LITTLE_ENDIAN); + ep_pktsize_item = proto_tree_add_item(tree, hf_usb_wMaxPacketSize, tvb, offset, 2, ENC_LITTLE_ENDIAN); + ep_pktsize_tree = proto_item_add_subtree(ep_pktsize_item, ett_endpoint_wMaxPacketSize); + if ((ep_type == ENDPOINT_TYPE_INTERRUPT) || (ep_type == ENDPOINT_TYPE_ISOCHRONOUS)) { + proto_tree_add_item(ep_pktsize_tree, hf_usb_wMaxPacketSize_slots, tvb, offset, 2, ENC_LITTLE_ENDIAN); + } + proto_tree_add_item(ep_pktsize_tree, hf_usb_wMaxPacketSize_size, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset+=2; /* bInterval */ @@ -2859,6 +2879,14 @@ proto_register_usb(void) { "wMaxPacketSize", "usb.wMaxPacketSize", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_usb_wMaxPacketSize_size, + { "Maximum Packet Size", "usb.wMaxPacketSize.size", FT_UINT16, BASE_DEC, + NULL, 0x3FF, NULL, HFILL }}, + + { &hf_usb_wMaxPacketSize_slots, + { "Transactions per microframe", "usb.wMaxPacketSize.slots", FT_UINT16, BASE_DEC, + VALS(usb_wMaxPacketSize_slots_vals), (3<<11), NULL, HFILL }}, + { &hf_usb_bInterval, { "bInterval", "usb.bInterval", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, @@ -2949,7 +2977,8 @@ proto_register_usb(void) &ett_descriptor_device, &ett_configuration_bmAttributes, &ett_configuration_bEndpointAddress, - &ett_endpoint_bmAttributes + &ett_endpoint_bmAttributes, + &ett_endpoint_wMaxPacketSize }; |