From c21d89f36affc7094d39c9da23c5155763b125ad Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Thu, 21 Mar 2019 11:41:30 +0100 Subject: [PATCH] hci: map Cypress onto Broadcom --- port/posix-h4/main.c | 8 +------- src/hci.c | 9 ++++++++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/port/posix-h4/main.c b/port/posix-h4/main.c index 6c3ec9b55..1b29af4f3 100644 --- a/port/posix-h4/main.c +++ b/port/posix-h4/main.c @@ -195,13 +195,7 @@ static void local_version_information_handler(uint8_t * packet){ break; case BLUETOOTH_COMPANY_ID_BROADCOM_CORPORATION: - printf("Broadcom - using BCM driver.\n"); - hci_set_chipset(btstack_chipset_bcm_instance()); - use_fast_uart(); - is_bcm = 1; - break; - case BLUETOOTH_COMPANY_ID_CYPRESS_SEMICONDUCTOR: - printf("Cypress - using BCM driver.\n"); + printf("Broadcom/Cypress - using BCM driver.\n"); hci_set_chipset(btstack_chipset_bcm_instance()); use_fast_uart(); is_bcm = 1; diff --git a/src/hci.c b/src/hci.c index 28e7779e0..04bb67f23 100644 --- a/src/hci.c +++ b/src/hci.c @@ -1975,8 +1975,15 @@ static void event_handler(uint8_t *packet, int size){ if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_read_local_version_information)){ // hci_stack->hci_version = little_endian_read_16(packet, 4); // hci_stack->hci_revision = little_endian_read_16(packet, 6); + uint16_t manufacturer = little_endian_read_16(packet, 10); + // map Cypress to Broadcom + if (manufacturer == BLUETOOTH_COMPANY_ID_CYPRESS_SEMICONDUCTOR){ + log_info("Treat Cypress as Broadcom"); + manufacturer = BLUETOOTH_COMPANY_ID_BROADCOM_CORPORATION; + little_endian_store_16(packet, 10, manufacturer); + } + hci_stack->manufacturer = manufacturer; // hci_stack->lmp_version = little_endian_read_16(packet, 8); - hci_stack->manufacturer = little_endian_read_16(packet, 10); // hci_stack->lmp_subversion = little_endian_read_16(packet, 12); log_info("Manufacturer: 0x%04x", hci_stack->manufacturer); }