diff options
author | Steve Kondik <steve@cyngn.com> | 2015-11-04 13:58:08 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-11-04 13:58:08 -0800 |
commit | 552ca8bd58593224769dd4322540d7afe7348c16 (patch) | |
tree | 2447268e19f3be0c6dd09fd15589ed82cf7e4f50 | |
parent | 1ced4d15fe6501fc5c12244c6c4cbdbd65a955e1 (diff) | |
parent | e4eb949c6cb873163c8931e61a73680d886f9deb (diff) | |
download | android_hardware_qcom_bt-552ca8bd58593224769dd4322540d7afe7348c16.tar.gz android_hardware_qcom_bt-552ca8bd58593224769dd4322540d7afe7348c16.tar.bz2 android_hardware_qcom_bt-552ca8bd58593224769dd4322540d7afe7348c16.zip |
Merge branch 'LA.BF64.1.2.2_rb4.6' of git://codeaurora.org/platform/hardware/qcom/bt into cm-13.0
-rw-r--r-- | libbt-vendor/src/bt_vendor_qcom.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/libbt-vendor/src/bt_vendor_qcom.c b/libbt-vendor/src/bt_vendor_qcom.c index 5419787..98b6088 100644 --- a/libbt-vendor/src/bt_vendor_qcom.c +++ b/libbt-vendor/src/bt_vendor_qcom.c @@ -50,6 +50,7 @@ #endif #define CMD_TIMEOUT 0x22 +void wait_for_patch_download(); /****************************************************************************** ** Externs ******************************************************************************/ @@ -225,6 +226,7 @@ static int get_bt_soc_type() bool can_perform_action(char action) { bool can_perform = false; char ref_count[PROPERTY_VALUE_MAX]; + char inProgress[PROPERTY_VALUE_MAX] = {'\0'}; int value, ret; property_get("wc_transport.ref_count", ref_count, "0"); @@ -236,7 +238,8 @@ bool can_perform_action(char action) { ALOGV("%s: on : value is: %d", __func__, value); if(value == 1) { - if(is_soc_initialized() == true) + property_get("wc_transport.patch_dnld_inprog", inProgress, "0"); + if((is_soc_initialized() == true) || (strcmp(inProgress,"1") == 0)) { value++; ALOGV("%s: on : value is incremented to : %d", __func__, value); @@ -762,8 +765,12 @@ static int op(bt_vendor_opcode_t opcode, void *param) break; case BT_SOC_ROME: { + wait_for_patch_download(); property_get("ro.bluetooth.emb_wp_mode", emb_wp_mode, false); if (!is_soc_initialized()) { + if (property_set("wc_transport.patch_dnld_inprog", "1") < 0) { + ALOGE("%s: Failed to set property", __FUNCTION__); + } fd = userial_vendor_open((tUSERIAL_CFG *) &userial_init_cfg); if (fd < 0) { ALOGE("userial_vendor_open returns err"); @@ -838,6 +845,9 @@ static int op(bt_vendor_opcode_t opcode, void *param) } } } + if (property_set("wc_transport.patch_dnld_inprog", "0") < 0) { + ALOGE("%s: Failed to set property", __FUNCTION__); + } property_set("wc_transport.clean_up","0"); if (retval != -1) { @@ -1053,6 +1063,9 @@ static void ssr_cleanup(int reason) { int ret; unsigned char trig_ssr = 0xEE; ALOGI("ssr_cleanup"); + if (property_set("wc_transport.patch_dnld_inprog", "0") < 0) { + ALOGE("%s: Failed to set property", __FUNCTION__); + } if ((btSocType = get_bt_soc_type()) < 0) { ALOGE("%s: Failed to detect BT SOC Type", __FUNCTION__); @@ -1101,6 +1114,24 @@ static void cleanup( void ) #endif /* WIFI_BT_STATUS_SYNC */ } +/* Check for one of the cients ANT/BT patch download is already in +** progress if yes wait till complete +*/ +void wait_for_patch_download() { + ALOGV("%s:", __FUNCTION__); + char inProgress[PROPERTY_VALUE_MAX] = {'\0'}; + while (1) { + property_get("wc_transport.patch_dnld_inprog", inProgress, "0"); + if(strcmp(inProgress,"1") == 0) { + usleep(50000); + } + else { + ALOGI("%s: patch download completed", __FUNCTION__); + break; + } + } +} + // Entry point of DLib const bt_vendor_interface_t BLUETOOTH_VENDOR_LIB_INTERFACE = { sizeof(bt_vendor_interface_t), |