summaryrefslogtreecommitdiffstats
path: root/data.cpp
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2013-03-01 01:51:39 +0100
committerDees_Troy <dees_troy@teamw.in>2013-03-01 01:51:39 +0100
commitf33b49015a8fed05f4933e6c5062830909454def (patch)
tree1dc29f36fa7ea6dfee7355e1a8b2d142e2edd0b1 /data.cpp
parentFix file selector crash (diff)
downloadandroid_bootable_recovery-f33b49015a8fed05f4933e6c5062830909454def.tar
android_bootable_recovery-f33b49015a8fed05f4933e6c5062830909454def.tar.gz
android_bootable_recovery-f33b49015a8fed05f4933e6c5062830909454def.tar.bz2
android_bootable_recovery-f33b49015a8fed05f4933e6c5062830909454def.tar.lz
android_bootable_recovery-f33b49015a8fed05f4933e6c5062830909454def.tar.xz
android_bootable_recovery-f33b49015a8fed05f4933e6c5062830909454def.tar.zst
android_bootable_recovery-f33b49015a8fed05f4933e6c5062830909454def.zip
Diffstat (limited to '')
-rw-r--r--data.cpp12
1 files changed, 12 insertions, 0 deletions
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);