Skip to content

Commit

Permalink
Bluetooth: During le_conn_timeout disable EXT_ADV
Browse files Browse the repository at this point in the history
Disabling LE_LEGACY_ADV when LE_EXT_ADV is enabled causes 'command
disallowed . This patch fixes that issue and disables EXT_ADV if
enabled.

Signed-off-by: Sathish Narsimman <sathish.narasimman@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Sathish Narsimman authored and Marcel Holtmann committed Feb 28, 2020
1 parent a9e4569 commit c3bed4d
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions net/bluetooth/hci_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,23 @@ static void hci_conn_auto_accept(struct work_struct *work)
&conn->dst);
}

static void le_disable_advertising(struct hci_dev *hdev)
{
if (ext_adv_capable(hdev)) {
struct hci_cp_le_set_ext_adv_enable cp;

cp.enable = 0x00;
cp.num_of_sets = 0x00;

hci_send_cmd(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE, sizeof(cp),
&cp);
} else {
u8 enable = 0x00;
hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable),
&enable);
}
}

static void le_conn_timeout(struct work_struct *work)
{
struct hci_conn *conn = container_of(work, struct hci_conn,
Expand All @@ -481,9 +498,8 @@ static void le_conn_timeout(struct work_struct *work)
* (which doesn't have a timeout of its own).
*/
if (conn->role == HCI_ROLE_SLAVE) {
u8 enable = 0x00;
hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable),
&enable);
/* Disable LE Advertising */
le_disable_advertising(hdev);
hci_le_conn_failed(conn, HCI_ERROR_ADVERTISING_TIMEOUT);
return;
}
Expand Down

0 comments on commit c3bed4d

Please sign in to comment.