From d67f995c6089e2a47092a7b7e04daaed134a1f39 Mon Sep 17 00:00:00 2001 From: "injun.yang" Date: Tue, 10 Sep 2019 14:54:56 +0900 Subject: [PATCH] When hci event missed, send tx timeout error Change-Id: I84a677862e82aac4ad280db740d0e535b170870b Signed-off-by: injun.yang --- src/adapter_le_vsc_features.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/adapter_le_vsc_features.c b/src/adapter_le_vsc_features.c index 518252e..771a88f 100755 --- a/src/adapter_le_vsc_features.c +++ b/src/adapter_le_vsc_features.c @@ -39,6 +39,12 @@ static int update_le_address(const bdaddr_t *le_addr) if (ret < 0 || status) { error("Cannot set random address [ret : %d] / errno : %d", ret, errno); hci_close_dev(hdev); + if (errno == ETIMEDOUT) { + error("hci vendor command 0x%02x tx timeout", OCF_LE_SET_RANDOM_ADDRESS); + adapter_send_event("TxTimeoutError"); + } else + adapter_send_event("HardwareError"); + return -1; } @@ -68,8 +74,14 @@ static int send_vsc_command(uint16_t ocf, uint8_t *cp, uint8_t cp_len, rq.rlen = rp_len; if (hci_send_req(dd, &rq, 5000) < 0) { - error("Fail to send VSC"); + error("Fail to send VSC : %s (%d)", strerror(errno), errno); hci_close_dev(dd); + if (errno == ETIMEDOUT) { + error("hci vendor command 0x%02x tx timeout", ocf); + adapter_send_event("TxTimeoutError"); + } else + adapter_send_event("HardwareError"); + return -1; } -- 2.7.4