]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Bluetooth: Store latency and supervision timeout in connection params
authorMarcel Holtmann <marcel@holtmann.org>
Sun, 29 Jun 2014 14:43:26 +0000 (16:43 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 3 Jul 2014 15:42:50 +0000 (17:42 +0200)
When the slave updates the connection parameters, store also the
connection latency and supervision timeout information in the
internal list of connection parameters for known devices.

Having these values available allowes the auto-connection
procedure to use the correct values from the beginning without
having to request an update on every connection establishment.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
include/net/bluetooth/hci_core.h
net/bluetooth/hci_conn.c
net/bluetooth/hci_core.c

index 0906990dedd8e08476d965c3fa7739bb0ccf0d09..182044824495ff58f8cc7fb8ca0ec2f25f516d4f 100644 (file)
@@ -439,6 +439,8 @@ struct hci_conn_params {
 
        u16 conn_min_interval;
        u16 conn_max_interval;
+       u16 conn_latency;
+       u16 supervision_timeout;
 
        enum {
                HCI_AUTO_CONN_DISABLED,
index 25ee27ddc882ba002295b95400842c6aa31577c0..adb413d77637b58a5bc3fc50da8268708535ccf2 100644 (file)
@@ -216,11 +216,23 @@ bool hci_setup_sync(struct hci_conn *conn, __u16 handle)
 void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
                        u16 latency, u16 to_multiplier)
 {
-       struct hci_cp_le_conn_update cp;
        struct hci_dev *hdev = conn->hdev;
+       struct hci_conn_params *params;
+       struct hci_cp_le_conn_update cp;
 
-       memset(&cp, 0, sizeof(cp));
+       hci_dev_lock(hdev);
+
+       params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type);
+       if (params) {
+               params->conn_min_interval = min;
+               params->conn_max_interval = max;
+               params->conn_latency = latency;
+               params->supervision_timeout = to_multiplier;
+       }
 
+       hci_dev_unlock(hdev);
+
+       memset(&cp, 0, sizeof(cp));
        cp.handle               = cpu_to_le16(conn->handle);
        cp.conn_interval_min    = cpu_to_le16(min);
        cp.conn_interval_max    = cpu_to_le16(max);
index c566b57610c93dd03d33b1bbbc3d70aa48873601..97a6453bee30f20f8066435091989f3b002aaa7c 100644 (file)
@@ -3514,6 +3514,8 @@ int hci_conn_params_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type,
 update:
        params->conn_min_interval = conn_min_interval;
        params->conn_max_interval = conn_max_interval;
+       params->conn_latency = 0x0000;
+       params->supervision_timeout = 0x002a;
        params->auto_connect = auto_connect;
 
        switch (auto_connect) {