All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Set DISCOVERY_STOPPED if controller resets
@ 2012-02-17 23:12 Andre Guedes
  2012-02-18  6:38 ` Marcel Holtmann
  2012-02-23 14:54 ` Johan Hedberg
  0 siblings, 2 replies; 3+ messages in thread
From: Andre Guedes @ 2012-02-17 23:12 UTC (permalink / raw)
  To: linux-bluetooth

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 <andre.guedes@openbossa.org>
---
 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


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

* Re: [PATCH] Bluetooth: Set DISCOVERY_STOPPED if controller resets
  2012-02-17 23:12 [PATCH] Bluetooth: Set DISCOVERY_STOPPED if controller resets Andre Guedes
@ 2012-02-18  6:38 ` Marcel Holtmann
  2012-02-23 14:54 ` Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2012-02-18  6:38 UTC (permalink / raw)
  To: Andre Guedes; +Cc: linux-bluetooth

Hi Andre,

> 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 <andre.guedes@openbossa.org>
> ---
>  net/bluetooth/hci_event.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)

Acked-by: Marcel Holtmann <marcel@holtmann.org>

Regards

Marcel



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

* Re: [PATCH] Bluetooth: Set DISCOVERY_STOPPED if controller resets
  2012-02-17 23:12 [PATCH] Bluetooth: Set DISCOVERY_STOPPED if controller resets Andre Guedes
  2012-02-18  6:38 ` Marcel Holtmann
@ 2012-02-23 14:54 ` Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2012-02-23 14:54 UTC (permalink / raw)
  To: Andre Guedes; +Cc: linux-bluetooth

Hi Andre,

On Fri, Feb 17, 2012, Andre Guedes wrote:
> 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 <andre.guedes@openbossa.org>
> ---
>  net/bluetooth/hci_event.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)

Applied (after manual fixes to match the latest tree). Thanks.

Johan

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

end of thread, other threads:[~2012-02-23 14:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-17 23:12 [PATCH] Bluetooth: Set DISCOVERY_STOPPED if controller resets Andre Guedes
2012-02-18  6:38 ` Marcel Holtmann
2012-02-23 14:54 ` Johan Hedberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.