diff --git a/src/hci.c b/src/hci.c index f3dbf94de..c587064bf 100644 --- a/src/hci.c +++ b/src/hci.c @@ -581,7 +581,7 @@ static void event_handler(uint8_t *packet, int size){ // get num cmd packets // log_info("HCI_EVENT_COMMAND_COMPLETE cmds old %u - new %u\n", hci_stack->num_cmd_packets, packet[2]); hci_stack->num_cmd_packets = packet[2]; - + if (COMMAND_COMPLETE_EVENT(packet, hci_read_buffer_size)){ // from offset 5 // status @@ -960,6 +960,17 @@ static void event_handler(uint8_t *packet, int size){ hci_stack->substate++; } } + + // HACK to deal with duplicate HCI Reset Complete events seen on cheapo CSR8510 A10 USB Dongle + if (COMMAND_COMPLETE_EVENT(packet, hci_reset)){ + if (hci_stack->state == HCI_STATE_INITIALIZING) { + if (hci_stack->config == 0 || ((hci_uart_config_t *)hci_stack->config)->baudrate_main == 0){ + hci_stack->substate = 6; // >> 1 = 3 + } else { + hci_stack->substate = 2; // >> 1 = 1 + } + } + } } }