summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2013-03-01 02:37:52 +0100
committerGerrit Code Review <gerrit@5.9.244.119>2013-03-01 02:37:52 +0100
commitdaab22e7519a21d769d41efca7edca6ef3a33c5e (patch)
tree8f4c0ac69a1ab222e43ee8c1c5ef831de99b6f6f
parentMerge "Add 2 second pre-dim and bugfix blank timer" into twrp2.4 (diff)
parentAdd option for custom battery path (diff)
downloadandroid_bootable_recovery-daab22e7519a21d769d41efca7edca6ef3a33c5e.tar
android_bootable_recovery-daab22e7519a21d769d41efca7edca6ef3a33c5e.tar.gz
android_bootable_recovery-daab22e7519a21d769d41efca7edca6ef3a33c5e.tar.bz2
android_bootable_recovery-daab22e7519a21d769d41efca7edca6ef3a33c5e.tar.lz
android_bootable_recovery-daab22e7519a21d769d41efca7edca6ef3a33c5e.tar.xz
android_bootable_recovery-daab22e7519a21d769d41efca7edca6ef3a33c5e.tar.zst
android_bootable_recovery-daab22e7519a21d769d41efca7edca6ef3a33c5e.zip
-rw-r--r--Android.mk3
-rw-r--r--data.cpp12
2 files changed, 15 insertions, 0 deletions
diff --git a/Android.mk b/Android.mk
index 57bab353d..199aba43b 100644
--- a/Android.mk
+++ b/Android.mk
@@ -234,6 +234,9 @@ endif
ifneq ($(TW_MAX_BRIGHTNESS),)
LOCAL_CFLAGS += -DTW_MAX_BRIGHTNESS=$(TW_MAX_BRIGHTNESS)
endif
+ifneq ($(TW_CUSTOM_BATTERY_PATH),)
+ LOCAL_CFLAGS += -DTW_CUSTOM_BATTERY_PATH=$(TW_CUSTOM_BATTERY_PATH)
+endif
ifeq ($(TARGET_BOARD_PLATFORM),rk30xx)
LOCAL_CFLAGS += -DRK3066
endif
diff --git a/data.cpp b/data.cpp
index c517a993f..02bdba36d 100644
--- a/data.cpp
+++ b/data.cpp
@@ -926,7 +926,13 @@ int DataManager::GetMagicValue(const string varName, string& value)
if (curTime.tv_sec > nextSecCheck)
{
char cap_s[4];
+#ifdef TW_CUSTOM_BATTERY_PATH
+ string capacity_file = EXPAND(TW_CUSTOM_BATTERY_PATH);
+ capacity_file += "/capacity";
+ FILE * cap = fopen(capacity_file.c_str(),"rt");
+#else
FILE * cap = fopen("/sys/class/power_supply/battery/capacity","rt");
+#endif
if (cap){
fgets(cap_s, 4, cap);
fclose(cap);
@@ -934,7 +940,13 @@ int DataManager::GetMagicValue(const string varName, string& value)
if (lastVal > 100) lastVal = 101;
if (lastVal < 0) lastVal = 0;
}
+#ifdef TW_CUSTOM_BATTERY_PATH
+ string status_file = EXPAND(TW_CUSTOM_BATTERY_PATH);
+ status_file += "/status";
+ cap = fopen(status_file.c_str(),"rt");
+#else
cap = fopen("/sys/class/power_supply/battery/status","rt");
+#endif
if (cap) {
fgets(cap_s, 2, cap);
fclose(cap);