Bluetooth 5.0, HCI command/event PHY update dissection

Dissection of all new HCI command/events related with
Bluetooh 5.0 feature 'PHY update - LE 2M and LE Coded'

Change-Id: I212cb368d3295ba36eb0ca34329df566cae1611b
Signed-off-by: Allan Møller Madsen <almomadk@gmail.com>
Reviewed-on: https://code.wireshark.org/review/19849
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michal Labedzki <michal.tomasz.labedzki@gmail.com>
This commit is contained in:
Allan Møller Madsen 2017-01-29 22:40:42 +01:00 committed by Michal Labedzki
parent 20bce6f63a
commit 275594231d
3 changed files with 262 additions and 4 deletions

View File

@ -290,6 +290,7 @@ static int hf_bthci_cmd_amp_remaining_assoc_length = -1;
static int hf_bthci_cmd_amp_assoc_fragment = -1;
static int hf_bthci_cmd_le_event_mask = -1;
static int hf_bthci_cmd_le_event_mask_le_reserved = -1;
static int hf_bthci_cmd_le_event_mask_le_phy_update_complete = -1;
static int hf_bthci_cmd_le_event_mask_le_direct_advertising_report = -1;
static int hf_bthci_cmd_le_event_mask_le_enhanced_connection_complete = -1;
static int hf_bthci_cmd_le_event_mask_le_generate_dhkey_complete = -1;
@ -363,10 +364,26 @@ static int hf_bthci_cmd_le_adv_data_frag_pref = -1;
static int hf_bthci_cmd_le_adv_en_sets = -1;
static int hf_bthci_cmd_le_adv_duration = -1;
static int hf_bthci_cmd_le_adv_max_extended_events = -1;
static int hf_bthci_cmd_all_phys = -1;
static int hf_bthci_cmd_all_phys_tx_pref = -1;
static int hf_bthci_cmd_all_phys_rx_pref = -1;
static int hf_bthci_cmd_all_phys_reserved = -1;
static int hf_bthci_cmd_tx_phys = -1;
static int hf_bthci_cmd_rx_phys = -1;
static int hf_bthci_cmd_phys_pref_le_1m = -1;
static int hf_bthci_cmd_phys_pref_le_2m = -1;
static int hf_bthci_cmd_phys_pref_le_coded = -1;
static int hf_bthci_cmd_phys_pref_reserved = -1;
static int hf_bthci_cmd_phy_options = -1;
static int hf_bthci_cmd_phy_options_coding =-1;
static int hf_bthci_cmd_phy_options_reserved =- 1;
static int hf_bthci_cmd_phy = -1;
static int hf_bthci_cmd_modulation_index = -1;
static const int *hfx_bthci_cmd_le_event_mask[] = {
&hf_bthci_cmd_le_event_mask_le_reserved,
&hf_bthci_cmd_le_event_mask_le_phy_update_complete,
&hf_bthci_cmd_le_event_mask_le_direct_advertising_report ,
&hf_bthci_cmd_le_event_mask_le_enhanced_connection_complete,
&hf_bthci_cmd_le_event_mask_le_generate_dhkey_complete,
@ -381,6 +398,27 @@ static const int *hfx_bthci_cmd_le_event_mask[] = {
NULL
};
static const int *hfx_btcmd_all_phys[] = {
&hf_bthci_cmd_all_phys_reserved,
&hf_bthci_cmd_all_phys_rx_pref,
&hf_bthci_cmd_all_phys_tx_pref,
NULL
};
static const int *hfx_btcmd_phys_pref[] = {
&hf_bthci_cmd_phys_pref_reserved,
&hf_bthci_cmd_phys_pref_le_coded,
&hf_bthci_cmd_phys_pref_le_2m,
&hf_bthci_cmd_phys_pref_le_1m,
NULL
};
static const int *hfx_btcmd_phy_options[] = {
&hf_bthci_cmd_phy_options_reserved,
&hf_bthci_cmd_phy_options_coding,
NULL
};
static expert_field ei_command_undecoded = EI_INIT;
static expert_field ei_command_unknown_command = EI_INIT;
static expert_field ei_command_parameter_unexpected = EI_INIT;
@ -395,6 +433,7 @@ static gint ett_cod_mask = -1;
static gint ett_flow_spec_subtree = -1;
static gint ett_le_channel_map = -1;
static gint ett_le_event_mask = -1;
static gint ett_phys_flags = -1;
static gint proto_btcommon = -1;
static gint hf_btcommon_eir_ad_entry = -1;
@ -1708,6 +1747,27 @@ static const value_string cmd_le_adv_data_frag_pref[] = {
{ 0, NULL }
};
static const value_string cmd_le_phy_options_vals[] = {
{ 0x00, "The Host has no preferred coding on the LE Coded PHY" },
{ 0x01, "The Host prefers S=2 coding on the LE Coded PHY" },
{ 0x02, "The Host prefers S=8 coding on the LE Coded PHY" },
{ 0, NULL }
};
static const value_string cmd_le_phy_vals[] = {
{ 0x01, "LE 1M" },
{ 0x02, "LE 2M" },
{ 0x03, "LE Coded" },
{ 0, NULL }
};
value_string_ext bthci_cmd_le_phy_vals_ext = VALUE_STRING_EXT_INIT(cmd_le_phy_vals);
static const value_string cmd_le_modulation_index_vals[] = {
{ 0x00, "Assume transmitter will have a standard modulation index" },
{ 0x01, "Assume transmitter will have a stable modulation index" },
{ 0, NULL }
};
void proto_register_bthci_cmd(void);
void proto_reg_handoff_bthci_cmd(void);
void proto_register_btcommon(void);
@ -3293,6 +3353,7 @@ dissect_le_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
case 0x0015: /* LE Read Channel Map */
case 0x0016: /* LE Read Remote Used Features */
case 0x001b: /* LE Long Term Key Request Negative Reply */
case 0x0030: /* LE Read PHY */
proto_tree_add_item(tree, hf_bthci_cmd_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset+=2;
break;
@ -3429,6 +3490,50 @@ dissect_le_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
offset+=2;
break;
case 0x0031: /* LE Set Default PHY */
proto_tree_add_bitmask(tree, tvb, offset, hf_bthci_cmd_all_phys, ett_phys_flags, hfx_btcmd_all_phys, ENC_NA);
offset += 1;
proto_tree_add_bitmask(tree, tvb, offset, hf_bthci_cmd_tx_phys, ett_phys_flags, hfx_btcmd_phys_pref, ENC_NA);
offset+=1;
proto_tree_add_bitmask(tree, tvb, offset, hf_bthci_cmd_rx_phys, ett_phys_flags, hfx_btcmd_phys_pref, ENC_NA);
offset+=1;
break;
case 0x0032: /* LE Set PHY */
proto_tree_add_item(tree, hf_bthci_cmd_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset+=2;
proto_tree_add_bitmask(tree, tvb, offset, hf_bthci_cmd_all_phys, ett_phys_flags, hfx_btcmd_all_phys, ENC_NA);
offset += 1;
proto_tree_add_bitmask(tree, tvb, offset, hf_bthci_cmd_tx_phys, ett_phys_flags, hfx_btcmd_phys_pref, ENC_NA);
offset+=1;
proto_tree_add_bitmask(tree, tvb, offset, hf_bthci_cmd_rx_phys, ett_phys_flags, hfx_btcmd_phys_pref, ENC_NA);
offset+=1;
proto_tree_add_bitmask(tree, tvb, offset, hf_bthci_cmd_phy_options, ett_phys_flags, hfx_btcmd_phy_options, ENC_LITTLE_ENDIAN);
offset+=2;
break;
case 0x0033: /* LE Enhanced Receiver Test */
item = proto_tree_add_item(tree, hf_bthci_cmd_rx_frequency, tvb, offset, 1, ENC_LITTLE_ENDIAN);
proto_item_append_text(item, " (%d MHz)", 2402 + 2*tvb_get_guint8(tvb, offset));
offset++;
proto_tree_add_item(tree, hf_bthci_cmd_phy, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
proto_tree_add_item(tree, hf_bthci_cmd_modulation_index, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
break;
case 0x0034: /* LE Enhanced Transmitter Test */
item = proto_tree_add_item(tree, hf_bthci_cmd_tx_frequency, tvb, offset, 1, ENC_LITTLE_ENDIAN);
proto_item_append_text(item, " (%d MHz)", 2402 + 2*tvb_get_guint8(tvb, offset));
offset++;
proto_tree_add_item(tree, hf_bthci_cmd_test_data_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
proto_tree_add_item(tree, hf_bthci_cmd_test_packet_payload, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
proto_tree_add_item(tree, hf_bthci_cmd_phy, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
break;
case 0x035: /* LE Set Advertising Set Random Address */
proto_tree_add_item(tree, hf_bthci_cmd_advertising_handle, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset+=1;
@ -5078,9 +5183,14 @@ proto_register_bthci_cmd(void)
FT_BOOLEAN, 64, NULL, G_GUINT64_CONSTANT(0x400),
NULL, HFILL }
},
{ &hf_bthci_cmd_le_event_mask_le_phy_update_complete,
{ "LE PHY Update Complete", "bthci_cmd.le_event_mask.le_phy_update_complete",
FT_BOOLEAN, 64, NULL, G_GUINT64_CONSTANT(0x800),
NULL, HFILL }
},
{ &hf_bthci_cmd_le_event_mask_le_reserved,
{ "Reserved", "bthci_cmd.le_event_mask.reserved",
FT_UINT64, BASE_HEX, NULL, G_GUINT64_CONSTANT(0xFFFFFFFFFFFFF800),
FT_UINT64, BASE_HEX, NULL, G_GUINT64_CONSTANT(0xFFFFFFFFFFFFF000),
NULL, HFILL }
},
{ &hf_bthci_cmd_le_advts_interval_min,
@ -5393,6 +5503,81 @@ proto_register_bthci_cmd(void)
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{&hf_bthci_cmd_all_phys,
{"All PHYs", "bthci_cmd.all_phys",
FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL}
},
{ &hf_bthci_cmd_all_phys_tx_pref,
{ "The Host has no Tx PHY preference", "bthci_cmd.all_phys.tx_preference",
FT_BOOLEAN, 8, NULL, 0x1,
NULL, HFILL }
},
{ &hf_bthci_cmd_all_phys_rx_pref,
{ "The Host has no Rx PHY preference", "bthci_cmd.all_phys.rx_preference",
FT_BOOLEAN, 8, NULL, 0x2,
NULL, HFILL }
},
{ &hf_bthci_cmd_all_phys_reserved,
{ "Reserved", "bthci_cmd.all_phys.reserved",
FT_UINT8, BASE_HEX, NULL, 0xFC,
NULL, HFILL }
},
{&hf_bthci_cmd_tx_phys,
{"Tx PHYs", "bthci_cmd.tx_phys",
FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL}
},
{&hf_bthci_cmd_rx_phys,
{"Rx PHYs", "bthci_cmd.rx_phys",
FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL}
},
{ &hf_bthci_cmd_phys_pref_le_1m,
{ "The Host prefers LE 1M", "bthci_cmd.phys_pref.le_1m",
FT_BOOLEAN, 8, NULL, 0x1,
NULL, HFILL }
},
{ &hf_bthci_cmd_phys_pref_le_2m,
{ "The Host prefers LE 2M", "bthci_cmd.phys_pref.le_2m",
FT_BOOLEAN, 8, NULL, 0x2,
NULL, HFILL }
},
{ &hf_bthci_cmd_phys_pref_le_coded,
{ "The Host prefers LE Coded", "bthci_cmd.phys_pref.le_coded",
FT_BOOLEAN, 8, NULL, 0x4,
NULL, HFILL }
},
{ &hf_bthci_cmd_phys_pref_reserved,
{ "Reserved", "bthci_cmd.phys_pref.reserved",
FT_UINT8, BASE_HEX, NULL, 0xF8,
NULL, HFILL }
},
{ &hf_bthci_cmd_phy_options,
{ "PHY Options", "bthci_cmd.phy_options",
FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_bthci_cmd_phy_options_coding,
{ "Coding", "bthci_cmd.phy_options.coding",
FT_UINT16, BASE_HEX, VALS(cmd_le_phy_options_vals), 0x3,
NULL, HFILL }
},
{ &hf_bthci_cmd_phy_options_reserved,
{ "Reserved", "bthci_cmd.phy_options.reserved",
FT_UINT16, BASE_HEX, NULL, 0xFFFC,
NULL, HFILL }
},
{ &hf_bthci_cmd_phy,
{ "PHY", "bthci_cmd.phy",
FT_UINT8, BASE_HEX, VALS(cmd_le_phy_vals), 0x0,
NULL, HFILL }
},
{ &hf_bthci_cmd_modulation_index,
{ "Modulation Index", "bthci_cmd.modulation_index",
FT_UINT8, BASE_HEX, VALS(cmd_le_modulation_index_vals), 0x0,
NULL, HFILL }
}
};
static ei_register_info ei[] = {
@ -5408,7 +5593,8 @@ proto_register_bthci_cmd(void)
&ett_cod_mask,
&ett_flow_spec_subtree,
&ett_le_channel_map,
&ett_le_event_mask
&ett_le_event_mask,
&ett_phys_flags
};
/* Decode As handling */

View File

@ -44,6 +44,7 @@ extern value_string_ext bthci_cmd_status_vals_ext;
extern value_string_ext bthci_cmd_eir_data_type_vals_ext;
extern value_string_ext bthci_cmd_auth_req_vals_ext;
extern value_string_ext bthci_cmd_appearance_vals_ext;
extern value_string_ext bthci_cmd_le_phy_vals_ext;
extern const value_string bthci_cmd_io_capability_vals[];
extern const value_string bthci_cmd_oob_data_present_vals[];

View File

@ -378,6 +378,10 @@ static int hf_bthci_evt_le_features_ping = -1;
static int hf_bthci_evt_le_features_data_packet_length_extension = -1;
static int hf_bthci_evt_le_features_ll_privacy = -1;
static int hf_bthci_evt_le_features_extended_scanner_filter_policies = -1;
static int hf_bthci_evt_le_features_2m_phy = -1;
static int hf_bthci_evt_le_features_stable_modulation_index_tx =-1;
static int hf_bthci_evt_le_features_stable_modulation_index_rx = -1;
static int hf_bthci_evt_le_features_coded_phy = -1;
static int hf_bthci_evt_le_features_reserved = -1;
static int hf_bthci_evt_mws_number_of_transports = -1;
static int hf_bthci_evt_mws_transport_layers = -1;
@ -407,6 +411,8 @@ static int hf_bthci_evt_le_direct_address_type = -1;
static int hf_bthci_evt_le_direct_bd_addr = -1;
static int hf_bthci_evt_le_address_type = -1;
static int hf_bthci_evt_le_rssi = -1;
static int hf_bthci_evt_le_tx_phy = -1;
static int hf_bthci_evt_le_rx_phy = -1;
static const int *hfx_bthci_evt_le_features[] = {
&hf_bthci_evt_le_features_encryption,
@ -417,6 +423,10 @@ static const int *hfx_bthci_evt_le_features[] = {
&hf_bthci_evt_le_features_data_packet_length_extension,
&hf_bthci_evt_le_features_ll_privacy,
&hf_bthci_evt_le_features_extended_scanner_filter_policies,
&hf_bthci_evt_le_features_2m_phy,
&hf_bthci_evt_le_features_stable_modulation_index_tx,
&hf_bthci_evt_le_features_stable_modulation_index_rx,
&hf_bthci_evt_le_features_coded_phy,
&hf_bthci_evt_le_features_reserved,
NULL
};
@ -598,6 +608,7 @@ const value_string bthci_evt_lmp_version[] = {
{0x06, "4.0"},
{0x07, "4.1"},
{0x08, "4.2"},
{0x09, "5.0"},
{0, NULL }
};
@ -614,6 +625,7 @@ const value_string bthci_evt_hci_version[] = {
{0x06, "4.0"},
{0x07, "4.1"},
{0x08, "4.2"},
{0x09, "5.0"},
{0, NULL }
};
@ -833,7 +845,6 @@ static const value_string event_type_vals[] = {
{ 0, NULL }
};
static const unit_name_string units_number_events = { " (number events)", NULL };
@ -2400,6 +2411,22 @@ dissect_bthci_evt_le_meta(tvbuff_t *tvb, int offset, packet_info *pinfo,
}
}
break;
case 0x0C: /* LE PHY Update Complete */
proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
status = tvb_get_guint8(tvb, offset);
send_hci_summary_status_tap(status, pinfo, bluetooth_data);
offset += 1;
proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
proto_tree_add_item(tree, hf_bthci_evt_le_tx_phy, tvb, offset, 1, ENC_NA);
offset += 1;
proto_tree_add_item(tree, hf_bthci_evt_le_rx_phy, tvb, offset, 1, ENC_NA);
offset += 1;
break;
default:
break;
@ -4192,6 +4219,20 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset,
break;
}
case 0x2030: /* LE Read PHY */
{
proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
offset += 1;
proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
proto_tree_add_item(tree, hf_bthci_evt_le_tx_phy, tvb, offset, 1, ENC_NA);
offset += 1;
proto_tree_add_item(tree, hf_bthci_evt_le_rx_phy, tvb, offset, 1, ENC_NA);
offset += 1;
break;
}
case 0x2036: /* LE Set Extended Advertising Parameters */
{
proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
@ -7202,9 +7243,29 @@ proto_register_bthci_evt(void)
FT_BOOLEAN, 64, NULL, 0x80,
NULL, HFILL }
},
{ &hf_bthci_evt_le_features_2m_phy,
{ "LE 2M PHY", "bthci_evt.le_features.2m_phy",
FT_BOOLEAN, 64, NULL, 0x100,
NULL, HFILL }
},
{ &hf_bthci_evt_le_features_stable_modulation_index_tx,
{ "Stable Modulation Index - Tx", "bthci_evt.le_features.stable_modulation_index_tx",
FT_BOOLEAN, 64, NULL, 0x200,
NULL, HFILL }
},
{ &hf_bthci_evt_le_features_stable_modulation_index_rx,
{ "Stable Modulation Index - Rx", "bthci_evt.le_features.stable_modulation_index_rx",
FT_BOOLEAN, 64, NULL, 0x400,
NULL, HFILL }
},
{ &hf_bthci_evt_le_features_coded_phy,
{ "LE Coded PHY", "bthci_evt.le_features.coded_phy",
FT_BOOLEAN, 64, NULL, 0x800,
NULL, HFILL }
},
{ &hf_bthci_evt_le_features_reserved,
{ "Reserved", "bthci_evt.le_features.reserved",
FT_UINT64, BASE_HEX, NULL, G_GUINT64_CONSTANT(0xFFFFFFFFFFFFFF00),
FT_UINT64, BASE_HEX, NULL, G_GUINT64_CONSTANT(0xFFFFFFFFFFFFF000),
NULL, HFILL }
},
{ &hf_bthci_evt_mws_number_of_transports,
@ -7351,6 +7412,16 @@ proto_register_bthci_evt(void)
{ "RSSI (dBm)", "bthci_evt.le_rssi",
FT_INT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_bthci_evt_le_tx_phy,
{ "Tx PHY", "bthci_evt.le_tx_phy",
FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bthci_cmd_le_phy_vals_ext, 0x0,
NULL, HFILL }
},
{ &hf_bthci_evt_le_rx_phy,
{ "Rx PHY", "bthci_evt.le_rx_phy",
FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bthci_cmd_le_phy_vals_ext, 0x0,
NULL, HFILL }
}
};