aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-07-07 07:40:22 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-07-07 07:53:03 -0400
commit2b7be33e60c631b3080099baf14c43505fa8017d (patch)
treea3ed3539e2da9b337d727c1fe7371d78cebe042d /net
parentae23ada43d7d644e563a23d4c2cd2aa828be1431 (diff)
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: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/hci_core.c3
-rw-r--r--net/bluetooth/mgmt.c4
2 files changed, 5 insertions, 2 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 4f8ba49ac49d..6790dc8cff99 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -5409,7 +5409,8 @@ void hci_update_background_scan(struct hci_dev *hdev)
5409 5409
5410 hci_req_init(&req, hdev); 5410 hci_req_init(&req, hdev);
5411 5411
5412 if (list_empty(&hdev->pend_le_conns) && 5412 if (!test_bit(HCI_CONNECTABLE, &hdev->dev_flags) &&
5413 list_empty(&hdev->pend_le_conns) &&
5413 list_empty(&hdev->pend_le_reports)) { 5414 list_empty(&hdev->pend_le_reports)) {
5414 /* If there is no pending LE connections or devices 5415 /* If there is no pending LE connections or devices
5415 * to be scanned for, we should stop the background 5416 * to be scanned for, we should stop the background
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 40244fc0e326..ef675acbcfce 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1750,8 +1750,10 @@ static void set_connectable_complete(struct hci_dev *hdev, u8 status)
1750 1750
1751 send_settings_rsp(cmd->sk, MGMT_OP_SET_CONNECTABLE, hdev); 1751 send_settings_rsp(cmd->sk, MGMT_OP_SET_CONNECTABLE, hdev);
1752 1752
1753 if (changed) 1753 if (changed) {
1754 new_settings(hdev, cmd->sk); 1754 new_settings(hdev, cmd->sk);
1755 hci_update_background_scan(hdev);
1756 }
1755 1757
1756remove_cmd: 1758remove_cmd:
1757 mgmt_pending_remove(cmd); 1759 mgmt_pending_remove(cmd);