Bluetooth: Check FINDING state in interleaved discovery
authorAndre Guedes <andre.guedes@openbossa.org>
Tue, 6 Mar 2012 22:37:06 +0000 (19:37 -0300)
committerGustavo Padovan <gustavo@padovan.org>
Wed, 9 May 2012 03:41:29 +0000 (00:41 -0300)
In order to do interleaved discovery we should be in DISCOVERY_
FINDING state. Otherwise, discovery should be stopped.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
net/bluetooth/hci_event.c

index 982ae3c52db4e0d93e3ade5b98b16fd274b20bd7..50ff9a9895314dfd346295327e0ae2f848db83e5 100644 (file)
@@ -1098,7 +1098,8 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev,
 
                schedule_delayed_work(&hdev->adv_work, ADV_CLEAR_TIMEOUT);
 
-               if (hdev->discovery.type == DISCOV_TYPE_INTERLEAVED) {
+               if (hdev->discovery.type == DISCOV_TYPE_INTERLEAVED &&
+                   hdev->discovery.state == DISCOVERY_FINDING) {
                        mgmt_interleaved_discovery(hdev);
                } else {
                        hci_dev_lock(hdev);