aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-04-26 14:01:22 -0400
committerMarcel Holtmann <marcel@holtmann.org>2009-04-28 12:31:38 -0400
commit052b30b0a8eec8db5b18ad49effdf2a9ba4c1e1a (patch)
treea7e772ecb7b13ef1d67e75e62ae00bb68cdf398c /include
parentf3784d834c71689336fa272df420b45345cb6b84 (diff)
Bluetooth: Add different pairing timeout for Legacy Pairing
The Bluetooth stack uses a reference counting for all established ACL links and if no user (L2CAP connection) is present, the link will be terminated to save power. The problem part is the dedicated pairing when using Legacy Pairing (Bluetooth 2.0 and before). At that point no user is present and pairing attempts will be disconnected within 10 seconds or less. In previous kernel version this was not a problem since the disconnect timeout wasn't triggered on incoming connections for the first time. However this caused issues with broken host stacks that kept the connections around after dedicated pairing. When the support for Simple Pairing got added, the link establishment procedure needed to be changed and now causes issues when using Legacy Pairing When using Simple Pairing it is possible to do a proper reference counting of ACL link users. With Legacy Pairing this is not possible since the specification is unclear in some areas and too many broken Bluetooth devices have already been deployed. So instead of trying to deal with all the broken devices, a special pairing timeout will be introduced that increases the timeout to 60 seconds when pairing is triggered. If a broken devices now puts the stack into an unforeseen state, the worst that happens is the disconnect timeout triggers after 120 seconds instead of 4 seconds. This allows successful pairings with legacy and broken devices now. Based on a report by Johan Hedberg <johan.hedberg@nokia.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/bluetooth/hci.h1
-rw-r--r--include/net/bluetooth/hci_core.h5
2 files changed, 4 insertions, 2 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index f69f015bbcc0..ed3aea1605e8 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -101,6 +101,7 @@ enum {
101/* HCI timeouts */ 101/* HCI timeouts */
102#define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */ 102#define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */
103#define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */ 103#define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */
104#define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */
104#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ 105#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */
105#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ 106#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */
106 107
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 1224bba24bdd..be5bd713d2c9 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -171,6 +171,7 @@ struct hci_conn {
171 __u8 auth_type; 171 __u8 auth_type;
172 __u8 sec_level; 172 __u8 sec_level;
173 __u8 power_save; 173 __u8 power_save;
174 __u16 disc_timeout;
174 unsigned long pend; 175 unsigned long pend;
175 176
176 unsigned int sent; 177 unsigned int sent;
@@ -349,9 +350,9 @@ static inline void hci_conn_put(struct hci_conn *conn)
349 if (conn->type == ACL_LINK) { 350 if (conn->type == ACL_LINK) {
350 del_timer(&conn->idle_timer); 351 del_timer(&conn->idle_timer);
351 if (conn->state == BT_CONNECTED) { 352 if (conn->state == BT_CONNECTED) {
352 timeo = msecs_to_jiffies(HCI_DISCONN_TIMEOUT); 353 timeo = msecs_to_jiffies(conn->disc_timeout);
353 if (!conn->out) 354 if (!conn->out)
354 timeo *= 5; 355 timeo *= 2;
355 } else 356 } else
356 timeo = msecs_to_jiffies(10); 357 timeo = msecs_to_jiffies(10);
357 } else 358 } else