Commit 2b7be33e authored by Johan Hedberg's avatar Johan Hedberg Committed by Marcel Holtmann

Bluetooth: Enable passive scanning whenever we're connectable

Enabling passive scanning always when we're connectable aligns us with
the BR/EDR page scanning. This is also consistent with the fact that the
code dealing with passive scanning results will actively try to connect
any direct advertising event when we're connectable.

This patch implements the feature by adding the connectable condition to
hci_update_background_scan() checks for starting scanning and by calling
hci_update_background_scan() whenever the connectable state changes.
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent ae23ada4
...@@ -5409,7 +5409,8 @@ void hci_update_background_scan(struct hci_dev *hdev) ...@@ -5409,7 +5409,8 @@ void hci_update_background_scan(struct hci_dev *hdev)
hci_req_init(&req, hdev); hci_req_init(&req, hdev);
if (list_empty(&hdev->pend_le_conns) && if (!test_bit(HCI_CONNECTABLE, &hdev->dev_flags) &&
list_empty(&hdev->pend_le_conns) &&
list_empty(&hdev->pend_le_reports)) { list_empty(&hdev->pend_le_reports)) {
/* If there is no pending LE connections or devices /* If there is no pending LE connections or devices
* to be scanned for, we should stop the background * to be scanned for, we should stop the background
......
...@@ -1750,8 +1750,10 @@ static void set_connectable_complete(struct hci_dev *hdev, u8 status) ...@@ -1750,8 +1750,10 @@ static void set_connectable_complete(struct hci_dev *hdev, u8 status)
send_settings_rsp(cmd->sk, MGMT_OP_SET_CONNECTABLE, hdev); send_settings_rsp(cmd->sk, MGMT_OP_SET_CONNECTABLE, hdev);
if (changed) if (changed) {
new_settings(hdev, cmd->sk); new_settings(hdev, cmd->sk);
hci_update_background_scan(hdev);
}
remove_cmd: remove_cmd:
mgmt_pending_remove(cmd); mgmt_pending_remove(cmd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment