summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2019-09-04 13:34:17 -0700
committerXin Li <delphij@google.com>2019-09-04 13:34:17 -0700
commit0b0a9471f7ec99a4f57b85914a61e79a93313738 (patch)
tree83471e5f6424f9a88c0609c8ca62445ce7ee5f0e
parentb9bbab4ce29d1a6ed86a971de49495d2584433fe (diff)
parente4d661aab180bd2aaec9d32491b657705034b0f3 (diff)
downloadlibbt-0b0a9471f7ec99a4f57b85914a61e79a93313738.tar.gz
DO NOT MERGE - Merge Android 10 into master
Bug: 139893257 Change-Id: I29b3e3131804fcbc215e0adcbc5dc9cc0a77d220
-rw-r--r--include/vnd_catfish.txt15
-rw-r--r--include/vnd_catshark.txt15
-rw-r--r--src/hardware.c44
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.