diff options
author | YK Jeffrey Chao <jechao@broadcom.com> | 2012-03-28 17:56:29 -0700 |
---|---|---|
committer | Matthew Xie <mattx@google.com> | 2012-07-14 11:19:13 -0700 |
commit | 3e6f399bdbaca7f8ab0a8b1c6eab7cc1088ab74a (patch) | |
tree | 30b07f2760dcef49aec0ae5443267dcef6078f1d /vendor/libvendor | |
parent | f2b7dab37bdd8736b9ffb2b8e99e77236850b81c (diff) | |
download | external_bluetooth_bluedroid-3e6f399bdbaca7f8ab0a8b1c6eab7cc1088ab74a.zip external_bluetooth_bluedroid-3e6f399bdbaca7f8ab0a8b1c6eab7cc1088ab74a.tar.gz external_bluetooth_bluedroid-3e6f399bdbaca7f8ab0a8b1c6eab7cc1088ab74a.tar.bz2 |
Fix BT turn-on failure seen in preload process where firmware patch download procedure stuck when reaching an unexpected LF character (0x0A) at the end of firmware patch file.
Change-Id: I1e467b769e88d2a2d4cbcaaadcf4881bfa7f3650
Diffstat (limited to 'vendor/libvendor')
-rw-r--r-- | vendor/libvendor/src/hardware.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/vendor/libvendor/src/hardware.c b/vendor/libvendor/src/hardware.c index 57ec1eb..886a905 100644 --- a/vendor/libvendor/src/hardware.c +++ b/vendor/libvendor/src/hardware.c @@ -103,6 +103,7 @@ #define HCI_VSC_WRITE_SCO_PCM_INT_PARAM 0xFC1C #define HCI_VSC_WRITE_PCM_DATA_FORMAT_PARAM 0xFC1E #define HCI_VSC_WRITE_I2SPCM_INTERFACE_PARAM 0xFC6D +#define HCI_VSC_LAUNCH_RAM 0xFC4E #define HCI_EVT_CMD_CMPL_STATUS_RET_BYTE 5 #define HCI_EVT_CMD_CMPL_LOCAL_NAME_STRING 6 @@ -593,6 +594,8 @@ void hw_config_cback(VND_BT_HDR *p_evt_buf) uint8_t is_proceeding = FALSE; status = *((uint8_t *)(p_evt_buf + 1) + HCI_EVT_CMD_CMPL_STATUS_RET_BYTE); + p = (uint8_t *)(p_evt_buf + 1) + HCI_EVT_CMD_CMPL_OPCODE; + STREAM_TO_UINT16(opcode,p); /* Ask a new buffer big enough to hold any HCI commands sent in here */ if ((status == 0) && bt_vendor_cbacks) @@ -673,12 +676,21 @@ void hw_config_cback(VND_BT_HDR *p_evt_buf) p_buf->len = read(hw_cfg_cb.fw_fd, p, HCI_CMD_PREAMBLE_SIZE); if (p_buf->len > 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 = hci_h4_send_int_cmd(opcode, p_buf, \ + if ((p_buf->len < HCI_CMD_PREAMBLE_SIZE) || \ + (opcode == HCI_VSC_LAUNCH_RAM)) + { + LOGW("firmware patch file might be altered!"); + } + else + { + 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 = hci_h4_send_int_cmd(opcode, p_buf, \ hw_config_cback); - break; + break; + } } close(hw_cfg_cb.fw_fd); |