]> www.infradead.org Git - users/willy/xarray.git/commitdiff
Bluetooth: Do not cancel advertising when starting a scan
authorDmitry Grinberg <dmitrygr@google.com>
Tue, 17 Mar 2020 05:40:27 +0000 (22:40 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 18 Mar 2020 11:25:03 +0000 (12:25 +0100)
BlueZ cancels adv when starting a scan, but does not cancel a scan when
starting to adv. Neither is required, so this brings both to a
consistent state (of not affecting each other). Some very rare (I've
never seen one) BT 4.0 chips will fail to do both at once. Even this is
ok since the command that will fail will be the second one, and thus the
common sense logic of first-come-first-served is preserved for BLE
requests.

Signed-off-by: Dmitry Grinberg <dmitrygr@google.com>
Signed-off-by: Manish Mandlik <mmandlik@google.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/hci_request.c

index bf83179ab9d1968b46f8476fc96d3d828de7fc3b..649e1e5ed446aa151ad72e607b94855e92b23b6b 100644 (file)
@@ -2727,23 +2727,6 @@ static int active_scan(struct hci_request *req, unsigned long opt)
 
        BT_DBG("%s", hdev->name);
 
-       if (hci_dev_test_flag(hdev, HCI_LE_ADV)) {
-               hci_dev_lock(hdev);
-
-               /* Don't let discovery abort an outgoing connection attempt
-                * that's using directed advertising.
-                */
-               if (hci_lookup_le_connect(hdev)) {
-                       hci_dev_unlock(hdev);
-                       return -EBUSY;
-               }
-
-               cancel_adv_timeout(hdev);
-               hci_dev_unlock(hdev);
-
-               __hci_req_disable_advertising(req);
-       }
-
        /* If controller is scanning, it means the background scanning is
         * running. Thus, we should temporarily stop it in order to set the
         * discovery scanning parameters.