From: Ville Tervo <ville.tervo@nokia.com>
To: linux-bluetooth@vger.kernel.org
Cc: Ville Tervo <ville.tervo@nokia.com>
Subject: [PATCH 1/1] [BLUETOOTH] Disable incoming connection tracking in DUT mode
Date: Thu, 25 Sep 2008 10:59:01 +0300 [thread overview]
Message-ID: <1222329541-4898-1-git-send-email-ville.tervo@nokia.com> (raw)
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@nokia.com>
---
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
next reply other threads:[~2008-09-25 7:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-25 7:59 Ville Tervo [this message]
2008-09-27 5:29 ` [PATCH 1/1] [BLUETOOTH] Disable incoming connection tracking in DUT mode Marcel Holtmann
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=1222329541-4898-1-git-send-email-ville.tervo@nokia.com \
--to=ville.tervo@nokia.com \
--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