linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Justin P. Mattock" <justinmattock@gmail.com>
To: Mikko Vinni <mmvinni@yahoo.com>
Cc: Johan Hedberg <johan.hedberg@gmail.com>,
	linux-bluetooth@vger.kernel.org, Ed Tomlinson <edt@aei.ca>,
	"Gustavo F. Padovan" <padovan@profusion.mobi>
Subject: Re: re "bluetooth disabled" and "[BUG] usb problems in .38-rc3+"
Date: Wed, 09 Mar 2011 13:23:55 -0800	[thread overview]
Message-ID: <4D77EFEB.1020804@gmail.com> (raw)
In-Reply-To: <359639.21781.qm@web161807.mail.bf1.yahoo.com>


looking more into this issue I am noticing that it seems this might be a 
timing issue. I have tried adding msleep to the function but endedup 
having a system freeze(only because I am not sure how msleep 
works)udelay I have not played around with just yet.

the below patch gets everything working for me:


 From 8065e37b546cdf6e42a5de4277e08ebba0a18637 Mon Sep 17 00:00:00 2001
From: Justin P. Mattock <justinmattock@gmail.com>
Date: Tue, 8 Mar 2011 22:01:19 -0800
Subject: [PATCH] bluetooth_bug_fix_test_1
  Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>

---
  net/bluetooth/hci_core.c |   11 +++++------
  1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 9c4541b..f690eb5 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -95,18 +95,17 @@ void hci_req_complete(struct hci_dev *hdev, __u16 
cmd, int result)
  {
  	BT_DBG("%s command 0x%04x result 0x%2.2x", hdev->name, cmd, result);

+	if (hdev->req_status == HCI_REQ_PEND) {
+		hdev->req_result = result;
+		hdev->req_status = HCI_REQ_DONE;
+		wake_up_interruptible(&hdev->req_wait_q);
+	}
  	/* If the request has set req_last_cmd (typical for multi-HCI
  	 * command requests) check if the completed command matches
  	 * this, and if not just return. Single HCI command requests
  	 * typically leave req_last_cmd as 0 */
  	if (hdev->req_last_cmd && cmd != hdev->req_last_cmd)
  		return;
-
-	if (hdev->req_status == HCI_REQ_PEND) {
-		hdev->req_result = result;
-		hdev->req_status = HCI_REQ_DONE;
-		wake_up_interruptible(&hdev->req_wait_q);
-	}
  }

  static void hci_req_cancel(struct hci_dev *hdev, int err)
-- 
1.7.4.1


I have done multiple reboots warm/cold and the bluetooth connects 
everytime with the above. If this seems to be a good solution let me 
know, if its not then maybe udelay/msleep is better(or not!)

Justin P. Mattock

  parent reply	other threads:[~2011-03-09 21:23 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-28 22:29 re "bluetooth disabled" and "[BUG] usb problems in .38-rc3+" Mikko Vinni
2011-03-01  5:51 ` Justin Mattock
2011-03-02 14:00 ` Johan Hedberg
2011-03-03 10:54   ` Mikko Vinni
2011-03-03 14:31     ` Johan Hedberg
2011-03-04  4:47       ` Ville Tervo
2011-03-07 19:50       ` Mikko Vinni
2011-03-08 22:30         ` Justin P. Mattock
2011-03-09 21:23         ` Justin P. Mattock [this message]
2011-03-10  2:54           ` Ed Tomlinson
2011-03-10  7:32             ` Johan Hedberg
2011-03-10 18:02               ` Justin P. Mattock
2011-03-12  1:33               ` Gustavo F. Padovan
2011-03-12 17:44                 ` Justin P. Mattock
2011-03-16 18:44                   ` [PATCH] Bluetooth: Fix HCI_RESET command syncronization Gustavo F. Padovan
2011-03-16 18:46                     ` Gustavo F. Padovan
2011-03-16 18:48                       ` Anderson Lizardo
2011-03-16 19:01                         ` Gustavo F. Padovan
2011-03-16 19:11                           ` Justin P. Mattock
2011-03-16 19:15                             ` Gustavo F. Padovan
2011-03-16 20:02                               ` Justin Mattock
2011-03-16 21:13                                 ` Mikko Vinni
2011-03-16 22:33                                 ` Ed Tomlinson
2011-03-17 10:35                     ` Szymon Janc
2011-03-17 16:48                       ` Gustavo F. Padovan

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=4D77EFEB.1020804@gmail.com \
    --to=justinmattock@gmail.com \
    --cc=edt@aei.ca \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=mmvinni@yahoo.com \
    --cc=padovan@profusion.mobi \
    /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).