aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-usb-audio.c
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2013-09-02 15:39:16 +0000
committerMartin Kaiser <wireshark@kaiser.cx>2013-09-02 15:39:16 +0000
commitc5488abfe7d883210109cf9142d623e6b11641a5 (patch)
tree3b2909ccf7ec764c386f939fd8b83d2f4b791703 /epan/dissectors/packet-usb-audio.c
parent6585c8e9c0700c057340454d1a3e359328f5acb5 (diff)
dissect len and type for audio class descriptors
svn path=/trunk/; revision=51646
Diffstat (limited to 'epan/dissectors/packet-usb-audio.c')
-rw-r--r--epan/dissectors/packet-usb-audio.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/epan/dissectors/packet-usb-audio.c b/epan/dissectors/packet-usb-audio.c
index 09b0f08fbb..a25da141d0 100644
--- a/epan/dissectors/packet-usb-audio.c
+++ b/epan/dissectors/packet-usb-audio.c
@@ -37,7 +37,8 @@ static int hf_midi_event = -1;
static reassembly_table midi_data_reassembly_table;
-static gint ett_usb_audio = -1;
+static gint ett_usb_audio = -1;
+static gint ett_usb_audio_desc = -1;
static dissector_handle_t sysex_handle;
@@ -78,6 +79,13 @@ static const value_string code_index_vals[] = {
#define CS_INTERFACE 0x24
#define CS_ENDPOINT 0x25
+static const value_string aud_descriptor_type_vals[] = {
+ {CS_INTERFACE, "audio class interface"},
+ {CS_ENDPOINT, "audio class endpoint"},
+ {0,NULL}
+};
+static value_string_ext aud_descriptor_type_vals_ext =
+ VALUE_STRING_EXT_INIT(aud_descriptor_type_vals);
static int hf_sysex_msg_fragments = -1;
static int hf_sysex_msg_fragment = -1;
@@ -235,24 +243,31 @@ static gint
dissect_usb_audio_descriptor(tvbuff_t *tvb, packet_info *pinfo _U_,
proto_tree *tree, void *data _U_)
{
- gint offset = 0;
- guint8 descriptor_len;
- guint8 descriptor_type;
+ gint offset = 0;
+ guint8 descriptor_len;
+ guint8 descriptor_type;
+ proto_item *item = NULL;
+ proto_tree *desc_tree;
descriptor_len = tvb_get_guint8(tvb, offset);
descriptor_type = tvb_get_guint8(tvb, offset+1);
if (descriptor_type == CS_INTERFACE) {
- proto_tree_add_text(tree, tvb, offset, descriptor_len,
+ item = proto_tree_add_text(tree, tvb, offset, descriptor_len,
"AUDIO CONTROL INTERFACE DESCRIPTOR");
}
else if (descriptor_type == CS_ENDPOINT) {
- proto_tree_add_text(tree, tvb, offset, descriptor_len,
+ item = proto_tree_add_text(tree, tvb, offset, descriptor_len,
"AUDIO CONTROL ENDPOINT DESCRIPTOR");
}
else
return 0;
+ desc_tree = proto_item_add_subtree(item, ett_usb_audio_desc);
+
+ dissect_usb_descriptor_header(desc_tree, tvb, offset,
+ &aud_descriptor_type_vals_ext);
+
return descriptor_len;
}
@@ -356,6 +371,7 @@ proto_register_usb_audio(void)
static gint *usb_audio_subtrees[] = {
&ett_usb_audio,
+ &ett_usb_audio_desc,
&ett_sysex_msg_fragment,
&ett_sysex_msg_fragments
};