summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/bluetooth/mgmt.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 7783b8d8e1d4..75c9d9269d77 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1006,6 +1006,9 @@ static void write_fast_connectable(struct hci_request *req, bool enable)
1006 struct hci_cp_write_page_scan_activity acp; 1006 struct hci_cp_write_page_scan_activity acp;
1007 u8 type; 1007 u8 type;
1008 1008
1009 if (hdev->hci_ver < BLUETOOTH_VER_1_2)
1010 return;
1011
1009 if (enable) { 1012 if (enable) {
1010 type = PAGE_SCAN_TYPE_INTERLACED; 1013 type = PAGE_SCAN_TYPE_INTERLACED;
1011 1014
@@ -1125,7 +1128,13 @@ static int set_connectable(struct sock *sk, struct hci_dev *hdev, void *data,
1125 1128
1126 hci_req_add(&req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan); 1129 hci_req_add(&req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
1127 1130
1128 if (!cp->val && test_bit(HCI_FAST_CONNECTABLE, &hdev->dev_flags)) 1131 /* If we're going from non-connectable to connectable or
1132 * vice-versa when fast connectable is enabled ensure that fast
1133 * connectable gets disabled. write_fast_connectable won't do
1134 * anything if the page scan parameters are already what they
1135 * should be.
1136 */
1137 if (cp->val || test_bit(HCI_FAST_CONNECTABLE, &hdev->dev_flags))
1129 write_fast_connectable(&req, false); 1138 write_fast_connectable(&req, false);
1130 1139
1131 err = hci_req_run(&req, set_connectable_complete); 1140 err = hci_req_run(&req, set_connectable_complete);
@@ -3287,6 +3296,12 @@ static void set_bredr_scan(struct hci_request *req)
3287 struct hci_dev *hdev = req->hdev; 3296 struct hci_dev *hdev = req->hdev;
3288 u8 scan = 0; 3297 u8 scan = 0;
3289 3298
3299 /* Ensure that fast connectable is disabled. This function will
3300 * not do anything if the page scan parameters are already what
3301 * they should be.
3302 */
3303 write_fast_connectable(req, false);
3304
3290 if (test_bit(HCI_CONNECTABLE, &hdev->dev_flags)) 3305 if (test_bit(HCI_CONNECTABLE, &hdev->dev_flags))
3291 scan |= SCAN_PAGE; 3306 scan |= SCAN_PAGE;
3292 if (test_bit(HCI_DISCOVERABLE, &hdev->dev_flags)) 3307 if (test_bit(HCI_DISCOVERABLE, &hdev->dev_flags))