Enable LPM mode by changing BT_VND_OP_LPM_SET_MODE handler
In BT_VND_OP_LPM_SET_MODE handler, if LPM mode is configured, we will
return success enable LPM mode, so that BT stack can hold wake lock
through LPM mode. We added a new persistent property to configure it
Change-Id: I4350a8d88d845cf9c7a1d80ea659763cc5309399
diff --git a/libbt-vendor/src/bt_vendor_qcom.c b/libbt-vendor/src/bt_vendor_qcom.c
index 6586f36..47b735f 100644
--- a/libbt-vendor/src/bt_vendor_qcom.c
+++ b/libbt-vendor/src/bt_vendor_qcom.c
@@ -725,6 +725,7 @@
char wipower_status[PROPERTY_VALUE_MAX];
char emb_wp_mode[PROPERTY_VALUE_MAX];
char bt_version[PROPERTY_VALUE_MAX];
+ char lpm_config[PROPERTY_VALUE_MAX];
bool ignore_boot_prop = TRUE;
#ifdef READ_BT_ADDR_FROM_PROP
int i = 0;
@@ -1151,8 +1152,21 @@
}
q->cb->lpm_cb(BT_VND_OP_RESULT_SUCCESS);
} else {
- /* respond with failure as it's handled by other mechanism */
- q->cb->lpm_cb(BT_VND_OP_RESULT_FAIL);
+ int lpm_result = BT_VND_OP_RESULT_SUCCESS;
+
+ property_get("persist.service.bdroid.lpmcfg", lpm_config, "all");
+ ALOGI("%s: property_get: persist.service.bdroid.lpmcfg: %s",
+ __func__, lpm_config);
+
+ if (!strcmp(lpm_config, "all")) {
+ // respond with success since we want to hold wake lock through LPM
+ lpm_result = BT_VND_OP_RESULT_SUCCESS;
+ }
+ else {
+ lpm_result = BT_VND_OP_RESULT_FAIL;
+ }
+
+ q->cb->lpm_cb(lpm_result);
}
break;