Skip to content

Commit 6cd29ec

Browse files
Vudentzholtmann
authored andcommitted
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>
1 parent 85b5685 commit 6cd29ec

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

net/bluetooth/hci_sync.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5182,8 +5182,10 @@ int hci_le_ext_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn,
51825182
plen += sizeof(*p);
51835183
}
51845184

5185-
return __hci_cmd_sync_status(hdev, HCI_OP_LE_EXT_CREATE_CONN,
5186-
plen, data, HCI_CMD_TIMEOUT);
5185+
return __hci_cmd_sync_status_sk(hdev, HCI_OP_LE_EXT_CREATE_CONN,
5186+
plen, data,
5187+
HCI_EV_LE_ENHANCED_CONN_COMPLETE,
5188+
HCI_CMD_TIMEOUT, NULL);
51875189
}
51885190

51895191
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)
52695271
cp.min_ce_len = cpu_to_le16(0x0000);
52705272
cp.max_ce_len = cpu_to_le16(0x0000);
52715273

5272-
err = __hci_cmd_sync_status(hdev, HCI_OP_LE_CREATE_CONN,
5273-
sizeof(cp), &cp, HCI_CMD_TIMEOUT);
5274+
err = __hci_cmd_sync_status_sk(hdev, HCI_OP_LE_CREATE_CONN,
5275+
sizeof(cp), &cp, HCI_EV_LE_CONN_COMPLETE,
5276+
HCI_CMD_TIMEOUT, NULL);
52745277

52755278
done:
52765279
hci_resume_advertising_sync(hdev);

0 commit comments

Comments
 (0)