diff --git a/src/hci.c b/src/hci.c index c485e5361..c0d3ef118 100644 --- a/src/hci.c +++ b/src/hci.c @@ -848,6 +848,11 @@ static void hci_initialization_timeout_handler(timer_source_t * ds){ case HCI_INIT_W4_SEND_BAUD_CHANGE: log_info("Local baud rate change to %"PRIu32, ((hci_uart_config_t *)hci_stack->config)->baudrate_main); hci_stack->hci_transport->set_baudrate(((hci_uart_config_t *)hci_stack->config)->baudrate_main); + // For CSR, HCI Reset is sent on new baud rate + if (hci_stack->manufacturer == 0x000a){ + hci_stack->substate = HCI_INIT_SEND_RESET_CSR_WARM_BOOT; + hci_run(); + } break; default: break; @@ -932,7 +937,16 @@ static void hci_initializing_run(void){ run_loop_set_timer(&hci_stack->timeout, 100); run_loop_set_timer_handler(&hci_stack->timeout, hci_initialization_timeout_handler); run_loop_add_timer(&hci_stack->timeout); - hci_stack->substate = HCI_INIT_W4_CUSTOM_INIT_CSR_WARM_BOOT; + if (hci_stack->manufacturer == 0x000a + && hci_stack->config + && hci_stack->control + // && hci_stack->control->baudrate_cmd -- there's no such command + && hci_stack->hci_transport->set_baudrate + && ((hci_uart_config_t *)hci_stack->config)->baudrate_main){ + hci_stack->substate = HCI_INIT_W4_SEND_BAUD_CHANGE; + } else { + hci_stack->substate = HCI_INIT_W4_CUSTOM_INIT_CSR_WARM_BOOT; + } break; } hci_stack->hci_transport->send_packet(HCI_COMMAND_DATA_PACKET, hci_stack->hci_packet_buffer, size);