diff options
author | Ethan Yonker <dees_troy@teamw.in> | 2014-04-09 21:29:02 +0200 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit> | 2014-04-15 15:26:44 +0200 |
commit | 00028b4adbe1475fe799a7cec148b37182ac5e9f (patch) | |
tree | 9b132f947eab70fa9ab685e751f017860f522636 /data.cpp | |
parent | Fix touch on Sprint HTC One m8 (diff) | |
download | android_bootable_recovery-00028b4adbe1475fe799a7cec148b37182ac5e9f.tar android_bootable_recovery-00028b4adbe1475fe799a7cec148b37182ac5e9f.tar.gz android_bootable_recovery-00028b4adbe1475fe799a7cec148b37182ac5e9f.tar.bz2 android_bootable_recovery-00028b4adbe1475fe799a7cec148b37182ac5e9f.tar.lz android_bootable_recovery-00028b4adbe1475fe799a7cec148b37182ac5e9f.tar.xz android_bootable_recovery-00028b4adbe1475fe799a7cec148b37182ac5e9f.tar.zst android_bootable_recovery-00028b4adbe1475fe799a7cec148b37182ac5e9f.zip |
Diffstat (limited to '')
-rw-r--r-- | data.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
@@ -45,6 +45,7 @@ #ifndef TW_NO_SCREEN_TIMEOUT #include "gui/blanktimer.hpp" #endif +#include "find_file.hpp" #ifdef TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID #include "cutils/properties.h" @@ -940,17 +941,31 @@ void DataManager::SetDefaultValues() #ifndef TW_MAX_BRIGHTNESS #define TW_MAX_BRIGHTNESS 255 #endif + string findbright; if (strcmp(EXPAND(TW_BRIGHTNESS_PATH), "/nobrightness") != 0) { - LOGINFO("TW_BRIGHTNESS_PATH := %s\n", EXPAND(TW_BRIGHTNESS_PATH)); + findbright = EXPAND(TW_BRIGHTNESS_PATH); + LOGINFO("TW_BRIGHTNESS_PATH := %s\n", findbright.c_str()); + if (!TWFunc::Path_Exists(findbright)) { + LOGINFO("Specified brightness file '%s' not found.\n", findbright.c_str()); + findbright = ""; + } + } + if (findbright.empty()) { + // Attempt to locate the brightness file + findbright = Find_File::Find("brightness", "/sys/class/backlight"); + } + if (findbright.empty()) { + LOGINFO("Unable to locate brightness file\n"); + mConstValues.insert(make_pair("tw_has_brightnesss_file", "0")); + } else { + LOGINFO("Found brightness file at '%s'\n", findbright.c_str()); mConstValues.insert(make_pair("tw_has_brightnesss_file", "1")); - mConstValues.insert(make_pair("tw_brightness_file", EXPAND(TW_BRIGHTNESS_PATH))); + mConstValues.insert(make_pair("tw_brightness_file", findbright)); ostringstream maxVal; maxVal << TW_MAX_BRIGHTNESS; mConstValues.insert(make_pair("tw_brightness_max", maxVal.str())); mValues.insert(make_pair("tw_brightness", make_pair(maxVal.str(), 1))); mValues.insert(make_pair("tw_brightness_pct", make_pair("100", 1))); - } else { - mConstValues.insert(make_pair("tw_has_brightnesss_file", "0")); } #endif mValues.insert(make_pair(TW_MILITARY_TIME, make_pair("0", 1))); |