Thread (3 messages) flat view 3 messages, 3 authors, 2012-02-23
STALE5321d

[PATCH] Bluetooth: Set DISCOVERY_STOPPED if controller resets

From: Andre Guedes <hidden>
Date: 2012-02-17 23:12:40
Subsystem: bluetooth subsystem, the rest · Maintainers: Marcel Holtmann, Luiz Augusto von Dentz, Linus Torvalds

If controller is reset during the discovery procedure, Start
Discovery command stops working. This can be easily reproduced
by running "hciconfig hci0 reset" while discovering devices,
for instance.

We should force discovery state to DISCOVERY_STOPPED in case we
receive a reset command complete event. Otherwise we may stuck
in one of the active discovery states (DISCOVERY_INQUIRY,
DISCOVERY_LE_SCAN and DISCOVERY_RESOLVING) and subsequent Start
Discovery commands will simply fail.

Signed-off-by: Andre Guedes <redacted>
---
 net/bluetooth/hci_event.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 179d127..6bd3bd2 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -198,6 +198,8 @@ static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb)
 	/* Reset all flags, except persistent ones */
 	hdev->dev_flags &= BIT(HCI_MGMT) | BIT(HCI_SETUP) | BIT(HCI_AUTO_OFF) |
 				BIT(HCI_LINK_KEYS) | BIT(HCI_DEBUG_KEYS);
+
+	hdev->discovery.state = DISCOVERY_STOPPED;
 }
 
 static void hci_cc_write_local_name(struct hci_dev *hdev, struct sk_buff *skb)
-- 
1.7.9.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help