From 8539b4b4dd22f824cdcaf401a84f1c54dbaa20d2 Mon Sep 17 00:00:00 2001 From: py-ir0nf1st Date: Mon, 11 Nov 2024 17:12:10 +0100 Subject: [PATCH] Workaround for Infineon CYW55573 initialization Infineon CYW55573 doesn't respond to READ_LOCAL_NAME or BAUD_CHANGE after HCI_RESET. This is to skip READ_LOCAL_NAME and BADU_CHANGE during HCI_STATE_INITIALIZING. After received response to READ_LOCAL_VERSION_INFORMATION, the state machine goes to HCI_INIT_CUSTOM_INIT to enable mini driver or patch ram downloading. --- src/hci.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/hci.c b/src/hci.c index bf238e0877..fcdeba7333 100644 --- a/src/hci.c +++ b/src/hci.c @@ -2540,6 +2540,23 @@ static void hci_initializing_event_handler(const uint8_t * packet, uint16_t size return; #ifndef HAVE_HOST_CONTROLLER_API + case HCI_INIT_W4_SEND_READ_LOCAL_VERSION_INFORMATION: + if (hci_event_packet_get_type(packet) == HCI_EVENT_COMMAND_COMPLETE){ + uint16_t lmp_subversion = little_endian_read_16(packet, 12); + if (hci_stack->manufacturer == BLUETOOTH_COMPANY_ID_BROADCOM_CORPORATION && + lmp_subversion == 0x2257){ + // Workaround for CYW55573. + // CYW55573(on my Murata TYPE 2EA) doesn't respond to READ_LOCAL_NAME or BAUD_CHANGE after HCI_RESET, + // Go to HCI_INIT_CUSTOM_INIT when received LOCAL_VERSION_INFORMATION. + // + // NOTE: + // hci_stack->manufacturer and manufacturer in the response packet were modified to BLUETOOTH_COMPANY_ID_BROADCOM_CORPORATION before. + // Refer to function hci.c/handle_command_complete_event. + hci_stack->substate = HCI_INIT_CUSTOM_INIT; + return; + } + } + break; case HCI_INIT_W4_SEND_BAUD_CHANGE: // for STLC2500D, baud rate change already happened. // for others, baud rate gets changed now