aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorAndre Guedes <andre.guedes@openbossa.org>2012-02-24 09:41:04 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-29 09:21:04 -0500
commit426c189a1b34c0d36d5eddbe1c35bc961b1a1b68 (patch)
treedfb8a00175bee1fb83b77fbeb8ac178a9583525a /net/bluetooth/mgmt.c
parent978c93b90fc4768e295b20492b5db76d5e026e5e (diff)
Bluetooth: Change interleaved discovery behavior
According to last discussion on IRC, if an interleaved discovery is issued, but the device is not dual mode, we should return error instead of performing a regular BR/EDR or LE-only discovery. 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>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index c4d3bc9c86b5..b0c43fe43563 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2540,29 +2540,6 @@ unlock:
2540 return err; 2540 return err;
2541} 2541}
2542 2542
2543static int discovery(struct hci_dev *hdev)
2544{
2545 int err;
2546
2547 if (lmp_host_le_capable(hdev)) {
2548 if (lmp_bredr_capable(hdev)) {
2549 err = hci_le_scan(hdev, LE_SCAN_TYPE,
2550 LE_SCAN_INT, LE_SCAN_WIN,
2551 LE_SCAN_TIMEOUT_BREDR_LE);
2552 } else {
2553 hdev->discovery.type = DISCOV_TYPE_LE;
2554 err = hci_le_scan(hdev, LE_SCAN_TYPE,
2555 LE_SCAN_INT, LE_SCAN_WIN,
2556 LE_SCAN_TIMEOUT_LE_ONLY);
2557 }
2558 } else {
2559 hdev->discovery.type = DISCOV_TYPE_BREDR;
2560 err = hci_do_inquiry(hdev, INQUIRY_LEN_BREDR);
2561 }
2562
2563 return err;
2564}
2565
2566int mgmt_interleaved_discovery(struct hci_dev *hdev) 2543int mgmt_interleaved_discovery(struct hci_dev *hdev)
2567{ 2544{
2568 int err; 2545 int err;
@@ -2632,7 +2609,11 @@ static int start_discovery(struct sock *sk, u16 index,
2632 break; 2609 break;
2633 2610
2634 case DISCOV_TYPE_INTERLEAVED: 2611 case DISCOV_TYPE_INTERLEAVED:
2635 err = discovery(hdev); 2612 if (lmp_host_le_capable(hdev) && lmp_bredr_capable(hdev))
2613 err = hci_le_scan(hdev, LE_SCAN_TYPE, LE_SCAN_INT,
2614 LE_SCAN_WIN, LE_SCAN_TIMEOUT_BREDR_LE);
2615 else
2616 err = -ENOTSUPP;
2636 break; 2617 break;
2637 2618
2638 default: 2619 default: