Bluetooth: LE support for MGMT stop discovery
authorAndre Guedes <andre.guedes@openbossa.org>
Thu, 15 Mar 2012 19:52:08 +0000 (16:52 -0300)
committerGustavo Padovan <gustavo@padovan.org>
Wed, 9 May 2012 03:41:33 +0000 (00:41 -0300)
This patch adds LE support to MGMT stop discovery command. So,
now we are able to cancel LE discovery procedures (LE-only and
interleaved).

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
net/bluetooth/hci_event.c
net/bluetooth/mgmt.c

index ecf885b79af155d92fb8d49dafa38736f18f19f1..0a936291f0e7879c2190e9108061421781a5c08d 100644 (file)
@@ -1094,8 +1094,12 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev,
                break;
 
        case LE_SCANNING_DISABLED:
-               if (status)
+               if (status) {
+                       hci_dev_lock(hdev);
+                       mgmt_stop_discovery_failed(hdev, status);
+                       hci_dev_unlock(hdev);
                        return;
+               }
 
                clear_bit(HCI_LE_SCAN, &hdev->dev_flags);
 
index 0ef4b6ca6e4482ad636a4aa1fd30145658383cac..5fc741bab2bfc0fe6c3c69273461cc9404121eca 100644 (file)
@@ -2404,7 +2404,11 @@ static int stop_discovery(struct sock *sk, struct hci_dev *hdev, void *data,
        }
 
        if (hdev->discovery.state == DISCOVERY_FINDING) {
-               err = hci_cancel_inquiry(hdev);
+               if (test_bit(HCI_INQUIRY, &hdev->flags))
+                       err = hci_cancel_inquiry(hdev);
+               else
+                       err = hci_cancel_le_scan(hdev);
+
                if (err < 0)
                        mgmt_pending_remove(cmd);
                else