diff --git a/liblight/lights.c b/liblight/lights.c index 3b5068cf..15db827b 100644 --- a/liblight/lights.c +++ b/liblight/lights.c @@ -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)) - 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