* [PATCH] Bluetooth: Check capabilities in BR/EDR and LE-Only discovery
@ 2012-02-23 21:09 Andre Guedes
2012-02-23 21:14 ` Marcel Holtmann
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Andre Guedes @ 2012-02-23 21:09 UTC (permalink / raw)
To: linux-bluetooth
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>
---
net/bluetooth/mgmt.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 93f2c13..de40918 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2552,12 +2552,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:
--
1.7.9.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] Bluetooth: Check capabilities in BR/EDR and LE-Only discovery
2012-02-23 21:09 [PATCH] Bluetooth: Check capabilities in BR/EDR and LE-Only discovery Andre Guedes
@ 2012-02-23 21:14 ` Marcel Holtmann
2012-02-23 21:23 ` Andre Guedes
2012-02-23 22:05 ` Marcel Holtmann
2012-03-01 15:05 ` Johan Hedberg
2 siblings, 1 reply; 6+ messages in thread
From: Marcel Holtmann @ 2012-02-23 21:14 UTC (permalink / raw)
To: Andre Guedes; +Cc: linux-bluetooth
Hi Andre,
> 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>
> ---
> net/bluetooth/mgmt.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 93f2c13..de40918 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -2552,12 +2552,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:
so what about interleaved. Should that actually suceed if LE is not
enabled?
Regards
Marcel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Bluetooth: Check capabilities in BR/EDR and LE-Only discovery
2012-02-23 21:14 ` Marcel Holtmann
@ 2012-02-23 21:23 ` Andre Guedes
2012-02-23 22:00 ` Marcel Holtmann
0 siblings, 1 reply; 6+ messages in thread
From: Andre Guedes @ 2012-02-23 21:23 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
Hi Marcel,
On Thu, Feb 23, 2012 at 6:14 PM, Marcel Holtmann <marcel@holtmann.org> wrot=
e:
> Hi Andre,
>
>> 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>
>> ---
>> =A0net/bluetooth/mgmt.c | =A0 10 ++++++++--
>> =A01 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
>> index 93f2c13..de40918 100644
>> --- a/net/bluetooth/mgmt.c
>> +++ b/net/bluetooth/mgmt.c
>> @@ -2552,12 +2552,18 @@ static int start_discovery(struct sock *sk, u16 =
index,
>>
>> =A0 =A0 =A0 switch (hdev->discovery.type) {
>> =A0 =A0 =A0 case DISCOV_TYPE_BREDR:
>> - =A0 =A0 =A0 =A0 =A0 =A0 err =3D hci_do_inquiry(hdev, INQUIRY_LEN_BREDR=
);
>> + =A0 =A0 =A0 =A0 =A0 =A0 if (lmp_bredr_capable(hdev))
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 err =3D hci_do_inquiry(hdev, I=
NQUIRY_LEN_BREDR);
>> + =A0 =A0 =A0 =A0 =A0 =A0 else
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 err =3D -ENOTSUPP;
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
>>
>> =A0 =A0 =A0 case DISCOV_TYPE_LE:
>> - =A0 =A0 =A0 =A0 =A0 =A0 err =3D hci_le_scan(hdev, LE_SCAN_TYPE, LE_SCA=
N_INT,
>> + =A0 =A0 =A0 =A0 =A0 =A0 if (lmp_host_le_capable(hdev))
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 err =3D hci_le_scan(hdev, LE_S=
CAN_TYPE, LE_SCAN_INT,
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 LE_SCAN_WIN, LE_SCAN_TIMEOUT_LE_ONLY);
>> + =A0 =A0 =A0 =A0 =A0 =A0 else
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 err =3D -ENOTSUPP;
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
>>
>> =A0 =A0 =A0 case DISCOV_TYPE_INTERLEAVED:
>
> so what about interleaved. Should that actually suceed if LE is not
> enabled?
For interleaved, we already check this capabilities.
According to the discussion in "[PATCH] Don't set LE flags in
mgmt_start_discovery", if an interleaved Start Discovery command is
issued but the device is not dual mode, we perform a regular BR/EDR
or LE-only discovery (according to device capabilities) instead of
returning error.
BR,
Andre
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Bluetooth: Check capabilities in BR/EDR and LE-Only discovery
2012-02-23 21:23 ` Andre Guedes
@ 2012-02-23 22:00 ` Marcel Holtmann
0 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2012-02-23 22:00 UTC (permalink / raw)
To: Andre Guedes; +Cc: linux-bluetooth
Hi Andre,
> >> 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>
> >> ---
> >> net/bluetooth/mgmt.c | 10 ++++++++--
> >> 1 file changed, 8 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> >> index 93f2c13..de40918 100644
> >> --- a/net/bluetooth/mgmt.c
> >> +++ b/net/bluetooth/mgmt.c
> >> @@ -2552,12 +2552,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:
> >
> > so what about interleaved. Should that actually suceed if LE is not
> > enabled?
>
> For interleaved, we already check this capabilities.
>
> According to the discussion in "[PATCH] Don't set LE flags in
> mgmt_start_discovery", if an interleaved Start Discovery command is
> issued but the device is not dual mode, we perform a regular BR/EDR
> or LE-only discovery (according to device capabilities) instead of
> returning error.
is that a behavior we really want? Comments anyone?
Regards
Marcel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Bluetooth: Check capabilities in BR/EDR and LE-Only discovery
2012-02-23 21:09 [PATCH] Bluetooth: Check capabilities in BR/EDR and LE-Only discovery Andre Guedes
2012-02-23 21:14 ` Marcel Holtmann
@ 2012-02-23 22:05 ` Marcel Holtmann
2012-03-01 15:05 ` Johan Hedberg
2 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2012-02-23 22:05 UTC (permalink / raw)
To: Andre Guedes; +Cc: linux-bluetooth
Hi Andre,
> 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>
> ---
> net/bluetooth/mgmt.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
so besides my other comment, this patch can go in as is and we have to
add an extra patch to handle interleaved once we talked through what's
the best approach.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Bluetooth: Check capabilities in BR/EDR and LE-Only discovery
2012-02-23 21:09 [PATCH] Bluetooth: Check capabilities in BR/EDR and LE-Only discovery Andre Guedes
2012-02-23 21:14 ` Marcel Holtmann
2012-02-23 22:05 ` Marcel Holtmann
@ 2012-03-01 15:05 ` Johan Hedberg
2 siblings, 0 replies; 6+ messages in thread
From: Johan Hedberg @ 2012-03-01 15:05 UTC (permalink / raw)
To: Andre Guedes; +Cc: linux-bluetooth
Hi Andre,
On Thu, Feb 23, 2012, Andre Guedes wrote:
> 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>
> ---
> net/bluetooth/mgmt.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
Applied. Thanks.
Johan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-03-01 15:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-23 21:09 [PATCH] Bluetooth: Check capabilities in BR/EDR and LE-Only discovery Andre Guedes
2012-02-23 21:14 ` Marcel Holtmann
2012-02-23 21:23 ` Andre Guedes
2012-02-23 22:00 ` Marcel Holtmann
2012-02-23 22:05 ` Marcel Holtmann
2012-03-01 15:05 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).