Commit f044eb05 authored by Marcel Holtmann's avatar Marcel Holtmann

Bluetooth: Store latency and supervision timeout in connection params

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: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent 1c1697c0
...@@ -439,6 +439,8 @@ struct hci_conn_params { ...@@ -439,6 +439,8 @@ struct hci_conn_params {
u16 conn_min_interval; u16 conn_min_interval;
u16 conn_max_interval; u16 conn_max_interval;
u16 conn_latency;
u16 supervision_timeout;
enum { enum {
HCI_AUTO_CONN_DISABLED, HCI_AUTO_CONN_DISABLED,
......
...@@ -216,11 +216,23 @@ bool hci_setup_sync(struct hci_conn *conn, __u16 handle) ...@@ -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, void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
u16 latency, u16 to_multiplier) u16 latency, u16 to_multiplier)
{ {
struct hci_cp_le_conn_update cp;
struct hci_dev *hdev = conn->hdev; 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.handle = cpu_to_le16(conn->handle);
cp.conn_interval_min = cpu_to_le16(min); cp.conn_interval_min = cpu_to_le16(min);
cp.conn_interval_max = cpu_to_le16(max); cp.conn_interval_max = cpu_to_le16(max);
......
...@@ -3514,6 +3514,8 @@ int hci_conn_params_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type, ...@@ -3514,6 +3514,8 @@ int hci_conn_params_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type,
update: update:
params->conn_min_interval = conn_min_interval; params->conn_min_interval = conn_min_interval;
params->conn_max_interval = conn_max_interval; params->conn_max_interval = conn_max_interval;
params->conn_latency = 0x0000;
params->supervision_timeout = 0x002a;
params->auto_connect = auto_connect; params->auto_connect = auto_connect;
switch (auto_connect) { switch (auto_connect) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment