From edf1436360a228abe428c7fc9690f001bcffac72 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Sun, 18 Aug 2013 02:32:23 +0000 Subject: Bluetooth: HCI: Synchronize and update Voice command. Bug 9050 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9050) From Michal Labedzki. svn path=/trunk/; revision=51411 --- epan/dissectors/packet-bluetooth-hci.h | 4 ++ epan/dissectors/packet-bthci_cmd.c | 24 +++++++++--- epan/dissectors/packet-bthci_evt.c | 71 +++++++++++++++++----------------- 3 files changed, 59 insertions(+), 40 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-bluetooth-hci.h b/epan/dissectors/packet-bluetooth-hci.h index f739ee8af2..a7671fedd0 100644 --- a/epan/dissectors/packet-bluetooth-hci.h +++ b/epan/dissectors/packet-bluetooth-hci.h @@ -54,6 +54,10 @@ extern value_string_ext bthci_cmd_ocf_status_vals_ext; extern value_string_ext bthci_cmd_ocf_testing_vals_ext; extern value_string_ext bthci_cmd_ocf_low_energy_vals_ext; +extern value_string_ext bthci_cmd_input_coding_vals_ext; +extern value_string_ext bthci_cmd_input_data_format_vals_ext; +extern value_string_ext bthci_cmd_input_sample_size_vals_ext; +extern value_string_ext bthci_cmd_air_coding_format_vals_ext; extern value_string_ext bthci_cmd_status_vals_ext; extern value_string_ext bthci_cmd_service_class_type_vals_ext; extern value_string_ext bthci_cmd_eir_data_type_vals_ext; diff --git a/epan/dissectors/packet-bthci_cmd.c b/epan/dissectors/packet-bthci_cmd.c index d0eac5d6a2..8e3c48ec21 100644 --- a/epan/dissectors/packet-bthci_cmd.c +++ b/epan/dissectors/packet-bthci_cmd.c @@ -162,6 +162,7 @@ static int hf_bthci_cmd_auto_acc_flag = -1; static int hf_bthci_cmd_read_all_flag = -1; static int hf_bthci_cmd_delete_all_flag = -1; static int hf_bthci_cmd_authentication_enable = -1; +static int hf_bthci_cmd_input_unused = -1; static int hf_bthci_cmd_input_coding = -1; static int hf_bthci_cmd_input_data_format = -1; static int hf_bthci_cmd_input_sample_size = -1; @@ -1217,19 +1218,23 @@ static const value_string cmd_input_coding_values[] = { {0x2, "A-law" }, {0, NULL } }; +value_string_ext bthci_cmd_input_coding_vals_ext = VALUE_STRING_EXT_INIT(cmd_input_coding_values); static const value_string cmd_input_data_format_values[] = { {0x0, "1's complement" }, {0x1, "2's complement" }, {0x2, "Sign-Magnitude" }, + {0x3, "Unsigned" }, {0, NULL } }; +value_string_ext bthci_cmd_input_data_format_vals_ext = VALUE_STRING_EXT_INIT(cmd_input_data_format_values); static const value_string cmd_input_sample_size_values[] = { {0x0, "8 bit (only for Linear PCM)" }, {0x1, "16 bit (only for Linear PCM)" }, {0, NULL } }; +value_string_ext bthci_cmd_input_sample_size_vals_ext = VALUE_STRING_EXT_INIT(cmd_input_sample_size_values); static const value_string cmd_air_coding_format_values[] = { {0x0, "CVSD" }, @@ -1238,6 +1243,7 @@ static const value_string cmd_air_coding_format_values[] = { {0x3, "Transparent" }, {0, NULL } }; +value_string_ext bthci_cmd_air_coding_format_vals_ext = VALUE_STRING_EXT_INIT(cmd_air_coding_format_values); static const value_string cmd_en_disabled[] = { {0x00, "disabled" }, @@ -2004,6 +2010,7 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr proto_tree_add_item(tree, hf_bthci_cmd_max_latency_ms, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset+=2; + proto_tree_add_item(tree, hf_bthci_cmd_input_unused, tvb, offset, 2, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, hf_bthci_cmd_input_coding, tvb, offset, 2, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, hf_bthci_cmd_input_data_format, tvb, offset, 2, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, hf_bthci_cmd_input_sample_size, tvb, offset, 2, ENC_LITTLE_ENDIAN); @@ -2507,6 +2514,8 @@ dissect_host_controller_baseband_cmd(tvbuff_t *tvb, int offset, packet_info *pin break; case 0x0026: /* Write Voice Setting */ + proto_tree_add_item(tree, hf_bthci_cmd_input_unused, + tvb, offset, 2, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, hf_bthci_cmd_input_coding, tvb, offset, 2, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, hf_bthci_cmd_input_data_format, @@ -3908,28 +3917,33 @@ proto_register_bthci_cmd(void) FT_UINT8, BASE_HEX, VALS(cmd_authentication_enable_values), 0x0, NULL, HFILL } }, + { &hf_bthci_cmd_input_unused, + { "Unused bits", "bthci_cmd.voice.unused", + FT_UINT16, BASE_HEX, NULL, 0xfc00, + NULL, HFILL } + }, { &hf_bthci_cmd_input_coding, - { "Input Coding", "bthci_cmd.input_coding", + { "Input Coding", "bthci_cmd.voice.input_coding", FT_UINT16, BASE_DEC, VALS(cmd_input_coding_values), 0x0300, "Authentication Enable", HFILL } }, { &hf_bthci_cmd_input_data_format, - { "Input Data Format", "bthci_cmd.input_data_format", + { "Input Data Format", "bthci_cmd.voice.input_data_format", FT_UINT16, BASE_DEC, VALS(cmd_input_data_format_values), 0x00c0, NULL, HFILL } }, { &hf_bthci_cmd_input_sample_size, - { "Input Sample Size", "bthci_cmd.input_sample_size", + { "Input Sample Size", "bthci_cmd.voice.input_sample_size", FT_UINT16, BASE_DEC, VALS(cmd_input_sample_size_values), 0x0020, NULL, HFILL } }, { &hf_bthci_cmd_linear_pcm_bit_pos, - { "Linear PCM Bit Pos", "bthci_cmd.lin_pcm_bit_pos", + { "Linear PCM Bit Position", "bthci_cmd.voice.linear_pcm_bit_pos", FT_UINT16, BASE_DEC, NULL, 0x001c, "# bit pos. that MSB of sample is away from starting at MSB", HFILL } }, { &hf_bthci_cmd_air_coding_format, - { "Air Coding Format", "bthci_cmd.air_coding_format", + { "Air Coding Format", "bthci_cmd.voice.air_coding_format", FT_UINT16, BASE_DEC, VALS(cmd_air_coding_format_values), 0x0003, NULL, HFILL } }, diff --git a/epan/dissectors/packet-bthci_evt.c b/epan/dissectors/packet-bthci_evt.c index 3194b59849..18bc144de8 100644 --- a/epan/dissectors/packet-bthci_evt.c +++ b/epan/dissectors/packet-bthci_evt.c @@ -158,9 +158,12 @@ static int hf_bthci_evt_scan_enable = -1; static int hf_bthci_evt_authentication_enable = -1; static int hf_bthci_evt_sco_flow_cont_enable = -1; static int hf_bthci_evt_window = -1; +static int hf_bthci_evt_input_unused = -1; static int hf_bthci_evt_input_coding = -1; static int hf_bthci_evt_input_data_format = -1; static int hf_bthci_evt_input_sample_size = -1; +static int hf_bthci_evt_linear_pcm_bit_pos = -1; +static int hf_bthci_evt_air_coding_format = -1; static int hf_bthci_evt_num_broadcast_retransm = -1; static int hf_bthci_evt_hold_mode_act_page = -1; static int hf_bthci_evt_hold_mode_act_inquiry = -1; @@ -843,26 +846,6 @@ static const value_string evt_enable_values[] = { {0, NULL } }; -static const value_string evt_input_coding_values[] = { - {0x0, "Linear" }, - {0x1, "\xb5-law" }, - {0x2, "A-law" }, - {0, NULL } -}; - -static const value_string evt_input_data_format_values[] = { - {0x0, "1's complement" }, - {0x1, "2's complement" }, - {0x2, "Sign-Magnitude" }, - {0, NULL } -}; - -static const value_string evt_input_sample_size_values[] = { - {0x0, "8 bit (only for Linear PCM)" }, - {0x1, "16 bit (only for Linear PCM)" }, - {0, NULL } -}; - static const value_string evt_loopback_modes[] = { {0x00, "No Loopback mode enabled" }, {0x01, "Enable Local Loopback" }, @@ -876,14 +859,6 @@ static const value_string evt_country_code_values[] = { {0, NULL } }; -static const value_string evt_air_mode_values[] = { - {0x0, "\xb5-law" }, - {0x1, "A-law" }, - {0x2, "CVSD" }, - {0x3, "Transparent" }, - {0, NULL } -}; - static const value_string evt_flow_direction_values[] = { {0x0, "Outgoing Traffic" }, {0x1, "Incoming Traffic" }, @@ -964,6 +939,14 @@ static const value_string evt_master_clock_accuray[] = { { 0, NULL } }; +static const value_string evt_air_mode_vals[] = { + { 0x00, "\xb5-law log" }, + { 0x01, "A-law log" }, + { 0x02, "CVSD" }, + { 0x03, "Transparent Data" }, + { 0, NULL } +}; + void proto_register_bthci_evt(void); void proto_reg_handoff_bthci_evt(void); @@ -2784,9 +2767,12 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset, packet_info *pinfo proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset++; + proto_tree_add_item(tree, hf_bthci_evt_input_unused, tvb, offset, 2, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, hf_bthci_evt_input_coding, tvb, offset, 2, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, hf_bthci_evt_input_data_format, tvb, offset, 2, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, hf_bthci_evt_input_sample_size, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_bthci_evt_linear_pcm_bit_pos, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_bthci_evt_air_coding_format, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset+=2; break; @@ -4873,19 +4859,34 @@ proto_register_bthci_evt(void) FT_UINT16, BASE_DEC, NULL, 0x0, "Window", HFILL } }, + { &hf_bthci_evt_input_unused, + { "Unused bits", "bthci_evt.voice.unused", + FT_UINT16, BASE_HEX, NULL, 0xfc00, + NULL, HFILL } + }, { &hf_bthci_evt_input_coding, - { "Input Coding", "bthci_evt.input_coding", - FT_UINT16, BASE_DEC, VALS(evt_input_coding_values), 0x0300, + { "Input Coding", "bthci_evt.voice.input_coding", + FT_UINT16, BASE_DEC | BASE_EXT_STRING, &bthci_cmd_input_coding_vals_ext, 0x0300, "Authentication Enable", HFILL } }, { &hf_bthci_evt_input_data_format, - { "Input Data Format", "bthci_evt.input_data_format", - FT_UINT16, BASE_DEC, VALS(evt_input_data_format_values), 0x00c0, + { "Input Data Format", "bthci_evt.voice.input_data_format", + FT_UINT16, BASE_DEC | BASE_EXT_STRING, &bthci_cmd_input_data_format_vals_ext, 0x00c0, NULL, HFILL } }, { &hf_bthci_evt_input_sample_size, - { "Input Sample Size", "bthci_evt.input_sample_size", - FT_UINT16, BASE_DEC, VALS(evt_input_sample_size_values), 0x0020, + { "Input Sample Size", "bthci_evt.voice.input_sample_size", + FT_UINT16, BASE_DEC | BASE_EXT_STRING, &bthci_cmd_input_sample_size_vals_ext, 0x0020, + NULL, HFILL } + }, + { &hf_bthci_evt_linear_pcm_bit_pos, + { "Linear PCM Bit Position", "bthci_evt.voice.linear_pcm_bit_pos", + FT_UINT16, BASE_DEC, NULL, 0x001c, + "# bit pos. that MSB of sample is away from starting at MSB", HFILL } + }, + { &hf_bthci_evt_air_coding_format, + { "Air Coding Format", "bthci_evt.voice.air_coding_format", + FT_UINT16, BASE_DEC | BASE_EXT_STRING, &bthci_cmd_air_coding_format_vals_ext, 0x0003, NULL, HFILL } }, { &hf_bthci_evt_num_broadcast_retransm, @@ -5040,7 +5041,7 @@ proto_register_bthci_evt(void) }, { &hf_bthci_evt_air_mode, {"Air Mode", "bthci_evt.air_mode", - FT_UINT8, BASE_DEC, VALS(evt_air_mode_values), 0x0, + FT_UINT8, BASE_DEC, VALS(evt_air_mode_vals), 0x0, NULL, HFILL} }, { &hf_bthci_evt_max_tx_latency, -- cgit v1.2.3