[PATCH 1/1] [BLUETOOTH] Disable incoming connection tracking in DUT mode

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

 



Bluetooth testers establish only low level connection and they won't
connect to any service. If connection tracking is enabled the connection
will drop in 10 seconds. This patch adds support for detecting DUT mode
event and disables incoming connection tracking is status code was
succesfull.

Signed-off-by: Ville Tervo <ville.tervo@xxxxxxxxx>
---
 include/net/bluetooth/hci.h      |    7 +++++++
 include/net/bluetooth/hci_core.h |    3 +++
 net/bluetooth/hci_event.c        |   12 ++++++++++++
 3 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 3cc2949..1279788 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -72,6 +72,8 @@ enum {
 	HCI_INQUIRY,
 
 	HCI_RAW,
+
+	HCI_DUT_MODE,
 };
 
 /* HCI ioctl defines */
@@ -577,6 +579,11 @@ struct hci_rp_read_bd_addr {
 	bdaddr_t bdaddr;
 } __attribute__ ((packed));
 
+#define HCI_OP_ENABLE_DUT_MODE		0x1803
+struct hci_rp_enable_dut_mode {
+	__u8	status;
+} __attribute__ ((packed));
+
 /* ---- HCI Events ---- */
 #define HCI_EV_INQUIRY_COMPLETE		0x01
 
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 46a43b7..019cd93 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -355,6 +355,9 @@ static inline void hci_conn_put(struct hci_conn *conn)
 				timeo = msecs_to_jiffies(10);
 		} else
 			timeo = msecs_to_jiffies(10);
+
+		if (test_bit(HCI_DUT_MODE, &conn->hdev->flags) && !conn->out)
+			return;
 		mod_timer(&conn->disc_timer, jiffies + timeo);
 	}
 }
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index ad7a553..f2227d0 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -535,6 +535,14 @@ static void hci_cc_read_bd_addr(struct hci_dev *hdev, struct sk_buff *skb)
 	hci_req_complete(hdev, rp->status);
 }
 
+static void hci_cc_enable_dut_mode(struct hci_dev *hdev, struct sk_buff *skb)
+{
+	struct hci_rp_enable_dut_mode *rp = (void *) skb->data;
+
+	if (!rp->status)
+		set_bit(HCI_DUT_MODE, &hdev->flags);
+}
+
 static inline void hci_cs_inquiry(struct hci_dev *hdev, __u8 status)
 {
 	BT_DBG("%s status 0x%x", hdev->name, status);
@@ -1294,6 +1302,10 @@ static inline void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *sk
 		hci_cc_read_bd_addr(hdev, skb);
 		break;
 
+	case HCI_OP_ENABLE_DUT_MODE:
+		hci_cc_enable_dut_mode(hdev, skb);
+		break;
+
 	default:
 		BT_DBG("%s opcode 0x%x", hdev->name, opcode);
 		break;
-- 
1.5.6.3

--
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