diff options
-rw-r--r-- | include/vnd_catfish.txt | 15 | ||||
-rw-r--r-- | include/vnd_catshark.txt | 15 | ||||
-rw-r--r-- | src/hardware.c | 44 |
3 files changed, 57 insertions, 17 deletions
diff --git a/include/vnd_catfish.txt b/include/vnd_catfish.txt new file mode 100644 index 0000000..f4b46f4 --- /dev/null +++ b/include/vnd_catfish.txt @@ -0,0 +1,15 @@ +BLUETOOTH_UART_DEVICE_PORT = "/dev/ttyHS0" +FW_PATCHFILE_LOCATION = "/vendor/firmware/" +UART_TARGET_BAUD_RATE = 3000000 +SCO_USE_I2S_INTERFACE = TRUE +SCO_I2SPCM_IF_ROLE = 0 +BT_WAKE_VIA_PROC = FALSE +LPM_IDLE_TIMEOUT_MULTIPLE = 5 +LPM_IDLE_THRESHOLD = 24 +LPM_HC_IDLE_THRESHOLD = 24 +LPM_BT_WAKE_POLARITY = 0 +LPM_HOST_WAKE_POLARITY = 0 +BTVND_DBG = FALSE +BTHW_DBG = FALSE +VNDUSERIAL_DBG = FALSE +UPIO_DBG = FALSE diff --git a/include/vnd_catshark.txt b/include/vnd_catshark.txt new file mode 100644 index 0000000..f4b46f4 --- /dev/null +++ b/include/vnd_catshark.txt @@ -0,0 +1,15 @@ +BLUETOOTH_UART_DEVICE_PORT = "/dev/ttyHS0" +FW_PATCHFILE_LOCATION = "/vendor/firmware/" +UART_TARGET_BAUD_RATE = 3000000 +SCO_USE_I2S_INTERFACE = TRUE +SCO_I2SPCM_IF_ROLE = 0 +BT_WAKE_VIA_PROC = FALSE +LPM_IDLE_TIMEOUT_MULTIPLE = 5 +LPM_IDLE_THRESHOLD = 24 +LPM_HC_IDLE_THRESHOLD = 24 +LPM_BT_WAKE_POLARITY = 0 +LPM_HOST_WAKE_POLARITY = 0 +BTVND_DBG = FALSE +BTHW_DBG = FALSE +VNDUSERIAL_DBG = FALSE +UPIO_DBG = FALSE diff --git a/src/hardware.c b/src/hardware.c index da9b918..701cb86 100644 --- a/src/hardware.c +++ b/src/hardware.c @@ -739,29 +739,39 @@ void hw_config_cback(void *p_mem) hw_cfg_cb.state = HW_CFG_DL_FW_PATCH; /* fall through intentionally */ case HW_CFG_DL_FW_PATCH: - p_buf->len = read(hw_cfg_cb.fw_fd, p, HCI_CMD_PREAMBLE_SIZE); - if (p_buf->len > 0) + if (hw_cfg_cb.fw_fd >= 0) { - if ((p_buf->len < HCI_CMD_PREAMBLE_SIZE) || \ - (opcode == HCI_VSC_LAUNCH_RAM)) + int ret = read(hw_cfg_cb.fw_fd, p, HCI_CMD_PREAMBLE_SIZE); + if (ret > 0) { - ALOGW("firmware patch file might be altered!"); + if ((ret < HCI_CMD_PREAMBLE_SIZE) || \ + (opcode == HCI_VSC_LAUNCH_RAM)) + { + ALOGW("firmware patch file might be altered!"); + } + else + { + p_buf->len = ret; + ret = read(hw_cfg_cb.fw_fd, \ + p+HCI_CMD_PREAMBLE_SIZE,\ + *(p+HCD_REC_PAYLOAD_LEN_BYTE)); + if (ret >= 0) + { + p_buf->len += ret; + STREAM_TO_UINT16(opcode,p); + is_proceeding = bt_vendor_cbacks->xmit_cb(opcode, \ + p_buf, hw_config_cback); + break; + } + } } - else + if (ret < 0) { - p_buf->len += read(hw_cfg_cb.fw_fd, \ - p+HCI_CMD_PREAMBLE_SIZE,\ - *(p+HCD_REC_PAYLOAD_LEN_BYTE)); - STREAM_TO_UINT16(opcode,p); - is_proceeding = bt_vendor_cbacks->xmit_cb(opcode, \ - p_buf, hw_config_cback); - break; + ALOGE("firmware patch file read failed (%s)", strerror(errno)); } + close(hw_cfg_cb.fw_fd); + hw_cfg_cb.fw_fd = -1; } - - close(hw_cfg_cb.fw_fd); - hw_cfg_cb.fw_fd = -1; - /* Normally the firmware patch configuration file * sets the new starting baud rate at 115200. * So, we need update host's baud rate accordingly. |