Skip to content

Commit

Permalink
Bluetooth: Check capabilities in BR/EDR and LE-Only discovery
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andre Guedes authored and Gustavo F. Padovan committed Mar 1, 2012
1 parent 1de028c commit 8b90129
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -2602,12 +2602,18 @@ static int start_discovery(struct sock *sk, u16 index,

switch (hdev->discovery.type) {
case DISCOV_TYPE_BREDR:
err = hci_do_inquiry(hdev, INQUIRY_LEN_BREDR);
if (lmp_bredr_capable(hdev))
err = hci_do_inquiry(hdev, INQUIRY_LEN_BREDR);
else
err = -ENOTSUPP;
break;

case DISCOV_TYPE_LE:
err = hci_le_scan(hdev, LE_SCAN_TYPE, LE_SCAN_INT,
if (lmp_host_le_capable(hdev))
err = hci_le_scan(hdev, LE_SCAN_TYPE, LE_SCAN_INT,
LE_SCAN_WIN, LE_SCAN_TIMEOUT_LE_ONLY);
else
err = -ENOTSUPP;
break;

case DISCOV_TYPE_INTERLEAVED:
Expand Down

0 comments on commit 8b90129

Please sign in to comment.