This patch prepares start_discovery() to support LE-Only and BR/EDR/LE discovery procedures (BR/EDR is already supported). Signed-off-by: Andre Guedes <andre.guedes@xxxxxxxxxxxxx> --- include/net/bluetooth/hci.h | 1 + include/net/bluetooth/hci_core.h | 1 + net/bluetooth/mgmt.c | 10 +++++++++- 3 files changed, 11 insertions(+), 1 deletions(-) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index be30aab..653daec 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -202,6 +202,7 @@ enum { #define LMP_EV4 0x01 #define LMP_EV5 0x02 +#define LMP_NO_BREDR 0x20 #define LMP_LE 0x40 #define LMP_SNIFF_SUBR 0x02 diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 6c2b8b5..68178e1 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -615,6 +615,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn); #define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO) #define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) #define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) +#define lmp_bredr_capable(dev) (!((dev)->features[4] & LMP_NO_BREDR)) #define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) /* ----- Extended LMP capabilities ----- */ diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 31c3d2a..0a2c610 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -32,6 +32,8 @@ #define MGMT_VERSION 0 #define MGMT_REVISION 1 +#define INQUIRY_LEN_BREDR 0x08 /* TGAP(100) */ + struct pending_cmd { struct list_head list; __u16 opcode; @@ -1653,7 +1655,13 @@ static int start_discovery(struct sock *sk, u16 index) goto failed; } - err = hci_do_inquiry(hdev, 0x08); + if (lmp_host_le_capable(hdev) && lmp_bredr_capable(hdev)) + err = -ENOSYS; + else if (lmp_host_le_capable(hdev)) + err = -ENOSYS; + else + err = hci_do_inquiry(hdev, INQUIRY_LEN_BREDR); + if (err < 0) mgmt_pending_remove(cmd); -- 1.7.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html