From 3c04c0d0a83982b4b05cdbe628b28d10c496e47d Mon Sep 17 00:00:00 2001 From: codeworkx Date: Fri, 22 Jun 2012 17:13:18 +0200 Subject: [PATCH] exynos4x12: lower brightness on battery light Change-Id: Ic3cd8f9bac985e09d7f7df0521cbaadfc9640f11 --- exynos4/exynos4x12/liblights/lights.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/exynos4/exynos4x12/liblights/lights.c b/exynos4/exynos4x12/liblights/lights.c index 8b5288f..84ccc99 100644 --- a/exynos4/exynos4x12/liblights/lights.c +++ b/exynos4/exynos4x12/liblights/lights.c @@ -46,6 +46,7 @@ char const*const LED_RED = "/sys/class/sec/led/led_r"; 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"; #define MAX_WRITE_CMD 25 @@ -53,6 +54,7 @@ struct led_config { int red; int green; int blue; + char brightness[MAX_WRITE_CMD]; char blink[MAX_WRITE_CMD]; }; @@ -151,6 +153,7 @@ static int write_leds(struct led_config led) 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_BRIGHTNESS, led.brightness); err = write_str(LED_BLINK, led.blink); pthread_mutex_unlock(&g_lock); @@ -169,6 +172,7 @@ static int set_light_leds(struct light_state_t const *state, int type) led.red = 0; led.green = 0; led.blue = 0; + snprintf(led.brightness, MAX_WRITE_CMD, "0x00"); snprintf(led.blink, MAX_WRITE_CMD, "0x000000 0 0"); break; case LIGHT_FLASH_TIMED: @@ -176,6 +180,7 @@ static int set_light_leds(struct light_state_t const *state, int type) led.red = (colorRGB >> 16) & 0xFF; led.green = (colorRGB >> 8) & 0xFF; led.blue = colorRGB & 0xFF; + snprintf(led.brightness, MAX_WRITE_CMD, "0xFF"); snprintf(led.blink, MAX_WRITE_CMD, "0x%x %d %d", colorRGB, state->flashOnMS, state->flashOffMS); break; default: @@ -204,11 +209,13 @@ static int set_light_battery(struct light_device_t *dev, led.red = 0; led.green = 0; led.blue = 0; + snprintf(led.brightness, MAX_WRITE_CMD, "0x00"); snprintf(led.blink, MAX_WRITE_CMD, "0x000000 0 0"); } else { led.red = (colorRGB >> 16) & 0xFF; led.green = (colorRGB >> 8) & 0xFF; led.blue = colorRGB & 0xFF; + snprintf(led.brightness, MAX_WRITE_CMD, "0x00"); snprintf(led.blink, MAX_WRITE_CMD, "0x%x %d %d", colorRGB, state->flashOnMS, state->flashOffMS); } -- 2.20.1