linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/2] Bluetooth: mgmt: Fix enabling SSP while powered off
@ 2012-08-29  8:02 Andrzej Kaczmarek
  2012-08-29  8:02 ` [PATCH v3 2/2] Bluetooth: mgmt: Fix enabling LE " Andrzej Kaczmarek
  2012-09-03 11:53 ` [PATCH v3 1/2] Bluetooth: mgmt: Fix enabling SSP " Johan Hedberg
  0 siblings, 2 replies; 5+ messages in thread
From: Andrzej Kaczmarek @ 2012-08-29  8:02 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Andrzej Kaczmarek, stable

When new BT USB adapter is plugged in it's configured while still being powered
off (HCI_AUTO_OFF flag is set), thus Set SSP will only set dev_flags but won't
write changes to controller. As a result remote devices won't use Secure Simple
Pairing with our device due to SSP Host Support flag disabled in extended
features and may also reject SSP attempt from our side (with possible fallback
to legacy pairing).

This patch ensures HCI Write Simple Pairing Mode is sent when Set Powered is
called to power on controller and clear HCI_AUTO_OFF flag.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
Cc: stable@vger.kernel.org
---
 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] 5+ messages in thread

* [PATCH v3 2/2] Bluetooth: mgmt: Fix enabling LE while powered off
  2012-08-29  8:02 [PATCH v3 1/2] Bluetooth: mgmt: Fix enabling SSP while powered off Andrzej Kaczmarek
@ 2012-08-29  8:02 ` Andrzej Kaczmarek
  2012-09-03 11:53   ` Johan Hedberg
  2012-09-08 19:46   ` Gustavo Padovan
  2012-09-03 11:53 ` [PATCH v3 1/2] Bluetooth: mgmt: Fix enabling SSP " Johan Hedberg
  1 sibling, 2 replies; 5+ messages in thread
From: Andrzej Kaczmarek @ 2012-08-29  8:02 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Andrzej Kaczmarek, stable

When new BT USB adapter is plugged in it's configured while still being powered
off (HCI_AUTO_OFF flag is set), thus Set LE will only set dev_flags but won't
write changes to controller. As a result it's not possible to start device
discovery session on LE controller as it uses interleaved discovery which
requires LE Supported Host flag in extended features.

This patch ensures HCI Write LE Host Supported is sent when Set Powered is
called to power on controller and clear HCI_AUTO_OFF flag.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
Cc: stable@vger.kernel.org
---
 net/bluetooth/mgmt.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index ccc6716..57ce7cd 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2897,6 +2897,16 @@ 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;
+
+			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] 5+ messages in thread

* Re: [PATCH v3 1/2] Bluetooth: mgmt: Fix enabling SSP while powered off
  2012-08-29  8:02 [PATCH v3 1/2] Bluetooth: mgmt: Fix enabling SSP while powered off Andrzej Kaczmarek
  2012-08-29  8:02 ` [PATCH v3 2/2] Bluetooth: mgmt: Fix enabling LE " Andrzej Kaczmarek
@ 2012-09-03 11:53 ` Johan Hedberg
  1 sibling, 0 replies; 5+ messages in thread
From: Johan Hedberg @ 2012-09-03 11:53 UTC (permalink / raw)
  To: Andrzej Kaczmarek; +Cc: linux-bluetooth, stable

Hi Andrzej,

On Wed, Aug 29, 2012, Andrzej Kaczmarek wrote:
> When new BT USB adapter is plugged in it's configured while still being powered
> off (HCI_AUTO_OFF flag is set), thus Set SSP will only set dev_flags but won't
> write changes to controller. As a result remote devices won't use Secure Simple
> Pairing with our device due to SSP Host Support flag disabled in extended
> features and may also reject SSP attempt from our side (with possible fallback
> to legacy pairing).
> 
> This patch ensures HCI Write Simple Pairing Mode is sent when Set Powered is
> called to power on controller and clear HCI_AUTO_OFF flag.
> 
> Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
> Cc: stable@vger.kernel.org
> ---
>  net/bluetooth/mgmt.c | 6 ++++++
>  1 file changed, 6 insertions(+)

Acked-by: Johan Hedberg <johan.hedberg@intel.com>

Johan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 2/2] Bluetooth: mgmt: Fix enabling LE while powered off
  2012-08-29  8:02 ` [PATCH v3 2/2] Bluetooth: mgmt: Fix enabling LE " Andrzej Kaczmarek
@ 2012-09-03 11:53   ` Johan Hedberg
  2012-09-08 19:46   ` Gustavo Padovan
  1 sibling, 0 replies; 5+ messages in thread
From: Johan Hedberg @ 2012-09-03 11:53 UTC (permalink / raw)
  To: Andrzej Kaczmarek; +Cc: linux-bluetooth, stable

Hi Andrzej,

On Wed, Aug 29, 2012, Andrzej Kaczmarek wrote:
> When new BT USB adapter is plugged in it's configured while still being powered
> off (HCI_AUTO_OFF flag is set), thus Set LE will only set dev_flags but won't
> write changes to controller. As a result it's not possible to start device
> discovery session on LE controller as it uses interleaved discovery which
> requires LE Supported Host flag in extended features.
> 
> This patch ensures HCI Write LE Host Supported is sent when Set Powered is
> called to power on controller and clear HCI_AUTO_OFF flag.
> 
> Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
> Cc: stable@vger.kernel.org
> ---
>  net/bluetooth/mgmt.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)

Acked-by: Johan Hedberg <johan.hedberg@intel.com>

Johan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 2/2] Bluetooth: mgmt: Fix enabling LE while powered off
  2012-08-29  8:02 ` [PATCH v3 2/2] Bluetooth: mgmt: Fix enabling LE " Andrzej Kaczmarek
  2012-09-03 11:53   ` Johan Hedberg
@ 2012-09-08 19:46   ` Gustavo Padovan
  1 sibling, 0 replies; 5+ messages in thread
From: Gustavo Padovan @ 2012-09-08 19:46 UTC (permalink / raw)
  To: Andrzej Kaczmarek; +Cc: linux-bluetooth, stable

Hi Andrzej,

* Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com> [2012-08-29 10:02:09 +0200]:

> When new BT USB adapter is plugged in it's configured while still being powered
> off (HCI_AUTO_OFF flag is set), thus Set LE will only set dev_flags but won't
> write changes to controller. As a result it's not possible to start device
> discovery session on LE controller as it uses interleaved discovery which
> requires LE Supported Host flag in extended features.
> 
> This patch ensures HCI Write LE Host Supported is sent when Set Powered is
> called to power on controller and clear HCI_AUTO_OFF flag.
> 
> Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
> Cc: stable@vger.kernel.org
> ---
>  net/bluetooth/mgmt.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)

Both patches have been applied to bluetooth.git. Thanks

	Gustavo

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-09-08 19:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-29  8:02 [PATCH v3 1/2] Bluetooth: mgmt: Fix enabling SSP while powered off Andrzej Kaczmarek
2012-08-29  8:02 ` [PATCH v3 2/2] Bluetooth: mgmt: Fix enabling LE " Andrzej Kaczmarek
2012-09-03 11:53   ` Johan Hedberg
2012-09-08 19:46   ` Gustavo Padovan
2012-09-03 11:53 ` [PATCH v3 1/2] Bluetooth: mgmt: Fix enabling SSP " 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).