summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2013-11-11 22:19:46 +0100
committerPaul Kocialkowski <contact@paulk.fr>2013-11-11 22:19:46 +0100
commit696fbe733b96e3f2d23ff53a8e8db2303fbd00fe (patch)
tree9f380ec5bedad40343091fd329114fd4c6a35fd0
parenta37aa43aa596796f9d535f41092c14742761eb0d (diff)
downloaddevice_common-696fbe733b96e3f2d23ff53a8e8db2303fbd00fe.zip
device_common-696fbe733b96e3f2d23ff53a8e8db2303fbd00fe.tar.gz
device_common-696fbe733b96e3f2d23ff53a8e8db2303fbd00fe.tar.bz2
Properly handle missing firmwares
This requires to set FW_PATCHFILE_CHIP_NAME properly for each device. Change-Id: Iba7ea481a9a8a859c622bdca349c9371e11e1cd1 Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r--libbt/include/bt_vendor_brcm.h6
-rw-r--r--libbt/src/bt_vendor_brcm.c10
-rw-r--r--libbt/src/hardware.c27
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