Re: [PATCH] Bluetooth: Fix HCI_RESET command syncronization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> No, it's based on bluetooth-next (2.6.39). But you can drop the hci_cmd_timer
> part while testing it. It's not needed unless you have and hci_reset cmd
> timeout.
>
> --
> Gustavo F. Padovan
> http://profusion.mobi
>

o.k. works over here..
Tested-by: Justin P. Mattock <justinmattock@xxxxxxxxx>

here is an updated patch for the current Mainline if anybody needs it:

---
 include/net/bluetooth/hci.h |    1 +
 net/bluetooth/hci_core.c    |    1 +
 net/bluetooth/hci_event.c   |    4 +++-
 3 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 29a7a8c..c4f4c42 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -76,6 +76,7 @@ enum {
 	HCI_INQUIRY,

 	HCI_RAW,
+	HCI_RESET,
 };

 /* HCI ioctl defines */
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 9c4541b..07a1a4c 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -522,6 +522,7 @@ int hci_dev_open(__u16 dev)
 		atomic_set(&hdev->cmd_cnt, 1);
 		set_bit(HCI_INIT, &hdev->flags);

+		set_bit(HCI_RESET, &hdev->flags);	
 		//__hci_request(hdev, hci_reset_req, 0, HZ);
 		ret = __hci_request(hdev, hci_init_req, 0,
 					msecs_to_jiffies(HCI_INIT_TIMEOUT));
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index a290854..a63bcf0 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -183,6 +183,8 @@ static void hci_cc_reset(struct hci_dev *hdev,
struct sk_buff *skb)

 	BT_DBG("%s status 0x%x", hdev->name, status);

+	clear_bit(HCI_RESET, &hdev->flags);
+
 	hci_req_complete(hdev, HCI_OP_RESET, status);
 }

@@ -1464,7 +1466,7 @@ static inline void hci_cmd_status_evt(struct
hci_dev *hdev, struct sk_buff *skb)
 		break;
 	}

-	if (ev->ncmd) {
+	if (ev->ncmd && !test_bit(HCI_RESET, &hdev->flags)) {
 		atomic_set(&hdev->cmd_cnt, 1);
 		if (!skb_queue_empty(&hdev->cmd_q))
 			tasklet_schedule(&hdev->cmd_task);
-- 
1.7.4.1


-- 
Justin P. Mattock
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux