Thread (4 messages) flat view 4 messages, 2 authors, 2012-08-28
STALE5118d

[PATCH 2/2] Bluetooth: mgmt: Fix enabling LE while powered off

From: Andrzej Kaczmarek <hidden>
Date: 2012-08-27 14:47:30
Subsystem: bluetooth subsystem, the rest · Maintainers: Marcel Holtmann, Luiz Augusto von Dentz, Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help