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
This commit is contained in:
Arun Kumar K.R
2017-08-23 13:46:03 +05:30
parent edd9998668
commit 9ae5a34d17

View File

@@ -361,8 +361,14 @@ static int open_lights(const struct hw_module_t* module, char const* name,
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))
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