BackLight: Add support for button backlight.

Add function call to let framework layer could enable/disable the
button backlight.

Change-Id: I470ebb8953c5d3fdb72118dbaf06788c2079213e
This commit is contained in:
HuiWang
2013-07-31 10:48:36 +08:00
committed by Gerrit - the friendly Code Review server
parent a1af059bba
commit f73bc576b8

View File

@@ -51,6 +51,9 @@ char const*const BLUE_LED_FILE
char const*const LCD_FILE char const*const LCD_FILE
= "/sys/class/leds/lcd-backlight/brightness"; = "/sys/class/leds/lcd-backlight/brightness";
char const*const BUTTON_FILE
= "/sys/class/leds/button-backlight/brightness";
char const*const RED_BLINK_FILE char const*const RED_BLINK_FILE
= "/sys/class/leds/red/blink"; = "/sys/class/leds/red/blink";
@@ -209,6 +212,16 @@ set_light_attention(struct light_device_t* dev,
return 0; return 0;
} }
static int
set_light_buttons(struct light_device_t* dev,
struct light_state_t const* state)
{
int err = 0;
pthread_mutex_lock(&g_lock);
err = write_int(BUTTON_FILE, state->color & 0xFF);
pthread_mutex_unlock(&g_lock);
return err;
}
/** Close the lights device */ /** Close the lights device */
static int static int
@@ -238,6 +251,8 @@ static int open_lights(const struct hw_module_t* module, char const* name,
set_light = set_light_backlight; set_light = set_light_backlight;
else if (0 == strcmp(LIGHT_ID_NOTIFICATIONS, name)) else if (0 == strcmp(LIGHT_ID_NOTIFICATIONS, name))
set_light = set_light_notifications; set_light = set_light_notifications;
else if (0 == strcmp(LIGHT_ID_BUTTONS, name))
set_light = set_light_buttons;
else if (0 == strcmp(LIGHT_ID_ATTENTION, name)) else if (0 == strcmp(LIGHT_ID_ATTENTION, name))
set_light = set_light_attention; set_light = set_light_attention;
else else