diff options
-rw-r--r-- | libbt/include/bt_vendor_brcm.h | 6 | ||||
-rw-r--r-- | libbt/src/bt_vendor_brcm.c | 10 | ||||
-rw-r--r-- | libbt/src/hardware.c | 27 |
3 files changed, 43 insertions, 0 deletions
diff --git a/libbt/include/bt_vendor_brcm.h b/libbt/include/bt_vendor_brcm.h index 9531df5..5b41268 100644 --- a/libbt/include/bt_vendor_brcm.h +++ b/libbt/include/bt_vendor_brcm.h @@ -63,6 +63,12 @@ #define BLUETOOTH_UART_DEVICE_PORT "/dev/ttyO1" /* maguro */ #endif +/* Firmware patch file chip name */ + +#ifndef FW_PATCHFILE_CHIP_NAME +#define FW_PATCHFILE_CHIP_NAME "bcm4330" /* maguro */ +#endif + /* Location of firmware patch files */ #ifndef FW_PATCHFILE_LOCATION #define FW_PATCHFILE_LOCATION "/vendor/firmware/" /* maguro */ diff --git a/libbt/src/bt_vendor_brcm.c b/libbt/src/bt_vendor_brcm.c index eb9856d..04dabcf 100644 --- a/libbt/src/bt_vendor_brcm.c +++ b/libbt/src/bt_vendor_brcm.c @@ -46,6 +46,7 @@ ******************************************************************************/ void hw_config_start(void); +uint8_t hw_config_checkpatches(void); uint8_t hw_lpm_enable(uint8_t turn_on); uint32_t hw_lpm_get_idle_timeout(void); void hw_lpm_set_wake_state(uint8_t wake_assert); @@ -90,6 +91,8 @@ static const tUSERIAL_CFG userial_init_cfg = static int init(const bt_vendor_callbacks_t* p_cb, unsigned char *local_bdaddr) { + uint8_t check; + ALOGI("init"); if (p_cb == NULL) @@ -111,6 +114,13 @@ static int init(const bt_vendor_callbacks_t* p_cb, unsigned char *local_bdaddr) ALOGW("*****************************************************************"); #endif + check = hw_config_checkpatches(); + if (check == FALSE) + { + ALOGE("init failed to check patches, firmwares are probably missing"); + return -1; + } + userial_vendor_init(); upio_init(); diff --git a/libbt/src/hardware.c b/libbt/src/hardware.c index df20c9f..0a4f063 100644 --- a/libbt/src/hardware.c +++ b/libbt/src/hardware.c @@ -513,6 +513,33 @@ static uint8_t hw_config_findpatch(char *p_chip_id_str) return (retval); } +uint8_t hw_config_checkpatches(void) +{ + char fw_patchfile_chip_name[256] = FW_PATCHFILE_CHIP_NAME; + struct stat fw_prepatch_stat; + uint8_t found; + int rc; + + if (strlen(fw_prepatch_name) > 0) + { + rc = stat(fw_prepatch_name, &fw_prepatch_stat); + if (rc < 0) + { + ALOGE("Prepatch firmware is missing"); + return FALSE; + } + } + + found = hw_config_findpatch(fw_patchfile_chip_name); + if (found == FALSE) + { + ALOGE("Patch firmware is missing"); + return FALSE; + } + + return TRUE; +} + /******************************************************************************* ** ** Function hw_config_set_bdaddr |