diff --git a/components/bt/host/bluedroid/hci/hci_layer.c b/components/bt/host/bluedroid/hci/hci_layer.c index 4bf553d0ce6..5c4a904b249 100644 --- a/components/bt/host/bluedroid/hci/hci_layer.c +++ b/components/bt/host/bluedroid/hci/hci_layer.c @@ -518,6 +518,18 @@ static bool filter_incoming_event(BT_HDR *packet) metadata = (hci_cmd_metadata_t *)(wait_entry->data); if (metadata->command_status_cb) { metadata->command_status_cb(status, &metadata->command, metadata->context); +#if ((BLE_50_FEATURE_SUPPORT == TRUE) || (BLE_42_FEATURE_SUPPORT == TRUE)) + /* No Command Complete follows a failed Command Status (Core Spec Vol 4 Part E). */ + if (status != HCI_SUCCESS) { + BlE_SYNC *sync_info = btsnd_hcic_ble_get_sync_info(); + if (!sync_info) { + HCI_TRACE_WARNING("%s sync_info is NULL. opcode = 0x%x", __func__, opcode); + } else if (sync_info->sync_sem && sync_info->opcode == opcode) { + osi_sem_give(&sync_info->sync_sem); + sync_info->opcode = 0; + } + } +#endif // #if ((BLE_50_FEATURE_SUPPORT == TRUE) || (BLE_42_FEATURE_SUPPORT == TRUE)) } goto intercepted; diff --git a/components/bt/host/bluedroid/stack/btu/btu_hcif.c b/components/bt/host/bluedroid/stack/btu/btu_hcif.c index 34e5ca9424b..2b3dde437b0 100644 --- a/components/bt/host/bluedroid/stack/btu/btu_hcif.c +++ b/components/bt/host/bluedroid/stack/btu/btu_hcif.c @@ -1824,6 +1824,11 @@ static void btu_hcif_command_status_evt(uint8_t status, BT_HDR *command, void *c { BT_HDR *event = osi_calloc(sizeof(BT_HDR) + sizeof(command_status_hack_t)); command_status_hack_t *hack = (command_status_hack_t *)&event->data[0]; +#if ((BLE_50_FEATURE_SUPPORT == TRUE) || (BLE_42_FEATURE_SUPPORT == TRUE)) + if (status != HCI_SUCCESS) { + btsnd_hci_ble_set_status(status); + } +#endif // #if ((BLE_50_FEATURE_SUPPORT == TRUE) || (BLE_42_FEATURE_SUPPORT == TRUE)) hack->callback = btu_hcif_command_status_evt_on_task; hack->status = status;