summaryrefslogtreecommitdiffstats
path: root/twrp-functions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'twrp-functions.cpp')
-rw-r--r--twrp-functions.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index e73a52dbb..63ed0a644 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -981,20 +981,19 @@ bool TWFunc::Create_Dir_Recursive(const std::string& path, mode_t mode, uid_t ui
int TWFunc::Set_Brightness(std::string brightness_value)
{
+ int result = -1;
+ std::string secondary_brightness_file;
- std::string brightness_file = DataManager::GetStrValue("tw_brightness_file");;
-
- if (brightness_file.compare("/nobrightness") != 0) {
- std::string secondary_brightness_file = DataManager::GetStrValue("tw_secondary_brightness_file");
+ if (DataManager::GetIntValue("tw_has_brightnesss_file")) {
LOGINFO("TWFunc::Set_Brightness: Setting brightness control to %s\n", brightness_value.c_str());
- int result = TWFunc::write_file(brightness_file, brightness_value);
- if (secondary_brightness_file != "") {
- LOGINFO("TWFunc::Set_Brightness: Setting SECONDARY brightness control to %s\n", brightness_value.c_str());
+ result = TWFunc::write_file(DataManager::GetStrValue("tw_brightness_file"), brightness_value);
+ DataManager::GetValue("tw_secondary_brightness_file", secondary_brightness_file);
+ if (!secondary_brightness_file.empty()) {
+ LOGINFO("TWFunc::Set_Brightness: Setting secondary brightness control to %s\n", brightness_value.c_str());
TWFunc::write_file(secondary_brightness_file, brightness_value);
}
- return result;
}
- return -1;
+ return result;
}
bool TWFunc::Toggle_MTP(bool enable) {