aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-12-22 12:21:58 -0800
committerMarcel Holtmann <marcel@holtmann.org>2021-12-22 23:01:35 +0100
commit6cd29ec6ae5e3694b779e02da9f3e50ae4398b59 (patch)
tree3cd59b4859e26e581c5bf9aa3fd9b24bc2a9d95e /net/bluetooth
parentBluetooth: hci_sync: Add support for waiting specific LE subevents (diff)
downloadlinux-dev-6cd29ec6ae5e3694b779e02da9f3e50ae4398b59.tar.xz
linux-dev-6cd29ec6ae5e3694b779e02da9f3e50ae4398b59.zip
Bluetooth: hci_sync: Wait for proper events when connecting LE
When using HCI_OP_LE_CREATE_CONN wait for HCI_EV_LE_CONN_COMPLETE before completing it and for HCI_OP_LE_EXT_CREATE_CONN wait for HCI_EV_LE_ENHANCED_CONN_COMPLETE before resuming advertising. Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_sync.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 334dc5f436a0..8c50a12ba5f5 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -5182,8 +5182,10 @@ int hci_le_ext_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn,
plen += sizeof(*p);
}
- return __hci_cmd_sync_status(hdev, HCI_OP_LE_EXT_CREATE_CONN,
- plen, data, HCI_CMD_TIMEOUT);
+ return __hci_cmd_sync_status_sk(hdev, HCI_OP_LE_EXT_CREATE_CONN,
+ plen, data,
+ HCI_EV_LE_ENHANCED_CONN_COMPLETE,
+ HCI_CMD_TIMEOUT, NULL);
}
int hci_le_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn)
@@ -5269,8 +5271,9 @@ int hci_le_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn)
cp.min_ce_len = cpu_to_le16(0x0000);
cp.max_ce_len = cpu_to_le16(0x0000);
- err = __hci_cmd_sync_status(hdev, HCI_OP_LE_CREATE_CONN,
- sizeof(cp), &cp, HCI_CMD_TIMEOUT);
+ err = __hci_cmd_sync_status_sk(hdev, HCI_OP_LE_CREATE_CONN,
+ sizeof(cp), &cp, HCI_EV_LE_CONN_COMPLETE,
+ HCI_CMD_TIMEOUT, NULL);
done:
hci_resume_advertising_sync(hdev);