Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth: Kconfig the Auto PHY Update Procedure initiation #9654

Merged
merged 1 commit into from
Aug 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions subsys/bluetooth/host/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,16 @@ config BT_ATT_TX_MAX
amount the calls will block until an existing queued PDU gets
sent.

config BT_AUTO_PHY_UPDATE
bool "Auto-initiate PHY Update Procedure"
default y
help
Initiate PHY Update Procedure on connection establishment.

Disable this if you want PHY Update Procedure feature supported but
want to rely on remote device to initiate the procedure at its
descretion.

config BT_SMP
bool "Security Manager Protocol support"
select TINYCRYPT
Expand Down
9 changes: 6 additions & 3 deletions subsys/bluetooth/host/hci_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,8 @@ static void le_enh_conn_complete(struct bt_hci_evt_le_enh_conn_complete *evt)
}
}

if (BT_FEAT_LE_PHY_2M(bt_dev.le.features)) {
if (IS_ENABLED(CONFIG_BT_AUTO_PHY_UPDATE) &&
BT_FEAT_LE_PHY_2M(bt_dev.le.features)) {
err = hci_le_set_phy(conn);
if (!err) {
atomic_set_bit(conn->flags, BT_CONN_AUTO_PHY_UPDATE);
Expand Down Expand Up @@ -985,7 +986,8 @@ static void le_remote_feat_complete(struct net_buf *buf)
sizeof(conn->le.features));
}

if (BT_FEAT_LE_PHY_2M(bt_dev.le.features) &&
if (IS_ENABLED(CONFIG_BT_AUTO_PHY_UPDATE) &&
BT_FEAT_LE_PHY_2M(bt_dev.le.features) &&
BT_FEAT_LE_PHY_2M(conn->le.features)) {
int err;

Expand Down Expand Up @@ -1057,7 +1059,8 @@ static void le_phy_update_complete(struct net_buf *buf)
BT_DBG("PHY updated: status: 0x%x, tx: %u, rx: %u",
evt->status, evt->tx_phy, evt->rx_phy);

if (!atomic_test_and_clear_bit(conn->flags, BT_CONN_AUTO_PHY_UPDATE)) {
if (!IS_ENABLED(CONFIG_BT_AUTO_PHY_UPDATE) ||
!atomic_test_and_clear_bit(conn->flags, BT_CONN_AUTO_PHY_UPDATE)) {
goto done;
}

Expand Down