|
|
|
@ -40,6 +40,7 @@ static pthread_once_t g_init = PTHREAD_ONCE_INIT; |
|
|
|
|
static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER; |
|
|
|
|
|
|
|
|
|
char const*const PANEL_FILE = "/sys/class/backlight/panel/brightness"; |
|
|
|
|
#ifndef EXYNOS4X12_TABLET |
|
|
|
|
char const*const BUTTON_FILE = "/sys/class/sec/sec_touchkey/brightness"; |
|
|
|
|
|
|
|
|
|
char const*const LED_RED = "/sys/class/sec/led/led_r"; |
|
|
|
@ -47,6 +48,7 @@ char const*const LED_GREEN = "/sys/class/sec/led/led_g"; |
|
|
|
|
char const*const LED_BLUE = "/sys/class/sec/led/led_b"; |
|
|
|
|
char const*const LED_BLINK = "/sys/class/sec/led/led_blink"; |
|
|
|
|
char const*const LED_BRIGHTNESS = "/sys/class/sec/led/led_br_lev"; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#define MAX_WRITE_CMD 25 |
|
|
|
|
|
|
|
|
@ -156,9 +158,12 @@ static int set_light_backlight(struct light_device_t *dev, |
|
|
|
|
pthread_mutex_lock(&g_lock); |
|
|
|
|
|
|
|
|
|
err = write_int(PANEL_FILE, brightness); |
|
|
|
|
|
|
|
|
|
#ifndef EXYNOS4X12_TABLET |
|
|
|
|
if (!previous_brightness && (brightness > 0)) { |
|
|
|
|
err = write_int(BUTTON_FILE, brightness > 0 ? 1 : 2); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
pthread_mutex_unlock(&g_lock); |
|
|
|
|
|
|
|
|
|
return err; |
|
|
|
@ -177,19 +182,23 @@ static int close_lights(struct light_device_t *dev) |
|
|
|
|
static int write_leds(struct led_config led) |
|
|
|
|
{ |
|
|
|
|
int err = 0; |
|
|
|
|
|
|
|
|
|
#ifndef EXYNOS4X12_TABLET |
|
|
|
|
pthread_mutex_lock(&g_lock); |
|
|
|
|
err = write_int(LED_RED, led.red); |
|
|
|
|
err = write_int(LED_GREEN, led.green); |
|
|
|
|
err = write_int(LED_BLUE, led.blue); |
|
|
|
|
err = write_str(LED_BLINK, led.blink); |
|
|
|
|
pthread_mutex_unlock(&g_lock); |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
return err; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int set_light_leds(struct light_state_t const *state, int type) |
|
|
|
|
{ |
|
|
|
|
#ifdef EXYNOS4X12_TABLET |
|
|
|
|
return 0; |
|
|
|
|
#else |
|
|
|
|
|
|
|
|
|
struct led_config led; |
|
|
|
|
unsigned int colorRGB; |
|
|
|
|
|
|
|
|
@ -219,6 +228,7 @@ static int set_light_leds(struct light_state_t const *state, int type) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return write_leds(led); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int set_light_leds_notifications(struct light_device_t *dev, |
|
|
|
@ -230,6 +240,9 @@ static int set_light_leds_notifications(struct light_device_t *dev, |
|
|
|
|
static int set_light_battery(struct light_device_t *dev, |
|
|
|
|
struct light_state_t const *state) |
|
|
|
|
{ |
|
|
|
|
#ifdef EXYNOS4X12_TABLET |
|
|
|
|
return 0; |
|
|
|
|
#else |
|
|
|
|
struct led_config led; |
|
|
|
|
int brightness = rgb_to_brightness(state); |
|
|
|
|
unsigned int colorRGB; |
|
|
|
@ -251,6 +264,7 @@ static int set_light_battery(struct light_device_t *dev, |
|
|
|
|
|
|
|
|
|
g_BatteryStore = led; |
|
|
|
|
return write_leds(led); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int set_light_leds_attention(struct light_device_t *dev, |
|
|
|
|