[PATCH 6/6] [BLUETOOTH] ESCO interval rejection fix

Andres Salomon dilinger at canonical.com
Mon Apr 20 19:59:24 UTC 2009


From: Krishnan Nair <Krishnan.Nair at csr.com>

This fixes ESCO interval rejection issues; upon an interval rejection,
a SCO connection is attempted.  This patch comes from CSR.

Signed-off-by: Andres Salomon <dilinger at caononical.com>
---
 include/net/bluetooth/hci.h |    7 +++++++
 net/bluetooth/hci_conn.c    |    9 ++++++++-
 net/bluetooth/hci_event.c   |    6 ++++++
 3 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index a8a9eb6..f02be5b 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -136,6 +136,13 @@ enum {
 #define ESCO_EV3	0x0008
 #define ESCO_EV4	0x0010
 #define ESCO_EV5	0x0020
+#define ESCO_2EV3	0x0040
+#define ESCO_3EV3	0x0080
+#define ESCO_2EV5	0x0100
+#define ESCO_3EV5	0x0200
+
+#define SCO_ESCO_MASK	(ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
+#define EDR_ESCO_MASK	(ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
 
 /* ACL flags */
 #define ACL_CONT		0x01
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 34d1a3c..39c2ac3 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -121,8 +121,14 @@ void hci_add_sco(struct hci_conn *conn, __u16 handle)
 	conn->state = BT_CONNECT;
 	conn->out = 1;
 
+	conn->attempt++;
+
 	cp.handle   = cpu_to_le16(handle);
-	cp.pkt_type = cpu_to_le16(hdev->pkt_type & SCO_PTYPE_MASK);
+	if (conn->attempt > 1)
+		cp.pkt_type = (hdev->esco_type & SCO_ESCO_MASK) |
+				(hdev->esco_type & EDR_ESCO_MASK);
+	else
+		cp.pkt_type = cpu_to_le16(hdev->esco_type);
 
 	hci_send_cmd(hdev, HCI_OP_ADD_SCO, sizeof(cp), &cp);
 }
@@ -217,6 +223,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
 	conn->idle_timer.data = (unsigned long) conn;
 
 	atomic_set(&conn->refcnt, 0);
+	conn->sent = 0;
 
 	hci_dev_hold(hdev);
 
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 3361373..bc2347d 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1324,6 +1324,12 @@ static inline void hci_sync_conn_complete_evt(struct hci_dev *hdev, struct sk_bu
 		conn->type = SCO_LINK;
 	}
 
+	if (conn->out && ev->status == 0x1c && conn->attempt < 2) {
+		BT_INFO("reattempt due to ScoInterval rejected");
+		hci_setup_sync(conn, conn->link->handle);
+		goto unlock;
+	}
+
 	if (!ev->status) {
 		conn->handle = __le16_to_cpu(ev->handle);
 		conn->state  = BT_CONNECTED;
-- 
1.5.6.5





More information about the kernel-team mailing list