summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChiou-Hao Hsu <chsu@codeaurora.org>2015-07-13 15:59:35 -0700
committerChiou-Hao Hsu <chsu@codeaurora.org>2015-07-13 15:59:35 -0700
commitd072ca57378454beaba0a92614b040973fb2328f (patch)
tree6061cb27df9a0eddc91879c4c2f6ce095292c258
parentd8273db377b36edc9ef900bb156ec767d5a96fe0 (diff)
parente8a5ed9e98ee50c629462d640412148812ce6d9a (diff)
downloadandroid_hardware_qcom_bt-d072ca57378454beaba0a92614b040973fb2328f.tar.gz
android_hardware_qcom_bt-d072ca57378454beaba0a92614b040973fb2328f.tar.bz2
android_hardware_qcom_bt-d072ca57378454beaba0a92614b040973fb2328f.zip
Merge tag 'AU_LINUX_ANDROID_LA.HB.1.1.1.05.01.01.063.321' into HEAD
* commit 'e8a5ed9e98ee50c629462d640412148812ce6d9a': Bluetooth: Set property to stop filter driver Bluetooth: Handle partial write during FW download Change-Id: I874da1c8675c946a5dd85bd931a4bafda62e6bf9
-rw-r--r--libbt-vendor/src/bt_vendor_qcom.c6
-rw-r--r--libbt-vendor/src/hci_uart.c1
-rw-r--r--libbt-vendor/src/hw_rome.c43
3 files changed, 40 insertions, 10 deletions
diff --git a/libbt-vendor/src/bt_vendor_qcom.c b/libbt-vendor/src/bt_vendor_qcom.c
index 2cfc2ad..083e53f 100644
--- a/libbt-vendor/src/bt_vendor_qcom.c
+++ b/libbt-vendor/src/bt_vendor_qcom.c
@@ -268,8 +268,8 @@ void stop_hci_filter() {
property_get("wc_transport.start_hci", value, "false");
if (strcmp(value, "false") == 0) {
- ALOGV("%s: hci_filter has been stopped already", __func__);
- return;
+ ALOGI("%s: hci_filter has been stopped already", __func__);
+// return;
}
property_set("wc_transport.start_hci", "false");
@@ -286,7 +286,7 @@ void start_hci_filter() {
property_get("wc_transport.start_hci", value, false);
if (strcmp(value, "true") == 0) {
- ALOGV("%s: hci_filter has been started already", __func__);
+ ALOGI("%s: hci_filter has been started already", __func__);
return;
}
diff --git a/libbt-vendor/src/hci_uart.c b/libbt-vendor/src/hci_uart.c
index b56d5be..2fbba95 100644
--- a/libbt-vendor/src/hci_uart.c
+++ b/libbt-vendor/src/hci_uart.c
@@ -357,6 +357,7 @@ void userial_vendor_set_baud(uint8_t userial_baud)
cfsetospeed(&vnd_userial.termios, tcio_baud);
cfsetispeed(&vnd_userial.termios, tcio_baud);
tcsetattr(vnd_userial.fd, TCSADRAIN, &vnd_userial.termios); /* don't change speed until last write done */
+ tcflush(vnd_userial.fd, TCIOFLUSH);
}
/*******************************************************************************
diff --git a/libbt-vendor/src/hw_rome.c b/libbt-vendor/src/hw_rome.c
index 43a1aa0..aa672a5 100644
--- a/libbt-vendor/src/hw_rome.c
+++ b/libbt-vendor/src/hw_rome.c
@@ -90,6 +90,35 @@ extern uint8_t vnd_local_bd_addr[6];
/*****************************************************************************
** Functions
*****************************************************************************/
+int do_write(int fd, unsigned char *buf,int len)
+{
+ int ret = 0;
+ int write_offset = 0;
+ int write_len = len;
+ do {
+ ret = write(fd,buf+write_offset,write_len);
+ if (ret < 0)
+ {
+ ALOGE("%s, write failed ret = %d err = %s",__func__,ret,strerror(errno));
+ return -1;
+ } else if (ret == 0) {
+ ALOGE("%s, write failed with ret 0 err = %s",__func__,strerror(errno));
+ return 0;
+ } else {
+ if (ret < write_len) {
+ ALOGD("%s, Write pending,do write ret = %d err = %s",__func__,ret,
+ strerror(errno));
+ write_len = write_len - ret;
+ write_offset = ret;
+ } else {
+ ALOGV("Write successful");
+ break;
+ }
+ }
+ } while(1);
+ return len;
+}
+
int get_vs_hci_event(unsigned char *rsp)
{
int err = 0;
@@ -341,7 +370,7 @@ int hci_send_wipower_vs_cmd(int fd, unsigned char *cmd, unsigned char *rsp, int
int err = 0;
/* Send the HCI command packet to UART for transmission */
- ret = write(fd, cmd, size);
+ ret = do_write(fd, cmd, size);
if (ret != size) {
ALOGE("%s: WP Send failed with ret value: %d", __FUNCTION__, ret);
goto failed;
@@ -365,7 +394,7 @@ int hci_send_vs_cmd(int fd, unsigned char *cmd, unsigned char *rsp, int size)
int ret = 0;
/* Send the HCI command packet to UART for transmission */
- ret = write(fd, cmd, size);
+ ret = do_write(fd, cmd, size);
if (ret != size) {
ALOGE("%s: Send failed with ret value: %d", __FUNCTION__, ret);
goto failed;
@@ -764,7 +793,7 @@ int rome_rampatch_reset(int fd)
size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN);
/* Send HCI Command packet to Controller */
- err = write(fd, cmd, size);
+ err = do_write(fd, cmd, size);
if (err != size) {
ALOGE("%s: Send failed with ret value: %d", __FUNCTION__, err);
goto error;
@@ -1420,7 +1449,7 @@ int rome_set_baudrate_req(int fd)
}
/* Send the HCI command packet to UART for transmission */
- err = write(fd, cmd, size);
+ err = do_write(fd, cmd, size);
if (err != size) {
ALOGE("%s: Send failed with ret value: %d", __FUNCTION__, err);
goto error;
@@ -1486,7 +1515,7 @@ int rome_hci_reset_req(int fd)
/* Send the HCI command packet to UART for transmission */
ALOGI("%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]);
- err = write(fd, cmd, size);
+ err = do_write(fd, cmd, size);
if (err != size) {
ALOGE("%s: Send failed with ret value: %d", __FUNCTION__, err);
goto error;
@@ -1534,7 +1563,7 @@ int rome_hci_reset(int fd)
/* Total length of the packet to be sent to the Controller */
size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE);
- err = write(fd, cmd, size);
+ err = do_write(fd, cmd, size);
if (err != size) {
ALOGE("%s: Send failed with ret value: %d", __FUNCTION__, err);
err = -1;
@@ -1744,7 +1773,7 @@ static int disable_internal_ldo(int fd)
unsigned char rsp[HCI_MAX_EVENT_SIZE];
ALOGI(" %s ", __FUNCTION__);
- ret = write(fd, cmd, 5);
+ ret = do_write(fd, cmd, 5);
if (ret != 5) {
ALOGE("%s: Send failed with ret value: %d", __FUNCTION__, ret);
ret = -1;