Bluetooth: Do not trigger background scanning when HCI_AUTO_OFF is set
authorMarcel Holtmann <marcel@holtmann.org>
Tue, 1 Jul 2014 17:28:23 +0000 (19:28 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 3 Jul 2014 15:42:54 +0000 (17:42 +0200)
When a new controller is initialized, but not powered from userspace
at the moment, the HCI_AUTO_OFF flag is still set. During this period,
userspace might program device for auto-connection, but never power
on the controller. In this case do not try to start background
scanning and leave it for later to be started.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
net/bluetooth/hci_core.c

index 0aa3924066298333ca1fa360472812b49c696a42..25ed6d3de4109b0b73c9d6f51b8fcbafbe86c792 100644 (file)
@@ -5306,6 +5306,7 @@ void hci_update_background_scan(struct hci_dev *hdev)
        if (!test_bit(HCI_UP, &hdev->flags) ||
            test_bit(HCI_INIT, &hdev->flags) ||
            test_bit(HCI_SETUP, &hdev->dev_flags) ||
+           test_bit(HCI_AUTO_OFF, &hdev->dev_flags) ||
            test_bit(HCI_UNREGISTER, &hdev->dev_flags))
                return;