* [PATCH 1/2] Bluetooth: mgmt: Fix enabling SSP while powered off
@ 2012-08-27 14:47 Andrzej Kaczmarek
2012-08-27 14:47 ` [PATCH 2/2] Bluetooth: mgmt: Fix enabling LE " Andrzej Kaczmarek
0 siblings, 1 reply; 4+ messages in thread
From: Andrzej Kaczmarek @ 2012-08-27 14:47 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Andrzej Kaczmarek
Set SSP called when hdev is up but still has HCI_AUTO_OFF flag set will
only change dev_flags and enable feature in host but won't enable feature
in controller. As a result some devices will reject IO Capa Request due to
missing SSP Host Support flag in extended features and thus won't allow
SSP or fallback to legacy pairing.
This patch ensures HCI Write Simple Pairing Mode is sent when Set Powered is
called to clear HCI_AUTO_OFF flag.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
---
net/bluetooth/mgmt.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 05d4b83..ccc6716 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2891,6 +2891,12 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
if (scan)
hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
+ if (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) {
+ u8 ssp = 1;
+
+ hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, 1, &ssp);
+ }
+
update_class(hdev);
update_name(hdev, hdev->dev_name);
update_eir(hdev);
--
1.7.11.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] Bluetooth: mgmt: Fix enabling LE while powered off
2012-08-27 14:47 [PATCH 1/2] Bluetooth: mgmt: Fix enabling SSP while powered off Andrzej Kaczmarek
@ 2012-08-27 14:47 ` Andrzej Kaczmarek
2012-08-28 7:40 ` Andrei Emeltchenko
0 siblings, 1 reply; 4+ messages in thread
From: Andrzej Kaczmarek @ 2012-08-27 14:47 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Andrzej Kaczmarek
Set LE called when hdev is up but still has HCI_AUTO_OFF flag set will
only change dev_flags and enable feature in host but won't enable feature
in controller. As a resulit it's not possible to e.g. start LE only or
interleaved discovery due to missing LE Supported flag in local features.
This patch ensures HCI Write LE Host Supported is sent when Set Powered is
called to clear HCI_AUTO_OFF flag.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
---
net/bluetooth/mgmt.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index ccc6716..f73441f 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2897,6 +2897,17 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, 1, &ssp);
}
+ if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) {
+ struct hci_cp_write_le_host_supported cp;
+
+ memset(&cp, 0, sizeof(cp));
+ cp.le = 1;
+ cp.simul = !!(hdev->features[6] & LMP_SIMUL_LE_BR);
+
+ hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED,
+ sizeof(cp), &cp);
+ }
+
update_class(hdev);
update_name(hdev, hdev->dev_name);
update_eir(hdev);
--
1.7.11.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] Bluetooth: mgmt: Fix enabling LE while powered off
2012-08-27 14:47 ` [PATCH 2/2] Bluetooth: mgmt: Fix enabling LE " Andrzej Kaczmarek
@ 2012-08-28 7:40 ` Andrei Emeltchenko
2012-08-28 9:43 ` Andrzej Kaczmarek
0 siblings, 1 reply; 4+ messages in thread
From: Andrei Emeltchenko @ 2012-08-28 7:40 UTC (permalink / raw)
To: Andrzej Kaczmarek; +Cc: linux-bluetooth
Hi Andrzej,
On Mon, Aug 27, 2012 at 04:47:30PM +0200, Andrzej Kaczmarek wrote:
> Set LE called when hdev is up but still has HCI_AUTO_OFF flag set will
> only change dev_flags and enable feature in host but won't enable feature
> in controller. As a resulit it's not possible to e.g. start LE only or
> interleaved discovery due to missing LE Supported flag in local features.
>
> This patch ensures HCI Write LE Host Supported is sent when Set Powered is
> called to clear HCI_AUTO_OFF flag.
>
> Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
> ---
> net/bluetooth/mgmt.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index ccc6716..f73441f 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -2897,6 +2897,17 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
> hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, 1, &ssp);
> }
>
> + if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) {
> + struct hci_cp_write_le_host_supported cp;
> +
> + memset(&cp, 0, sizeof(cp));
Why memset is needed here?
Best regards
Andrei Emeltchenko
> + cp.le = 1;
> + cp.simul = !!(hdev->features[6] & LMP_SIMUL_LE_BR);
> +
> + hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED,
> + sizeof(cp), &cp);
> + }
> +
> update_class(hdev);
> update_name(hdev, hdev->dev_name);
> update_eir(hdev);
> --
> 1.7.11.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] Bluetooth: mgmt: Fix enabling LE while powered off
2012-08-28 7:40 ` Andrei Emeltchenko
@ 2012-08-28 9:43 ` Andrzej Kaczmarek
0 siblings, 0 replies; 4+ messages in thread
From: Andrzej Kaczmarek @ 2012-08-28 9:43 UTC (permalink / raw)
To: Andrei Emeltchenko, linux-bluetooth
Hi Andrei,
On 08/28/2012 09:40 AM, Andrei Emeltchenko wrote:
> Hi Andrzej,
>
> On Mon, Aug 27, 2012 at 04:47:30PM +0200, Andrzej Kaczmarek wrote:
>> Set LE called when hdev is up but still has HCI_AUTO_OFF flag set will
>> only change dev_flags and enable feature in host but won't enable feature
>> in controller. As a resulit it's not possible to e.g. start LE only or
>> interleaved discovery due to missing LE Supported flag in local features.
>>
>> This patch ensures HCI Write LE Host Supported is sent when Set Powered is
>> called to clear HCI_AUTO_OFF flag.
>>
>> Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
>> ---
>> net/bluetooth/mgmt.c | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>>
>> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
>> index ccc6716..f73441f 100644
>> --- a/net/bluetooth/mgmt.c
>> +++ b/net/bluetooth/mgmt.c
>> @@ -2897,6 +2897,17 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
>> hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, 1, &ssp);
>> }
>>
>> + if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) {
>> + struct hci_cp_write_le_host_supported cp;
>> +
>> + memset(&cp, 0, sizeof(cp));
>
> Why memset is needed here?
Not really needed, I forgot to remove it after copy&paste from other
code. I'll send v2 later with memset removed.
BR,
Andrzej
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-08-28 9:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-27 14:47 [PATCH 1/2] Bluetooth: mgmt: Fix enabling SSP while powered off Andrzej Kaczmarek
2012-08-27 14:47 ` [PATCH 2/2] Bluetooth: mgmt: Fix enabling LE " Andrzej Kaczmarek
2012-08-28 7:40 ` Andrei Emeltchenko
2012-08-28 9:43 ` Andrzej Kaczmarek
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).