mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-07 09:55:45 +00:00
hci: handle late Command Complete for HCI Reset e.g. with TC35661
This commit is contained in:
parent
25f2e3077c
commit
0f97eae764
27
src/hci.c
27
src/hci.c
@ -1044,6 +1044,7 @@ static void hci_initializing_event_handler(uint8_t * packet, uint16_t size){
|
||||
log_info("Command complete for opcode %04x, expected %04x", opcode, hci_stack->last_cmd_opcode);
|
||||
}
|
||||
}
|
||||
|
||||
if (packet[0] == HCI_EVENT_COMMAND_STATUS){
|
||||
uint8_t status = packet[2];
|
||||
uint16_t opcode = READ_BT_16(packet,4);
|
||||
@ -1058,12 +1059,38 @@ static void hci_initializing_event_handler(uint8_t * packet, uint16_t size){
|
||||
log_info("Command status for opcode %04x, expected %04x", opcode, hci_stack->last_cmd_opcode);
|
||||
}
|
||||
}
|
||||
|
||||
// Vendor == CSR
|
||||
if (hci_stack->substate == HCI_INIT_W4_CUSTOM_INIT && packet[0] == HCI_EVENT_VENDOR_SPECIFIC){
|
||||
// TODO: track actual command
|
||||
command_completed = 1;
|
||||
}
|
||||
|
||||
// Late response (> 100 ms) for HCI Reset e.g. on Toshiba TC35661:
|
||||
// Command complete for HCI Reset arrives after we've resent the HCI Reset command
|
||||
//
|
||||
// HCI Reset
|
||||
// Timeout 100 ms
|
||||
// HCI Reset
|
||||
// Command Complete Reset
|
||||
// HCI Read Local Version Information
|
||||
// Command Complete Reset - but we expected Command Complete Read Local Version Information
|
||||
// hang...
|
||||
//
|
||||
// Fix: Command Complete for HCI Reset in HCI_INIT_W4_SEND_READ_LOCAL_VERSION_INFORMATION trigger resend
|
||||
if (!command_completed
|
||||
&& packet[0] == HCI_EVENT_COMMAND_COMPLETE
|
||||
&& hci_stack->substate == HCI_INIT_W4_SEND_READ_LOCAL_VERSION_INFORMATION){
|
||||
|
||||
uint16_t opcode = READ_BT_16(packet,3);
|
||||
if (opcode == hci_reset.opcode){
|
||||
hci_stack->substate = HCI_INIT_SEND_READ_LOCAL_VERSION_INFORMATION;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!command_completed) return;
|
||||
|
||||
int need_baud_change = hci_stack->config
|
||||
|
Loading…
Reference in New Issue
Block a user