aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-usb-audio.c
diff options
context:
space:
mode:
authorAlexis La Goutte <alexis.lagoutte@gmail.com>2016-04-21 19:50:22 +0200
committerMichael Mann <mmann78@netscape.net>2016-04-25 20:07:32 +0000
commit4d635bcfe865868f01f49186a48d82c8092ed8d7 (patch)
tree01e7873ac9b3b49ae573c21d3243c1eefc1e6e1d /epan/dissectors/packet-usb-audio.c
parentb133542e8ae08d77de598528b17e92ec31e3b5e2 (diff)
USB Audio: Add Input/Output Terminal
Change-Id: Id71015673d8ad0d40afdf926a3610a7544f4e1b8 Ping-Bug:11858 Reviewed-on: https://code.wireshark.org/review/15045 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-usb-audio.c')
-rw-r--r--epan/dissectors/packet-usb-audio.c178
1 files changed, 178 insertions, 0 deletions
diff --git a/epan/dissectors/packet-usb-audio.c b/epan/dissectors/packet-usb-audio.c
index 242d6c0290..98524ef34f 100644
--- a/epan/dissectors/packet-usb-audio.c
+++ b/epan/dissectors/packet-usb-audio.c
@@ -46,6 +46,18 @@ static int hf_ac_if_hdr_ver = -1;
static int hf_ac_if_hdr_total_len = -1;
static int hf_ac_if_hdr_bInCollection = -1;
static int hf_ac_if_hdr_if_num = -1;
+static int hf_ac_if_input_terminalid = -1;
+static int hf_ac_if_input_terminaltype = -1;
+static int hf_ac_if_input_assocterminal = -1;
+static int hf_ac_if_input_nrchannels = -1;
+static int hf_ac_if_input_channelconfig = -1;
+static int hf_ac_if_input_channelnames = -1;
+static int hf_ac_if_input_terminal = -1;
+static int hf_ac_if_output_terminalid = -1;
+static int hf_ac_if_output_terminaltype = -1;
+static int hf_ac_if_output_assocterminal = -1;
+static int hf_ac_if_output_sourceid = -1;
+static int hf_ac_if_output_terminal = -1;
static int hf_as_if_desc_subtype = -1;
static int hf_as_if_gen_term_id = -1;
static int hf_as_if_gen_delay = -1;
@@ -148,6 +160,75 @@ static const value_string as_subtype_vals[] = {
static value_string_ext as_subtype_vals_ext =
VALUE_STRING_EXT_INIT(as_subtype_vals);
+/* From http://www.usb.org/developers/docs/devclass_docs/termt10.pdf */
+static const value_string terminal_types_vals[] = {
+ /* USB Terminal Types */
+ {0x0100, "USB Undefined"},
+ {0x0101, "USB Streaming"},
+ {0x01FF, "USB vendor specific"},
+ /* Input Terminal Tyoes */
+ {0x0200, "Input Undefined"},
+ {0x0201, "Microphone"},
+ {0x0202, "Desktop Microphone"},
+ {0x0203, "Personal microphone"},
+ {0x0204, "Omni-directional icrophone"},
+ {0x0205, "Microphone array"},
+ {0x0206, "Processing microphone array"},
+ {0x0300, "Output Undefined"},
+ {0x0301, "Speaker"},
+ {0x0302, "Headphones"},
+ {0x0303, "Head Mounted Display Audio"},
+ {0x0304, "Desktop speaker"},
+ {0x0305, "Room speaker"},
+ {0x0306, "Communication speaker"},
+ {0x0307, "Low frequency effects speaker"},
+ /* Bi-directional Terminal Types */
+ {0x0400, "Bi-directional Undefined"},
+ {0x0401, "Handset"},
+ {0x0402, "Headset"},
+ {0x0403, "Speakerphone, no echoreduction"},
+ {0x0404, "Echo-suppressing speakerphone"},
+ {0x0405, "Echo-canceling speakerphone"},
+ /* Telephony Terminal Types */
+ {0x0500, "Telephony Undefined"},
+ {0x0501, "Phone line"},
+ {0x0502, "Telephone"},
+ {0x0503, "Down Line Pone"},
+ /* External Terminal Types */
+ {0x0600, "External Undefined"},
+ {0x0601, "Analog connector"},
+ {0x0602, "Digital audio interface"},
+ {0x0603, "Line connector"},
+ {0x0604, "Legacy audio connector"},
+ {0x0605, "S/PDIF interface"},
+ {0x0606, "1394 DA stream"},
+ {0x0607, "1394 DV stream soudtrack"},
+ /* Embedded Funciton Terminal Types */
+ {0x0700, "Embedded Undefined"},
+ {0x0701, "Level Calibration Noise Source"},
+ {0x0702, "Equalization Noise"},
+ {0x0703, "CD player"},
+ {0x0704, "DAT"},
+ {0x0705, "DCC"},
+ {0x0706, "MiniDisk"},
+ {0x0707, "Analog Tape"},
+ {0x0708, "Phonograph"},
+ {0x0709, "VCR Audio"},
+ {0x070A, "Video Disc Audio"},
+ {0x070B, "DVD Audio"},
+ {0x070C, "TV Tuner Audio"},
+ {0x070D, "Satellite Receiver Audio"},
+ {0x070E, "cable Tuner Audio"},
+ {0x070F, "DSS Audio"},
+ {0x0710, "Radio Receiver"},
+ {0x0711, "Radio Transmitter"},
+ {0x0712, "Multi-track Recorder"},
+ {0x0713, "Synthesizer"},
+ {0,NULL}
+};
+static value_string_ext terminal_types_vals_ext =
+ VALUE_STRING_EXT_INIT(terminal_types_vals);
+
typedef struct _audio_conv_info_t {
/* the major version of the USB audio class specification,
taken from the AC header descriptor */
@@ -360,6 +441,61 @@ dissect_ac_if_hdr_body(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_,
return offset-offset_start;
}
+static gint
+dissect_ac_if_input_terminal(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_,
+ proto_tree *tree, usb_conv_info_t *usb_conv_info _U_)
+{
+ gint offset_start;
+ offset_start = offset;
+
+ proto_tree_add_item(tree, hf_ac_if_input_terminalid, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+
+ proto_tree_add_item(tree, hf_ac_if_input_terminaltype, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ offset += 2;
+
+ proto_tree_add_item(tree, hf_ac_if_input_assocterminal, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+
+ proto_tree_add_item(tree, hf_ac_if_input_nrchannels, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+
+ proto_tree_add_item(tree, hf_ac_if_input_channelconfig, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ offset += 2;
+
+ proto_tree_add_item(tree, hf_ac_if_input_channelnames, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+
+ proto_tree_add_item(tree, hf_ac_if_input_terminal, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+
+ return offset-offset_start;
+}
+
+static gint
+dissect_ac_if_output_terminal(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_,
+ proto_tree *tree, usb_conv_info_t *usb_conv_info _U_)
+{
+ gint offset_start;
+ offset_start = offset;
+
+ proto_tree_add_item(tree, hf_ac_if_output_terminalid, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+
+ proto_tree_add_item(tree, hf_ac_if_output_terminaltype, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ offset += 2;
+
+ proto_tree_add_item(tree, hf_ac_if_output_assocterminal, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+
+ proto_tree_add_item(tree, hf_ac_if_output_sourceid, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+
+ proto_tree_add_item(tree, hf_ac_if_output_terminal, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+
+ return offset-offset_start;
+}
static gint
dissect_as_if_general_body(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_,
@@ -517,6 +653,12 @@ dissect_usb_audio_descriptor(tvbuff_t *tvb, packet_info *pinfo,
we rely on the descriptor's length byte instead */
dissect_ac_if_hdr_body(tvb, offset, pinfo, desc_tree, usb_conv_info);
break;
+ case AC_SUBTYPE_INPUT_TERMINAL:
+ dissect_ac_if_input_terminal(tvb, offset, pinfo, desc_tree, usb_conv_info);
+ break;
+ case AC_SUBTYPE_OUTPUT_TERMINAL:
+ dissect_ac_if_output_terminal(tvb, offset, pinfo, desc_tree, usb_conv_info);
+ break;
default:
proto_tree_add_expert(desc_tree, pinfo, &ei_usb_audio_undecoded, tvb, offset-3, desc_len);
break;
@@ -661,6 +803,42 @@ proto_register_usb_audio(void)
{ &hf_ac_if_hdr_if_num,
{ "Interface number", "usbaudio.ac_if_hdr.baInterfaceNr",
FT_UINT8, BASE_DEC, NULL, 0x00, "baInterfaceNr", HFILL }},
+ { &hf_ac_if_input_terminalid,
+ { "Terminal ID", "usbaudio.ac_if_input.bTerminalID",
+ FT_UINT8, BASE_DEC, NULL, 0x00, "bTerminalID", HFILL }},
+ { &hf_ac_if_input_terminaltype,
+ { "Terminal Type", "usbaudio.ac_if_input.wTerminalType", FT_UINT16,
+ BASE_HEX|BASE_EXT_STRING, &terminal_types_vals_ext, 0x00, "wTerminalType", HFILL }},
+ { &hf_ac_if_input_assocterminal,
+ { "Assoc Terminal", "usbaudio.ac_if_input.bAssocTerminal",
+ FT_UINT8, BASE_DEC, NULL, 0x00, "bAssocTerminal", HFILL }},
+ { &hf_ac_if_input_nrchannels,
+ { "Number Channels", "usbaudio.ac_if_input.bNrChannels",
+ FT_UINT8, BASE_DEC, NULL, 0x00, "bNrChannels", HFILL }},
+ { &hf_ac_if_input_channelconfig,
+ { "Channel Config", "usbaudio.ac_if_input.wChannelConfig",
+ FT_UINT16, BASE_HEX, NULL, 0x00, "wChannelConfig", HFILL }},
+ { &hf_ac_if_input_channelnames,
+ { "Channel Names", "usbaudio.ac_if_input.iChannelNames",
+ FT_UINT8, BASE_DEC, NULL, 0x00, "iChannelNames", HFILL }},
+ { &hf_ac_if_input_terminal,
+ { "Terminal", "usbaudio.ac_if_input.iTerminal",
+ FT_UINT8, BASE_DEC, NULL, 0x00, "iTerminal", HFILL }},
+ { &hf_ac_if_output_terminalid,
+ { "Terminal ID", "usbaudio.ac_if_output.bTerminalID",
+ FT_UINT8, BASE_DEC, NULL, 0x00, "bTerminalID", HFILL }},
+ { &hf_ac_if_output_terminaltype,
+ { "Terminal Type", "usbaudio.ac_if_output.wTerminalType", FT_UINT16,
+ BASE_HEX|BASE_EXT_STRING, &terminal_types_vals_ext, 0x00, "wTerminalType", HFILL }},
+ { &hf_ac_if_output_assocterminal,
+ { "Assoc Terminal", "usbaudio.ac_if_output.bAssocTerminal",
+ FT_UINT8, BASE_DEC, NULL, 0x00, "bAssocTerminal", HFILL }},
+ { &hf_ac_if_output_sourceid,
+ { "Source ID", "usbaudio.ac_if_output.bSourceID",
+ FT_UINT8, BASE_DEC, NULL, 0x00, "bSourceID", HFILL }},
+ { &hf_ac_if_output_terminal,
+ { "Terminal", "usbaudio.ac_if_output.iTerminal",
+ FT_UINT8, BASE_DEC, NULL, 0x00, "iTerminal", HFILL }},
{ &hf_as_if_desc_subtype,
{ "Subtype", "usbaudio.as_if_subtype", FT_UINT8, BASE_HEX|BASE_EXT_STRING,
&as_subtype_vals_ext, 0x00, "bDescriptorSubtype", HFILL }},