linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andre Guedes <andre.guedes@openbossa.org>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH] Bluetooth: Set DISCOVERY_STOPPED if controller resets
Date: Fri, 17 Feb 2012 20:12:40 -0300	[thread overview]
Message-ID: <1329520360-16874-1-git-send-email-andre.guedes@openbossa.org> (raw)

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


             reply	other threads:[~2012-02-17 23:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-17 23:12 Andre Guedes [this message]
2012-02-18  6:38 ` [PATCH] Bluetooth: Set DISCOVERY_STOPPED if controller resets Marcel Holtmann
2012-02-23 14:54 ` Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1329520360-16874-1-git-send-email-andre.guedes@openbossa.org \
    --to=andre.guedes@openbossa.org \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).