liblights: Enable button backlight conditionally
Check for the existence of button backlight node before
enabling that in the HAL.
Change-Id: I66828d67dbabffdb694da55d4a3d12246fb7a66f
Crs-fixed: 2093165
diff --git a/liblight/lights.c b/liblight/lights.c
index 3b5068c..15db827 100644
--- a/liblight/lights.c
+++ b/liblight/lights.c
@@ -361,8 +361,14 @@
set_light = set_light_battery;
else if (0 == strcmp(LIGHT_ID_NOTIFICATIONS, name))
set_light = set_light_notifications;
- else if (0 == strcmp(LIGHT_ID_BUTTONS, name))
- set_light = set_light_buttons;
+ else if (0 == strcmp(LIGHT_ID_BUTTONS, name)) {
+ if (!access(BUTTON_FILE, F_OK)) {
+ // enable light button when the file is present
+ set_light = set_light_buttons;
+ } else {
+ return -EINVAL;
+ }
+ }
else if (0 == strcmp(LIGHT_ID_ATTENTION, name))
set_light = set_light_attention;
else