sdm: Print Warning Log for Failed Backlight Node Read only for TUI Usecase
Change-Id: Ia381a8ea74d8b5314ea13d149dbe662e35c9d07c
diff --git a/sdm/libs/dal/hw_peripheral_drm.cpp b/sdm/libs/dal/hw_peripheral_drm.cpp
index 4723f9a..c534f3b 100644
--- a/sdm/libs/dal/hw_peripheral_drm.cpp
+++ b/sdm/libs/dal/hw_peripheral_drm.cpp
@@ -738,16 +738,17 @@
std::string brightness_node(brightness_base_path_ + "brightness");
int fd = Sys::open_(brightness_node.c_str(), O_RDWR);
- if (fd < 0) {
- if (connector_info_.backlight_type != "dcs") {
- DLOGW("Failed to open node = %s, error = %s ", brightness_node.c_str(),
+#ifdef TRUSTED_VM
+ if (connector_info_.backlight_type != "dcs") {
+ DLOGW("Failed to open node = %s, error = %s ", brightness_node.c_str(),
strerror(errno));
- return kErrorFileDescriptor;
- } else {
+ return kErrorFileDescriptor;
+ }
+#endif
+ if (fd < 0) {
DLOGE("Failed to open node = %s, error = %s ", brightness_node.c_str(),
strerror(errno));
return kErrorFileDescriptor;
- }
}
int32_t bytes = snprintf(buffer, kMaxSysfsCommandLength, "%d\n", level);
@@ -779,16 +780,17 @@
std::string brightness_node(brightness_base_path_ + "brightness");
int fd = Sys::open_(brightness_node.c_str(), O_RDWR);
+#ifdef TRUSTED_VM
+ if (connector_info_.backlight_type != "dcs") {
+ DLOGW("Failed to open brightness node = %s, error = %s", brightness_node.c_str(),
+ strerror(errno));
+ return kErrorFileDescriptor;
+ }
+#endif
if (fd < 0) {
- if (connector_info_.backlight_type != "dcs") {
- DLOGW("Failed to open brightness node = %s, error = %s", brightness_node.c_str(),
- strerror(errno));
- return kErrorFileDescriptor;
- } else {
DLOGE("Failed to open brightness node = %s, error = %s", brightness_node.c_str(),
strerror(errno));
return kErrorFileDescriptor;
- }
}
if (Sys::pread_(fd, value, sizeof(value), 0) > 0) {
@@ -818,16 +820,17 @@
std::string brightness_node(brightness_base_path_ + "max_brightness");
int fd = Sys::open_(brightness_node.c_str(), O_RDONLY);
- if (fd < 0) {
- if (connector_info_.backlight_type != "dcs") {
+#ifdef TRUSTED_VM
+ if (connector_info_.backlight_type != "dcs") {
DLOGW("Failed to open max brightness node = %s, error = %s", brightness_node.c_str(),
strerror(errno));
return;
- } else {
+ }
+#endif
+ if (fd < 0) {
DLOGE("Failed to open max brightness node = %s, error = %s", brightness_node.c_str(),
strerror(errno));
return;
- }
}
if (Sys::pread_(fd, value, sizeof(value), 0) > 0) {