diff options
Diffstat (limited to 'net/bluetooth/hci_conn.c')
-rw-r--r-- | net/bluetooth/hci_conn.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 800b6b9fbba..0b1e460fe44 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | BlueZ - Bluetooth protocol stack for Linux | 2 | BlueZ - Bluetooth protocol stack for Linux |
3 | Copyright (C) 2000-2001 Qualcomm Incorporated | 3 | Copyright (c) 2000-2001, 2010, Code Aurora Forum. All rights reserved. |
4 | 4 | ||
5 | Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> | 5 | Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> |
6 | 6 | ||
@@ -155,6 +155,27 @@ void hci_setup_sync(struct hci_conn *conn, __u16 handle) | |||
155 | hci_send_cmd(hdev, HCI_OP_SETUP_SYNC_CONN, sizeof(cp), &cp); | 155 | hci_send_cmd(hdev, HCI_OP_SETUP_SYNC_CONN, sizeof(cp), &cp); |
156 | } | 156 | } |
157 | 157 | ||
158 | /* Device _must_ be locked */ | ||
159 | void hci_sco_setup(struct hci_conn *conn, __u8 status) | ||
160 | { | ||
161 | struct hci_conn *sco = conn->link; | ||
162 | |||
163 | BT_DBG("%p", conn); | ||
164 | |||
165 | if (!sco) | ||
166 | return; | ||
167 | |||
168 | if (!status) { | ||
169 | if (lmp_esco_capable(conn->hdev)) | ||
170 | hci_setup_sync(sco, conn->handle); | ||
171 | else | ||
172 | hci_add_sco(sco, conn->handle); | ||
173 | } else { | ||
174 | hci_proto_connect_cfm(sco, status); | ||
175 | hci_conn_del(sco); | ||
176 | } | ||
177 | } | ||
178 | |||
158 | static void hci_conn_timeout(unsigned long arg) | 179 | static void hci_conn_timeout(unsigned long arg) |
159 | { | 180 | { |
160 | struct hci_conn *conn = (void *) arg; | 181 | struct hci_conn *conn = (void *) arg; |
@@ -385,10 +406,13 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 | |||
385 | acl->power_save = 1; | 406 | acl->power_save = 1; |
386 | hci_conn_enter_active_mode(acl); | 407 | hci_conn_enter_active_mode(acl); |
387 | 408 | ||
388 | if (lmp_esco_capable(hdev)) | 409 | if (test_bit(HCI_CONN_MODE_CHANGE_PEND, &acl->pend)) { |
389 | hci_setup_sync(sco, acl->handle); | 410 | /* defer SCO setup until mode change completed */ |
390 | else | 411 | set_bit(HCI_CONN_SCO_SETUP_PEND, &acl->pend); |
391 | hci_add_sco(sco, acl->handle); | 412 | return sco; |
413 | } | ||
414 | |||
415 | hci_sco_setup(acl, 0x00); | ||
392 | } | 416 | } |
393 | 417 | ||
394 | return sco; | 418 | return sco; |