aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2011-02-16 17:44:53 -0500
committerGustavo F. Padovan <padovan@profusion.mobi>2011-02-16 18:13:21 -0500
commit2ce603ebe1f1420c7c5b013638ec29b4fc975180 (patch)
treeb315468b139f2bd7b7f8bbe45a3d32090dda01a2 /net
parent6bd32326cdaa9b14794416150c88e4832fb7e592 (diff)
Bluetooth: Send LE Connection Update Command
If the new connection update parameter are accepted, the LE master host sends the LE Connection Update Command to its controller informing the new requested parameters. Signed-off-by: Claudio Takahasi <claudio.takahasi@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/hci_conn.c20
-rw-r--r--net/bluetooth/l2cap_core.c8
2 files changed, 27 insertions, 1 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index efcd2b508f5d..a050a6984901 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -183,6 +183,26 @@ void hci_setup_sync(struct hci_conn *conn, __u16 handle)
183 hci_send_cmd(hdev, HCI_OP_SETUP_SYNC_CONN, sizeof(cp), &cp); 183 hci_send_cmd(hdev, HCI_OP_SETUP_SYNC_CONN, sizeof(cp), &cp);
184} 184}
185 185
186void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
187 u16 latency, u16 to_multiplier)
188{
189 struct hci_cp_le_conn_update cp;
190 struct hci_dev *hdev = conn->hdev;
191
192 memset(&cp, 0, sizeof(cp));
193
194 cp.handle = cpu_to_le16(conn->handle);
195 cp.conn_interval_min = cpu_to_le16(min);
196 cp.conn_interval_max = cpu_to_le16(max);
197 cp.conn_latency = cpu_to_le16(latency);
198 cp.supervision_timeout = cpu_to_le16(to_multiplier);
199 cp.min_ce_len = cpu_to_le16(0x0001);
200 cp.max_ce_len = cpu_to_le16(0x0001);
201
202 hci_send_cmd(hdev, HCI_OP_LE_CONN_UPDATE, sizeof(cp), &cp);
203}
204EXPORT_SYMBOL(hci_le_conn_update);
205
186/* Device _must_ be locked */ 206/* Device _must_ be locked */
187void hci_sco_setup(struct hci_conn *conn, __u8 status) 207void hci_sco_setup(struct hci_conn *conn, __u8 status)
188{ 208{
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index e0e7b82cff02..bd3136710360 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -2529,6 +2529,7 @@ static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn,
2529 struct l2cap_conn_param_update_req *req; 2529 struct l2cap_conn_param_update_req *req;
2530 struct l2cap_conn_param_update_rsp rsp; 2530 struct l2cap_conn_param_update_rsp rsp;
2531 u16 min, max, latency, to_multiplier, cmd_len; 2531 u16 min, max, latency, to_multiplier, cmd_len;
2532 int err;
2532 2533
2533 if (!(hcon->link_mode & HCI_LM_MASTER)) 2534 if (!(hcon->link_mode & HCI_LM_MASTER))
2534 return -EINVAL; 2535 return -EINVAL;
@@ -2547,7 +2548,9 @@ static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn,
2547 min, max, latency, to_multiplier); 2548 min, max, latency, to_multiplier);
2548 2549
2549 memset(&rsp, 0, sizeof(rsp)); 2550 memset(&rsp, 0, sizeof(rsp));
2550 if (l2cap_check_conn_param(min, max, latency, to_multiplier)) 2551
2552 err = l2cap_check_conn_param(min, max, latency, to_multiplier);
2553 if (err)
2551 rsp.result = cpu_to_le16(L2CAP_CONN_PARAM_REJECTED); 2554 rsp.result = cpu_to_le16(L2CAP_CONN_PARAM_REJECTED);
2552 else 2555 else
2553 rsp.result = cpu_to_le16(L2CAP_CONN_PARAM_ACCEPTED); 2556 rsp.result = cpu_to_le16(L2CAP_CONN_PARAM_ACCEPTED);
@@ -2555,6 +2558,9 @@ static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn,
2555 l2cap_send_cmd(conn, cmd->ident, L2CAP_CONN_PARAM_UPDATE_RSP, 2558 l2cap_send_cmd(conn, cmd->ident, L2CAP_CONN_PARAM_UPDATE_RSP,
2556 sizeof(rsp), &rsp); 2559 sizeof(rsp), &rsp);
2557 2560
2561 if (!err)
2562 hci_le_conn_update(hcon, min, max, latency, to_multiplier);
2563
2558 return 0; 2564 return 0;
2559} 2565}
2560 2566