From e98d1a5311a794906ffd4d7b1ac47fc034b9b879 Mon Sep 17 00:00:00 2001 From: Rajkumar Ayyasamy Date: Thu, 26 Nov 2020 16:54:35 +0530 Subject: [PATCH] ipq5018: bt: fix hci cmd Signed-off-by: Rajkumar Ayyasamy Change-Id: Ideeec55d3fe062f1cdc07f81f379c017224dbf0c --- board/qca/arm/ipq5018/ipq5018.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/board/qca/arm/ipq5018/ipq5018.c b/board/qca/arm/ipq5018/ipq5018.c index e3b061486c..e08a3950b0 100644 --- a/board/qca/arm/ipq5018/ipq5018.c +++ b/board/qca/arm/ipq5018/ipq5018.c @@ -502,11 +502,16 @@ unsigned char set_interval[] = unsigned char start_beacon[] = {0x01, 0x0A, 0x20, 0x01, 0x01}; -unsigned char *hci_cmds[] = { - hci_reset, - adv_data, - set_interval, - start_beacon +struct hci_cmd{ + unsigned char* data; + unsigned int len; +}; + +struct hci_cmd hci_cmds[] = { + { hci_reset, sizeof(hci_reset) }, + { adv_data, sizeof(adv_data) }, + { set_interval, sizeof(set_interval) }, + { start_beacon, sizeof(start_beacon) }, }; int wait_for_bt_event(struct bt_descriptor *btDesc, u8 bt_wait) @@ -594,10 +599,11 @@ static int initialize_nvm(struct bt_descriptor *btDesc, int send_bt_hci_cmds(struct bt_descriptor *btDesc) { int ret, i; - int count = sizeof hci_cmds/ sizeof(unsigned char *); + int count = sizeof hci_cmds/ sizeof(struct hci_cmd); for (i = 0; i < count; i++) { - bt_ipc_sendmsg(btDesc, hci_cmds[i], sizeof hci_cmds[i]); + bt_ipc_sendmsg(btDesc, hci_cmds[i].data, hci_cmds[i].len); + ret = wait_for_bt_event(btDesc, BT_WAIT_FOR_TX_COMPLETE); if (ret) return ret;