Commit a70f4b5f authored by Johan Hedberg's avatar Johan Hedberg Committed by Marcel Holtmann

Bluetooth: Don't try background scanning if LE is not enabled

For adapters that do not support LE and ones where LE hasn't been
enabled we shouldn't be trying to initiate background scanning. This
patch adds an extra check to the hci_update_background_scan() to ensure
that we bail out if HCI_LE_ENABLED is not set.

Since we do allow user space to feed the kernel with LE connection
parameters even when LE is not enabled we now need to also call
hci_update_background_scan() as soon as LE gets enabled so that scanning
gets started if necessary.
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent cdd6275e
...@@ -5403,6 +5403,10 @@ void hci_update_background_scan(struct hci_dev *hdev) ...@@ -5403,6 +5403,10 @@ void hci_update_background_scan(struct hci_dev *hdev)
test_bit(HCI_UNREGISTER, &hdev->dev_flags)) test_bit(HCI_UNREGISTER, &hdev->dev_flags))
return; return;
/* No point in doing scanning if LE support hasn't been enabled */
if (!test_bit(HCI_LE_ENABLED, &hdev->dev_flags))
return;
/* If discovery is active don't interfere with it */ /* If discovery is active don't interfere with it */
if (hdev->discovery.state != DISCOVERY_STOPPED) if (hdev->discovery.state != DISCOVERY_STOPPED)
return; return;
......
...@@ -2152,6 +2152,8 @@ static void le_enable_complete(struct hci_dev *hdev, u8 status) ...@@ -2152,6 +2152,8 @@ static void le_enable_complete(struct hci_dev *hdev, u8 status)
update_scan_rsp_data(&req); update_scan_rsp_data(&req);
hci_req_run(&req, NULL); hci_req_run(&req, NULL);
hci_update_background_scan(hdev);
hci_dev_unlock(hdev); hci_dev_unlock(hdev);
} }
} }
......
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