diff options
author | Andre Guedes <andre.guedes@openbossa.org> | 2012-02-23 16:09:27 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2012-03-01 10:12:53 -0500 |
commit | 8b90129cc5789a4c65547c91c9a7b1fd3a4d56a4 (patch) | |
tree | 16e8be2df2d6bb0de2c5b13bacbb2023d300bdcc /net | |
parent | 1de028ceb54ccd28cc96f1530a195ae1b6a6d5b5 (diff) |
Bluetooth: Check capabilities in BR/EDR and LE-Only discovery
This patch add an extra check for BR/EDR and LE-Only discovery.
This way, we are able to return error immediately if the discovery
type requested is not supported by the device.
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')
-rw-r--r-- | net/bluetooth/mgmt.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index abf1adb8bc16..3fcccad75453 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -2602,12 +2602,18 @@ static int start_discovery(struct sock *sk, u16 index, | |||
2602 | 2602 | ||
2603 | switch (hdev->discovery.type) { | 2603 | switch (hdev->discovery.type) { |
2604 | case DISCOV_TYPE_BREDR: | 2604 | case DISCOV_TYPE_BREDR: |
2605 | err = hci_do_inquiry(hdev, INQUIRY_LEN_BREDR); | 2605 | if (lmp_bredr_capable(hdev)) |
2606 | err = hci_do_inquiry(hdev, INQUIRY_LEN_BREDR); | ||
2607 | else | ||
2608 | err = -ENOTSUPP; | ||
2606 | break; | 2609 | break; |
2607 | 2610 | ||
2608 | case DISCOV_TYPE_LE: | 2611 | case DISCOV_TYPE_LE: |
2609 | err = hci_le_scan(hdev, LE_SCAN_TYPE, LE_SCAN_INT, | 2612 | if (lmp_host_le_capable(hdev)) |
2613 | err = hci_le_scan(hdev, LE_SCAN_TYPE, LE_SCAN_INT, | ||
2610 | LE_SCAN_WIN, LE_SCAN_TIMEOUT_LE_ONLY); | 2614 | LE_SCAN_WIN, LE_SCAN_TIMEOUT_LE_ONLY); |
2615 | else | ||
2616 | err = -ENOTSUPP; | ||
2611 | break; | 2617 | break; |
2612 | 2618 | ||
2613 | case DISCOV_TYPE_INTERLEAVED: | 2619 | case DISCOV_TYPE_INTERLEAVED: |