summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAjay Kumar <ajayku@codeaurora.org>2015-04-16 19:46:29 +0530
committerAjay Kumar <ajayku@codeaurora.org>2015-08-27 14:23:14 +0530
commit83b2e4f1a7ffa0ae24a19464c26062a82a64e15f (patch)
treeeac742446c1b998664075617724fbe8a7b321203
parent77ce22758aecd04d7ef3f618aa0f59ce042e9a1c (diff)
downloadandroid_hardware_qcom_bt-83b2e4f1a7ffa0ae24a19464c26062a82a64e15f.tar.gz
android_hardware_qcom_bt-83b2e4f1a7ffa0ae24a19464c26062a82a64e15f.tar.bz2
android_hardware_qcom_bt-83b2e4f1a7ffa0ae24a19464c26062a82a64e15f.zip
Bluetooth : Removing the access to hciattach on every ON\OFF
On pronto solutions hciattach is accessed on every bt on\off which affects the performance.Moreover there is no need to access it once all properties are set and NVM tags are downloaded provided SOC does not reach to BAD state/SSR case. CRs-Fixed: 835568 Change-Id: I2866d2a47c81e638f7cc322b53f3a76d249f3d5a
-rw-r--r--libbt-vendor/src/hardware.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/libbt-vendor/src/hardware.c b/libbt-vendor/src/hardware.c
index cebeba7..496ebc1 100644
--- a/libbt-vendor/src/hardware.c
+++ b/libbt-vendor/src/hardware.c
@@ -44,20 +44,35 @@
int hw_config(int nState)
{
- ALOGI("Starting hciattach daemon");
char *szState[] = {"true", "false"};
char *szReqSt = NULL;
+ char szBtSocStatus[PROPERTY_VALUE_MAX] = {'\0', };
if(nState == BT_VND_PWR_OFF)
szReqSt = szState[1];
else
szReqSt = szState[0];
- ALOGI("try to set %s", szReqSt);
-
- if (property_set("bluetooth.hciattach", szReqSt) < 0){
- ALOGE("Property Setting fail");
- return -1;
+ if((property_get("bluetooth.status", szBtSocStatus, "") <= 0))
+ {
+ if(nState == BT_VND_PWR_ON ) {
+ ALOGW("Hw_config: First Time BT on after boot.Starting hciattach daemon BTStatus=%s",szBtSocStatus);
+ if (property_set("bluetooth.hciattach", szReqSt) < 0)
+ {
+ ALOGE("Hw_config: Property Setting fail");
+ return -1;
+ }
+ }
+ } else if( !(strncmp(szBtSocStatus, "on", strlen("on")))) {
+ //BTSOC is already on
+ ALOGW("Hw_config: nState = %d", nState);
+ } else {
+ ALOGW("Hw_config: trigerring hciattach");
+ if (property_set("bluetooth.hciattach", szReqSt) < 0)
+ {
+ ALOGE("Hw_config: Property Setting fail");
+ return -1;
+ }
}
return 0;
@@ -67,12 +82,12 @@ int readTrpState()
{
char szBtStatus[PROPERTY_VALUE_MAX] = {0, };
if(property_get("bluetooth.status", szBtStatus, "") < 0){
- ALOGE("Fail to get bluetooth satus");
+ ALOGE("Fail to get bluetooth status");
return FALSE;
}
if(!strncmp(szBtStatus, "on", strlen("on"))){
- ALOGI("bluetooth satus is on");
+ ALOGI("bluetooth status is on");
return TRUE;
}
return FALSE;
@@ -84,13 +99,12 @@ int is_hw_ready()
char szStatus[10] = {0,};
for(i=MAX_CNT_RETRY; i>0; i--){
- usleep(50*1000);
//TODO :: checking routine
if(readTrpState()==TRUE){
break;
}
+ usleep(50*1000);
}
-
return (i==0)? FALSE:TRUE;
}