summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcodeworkx <daniel.hillenbrand@codeworkx.de>2012-06-24 19:21:40 +0200
committercodeworkx <daniel.hillenbrand@codeworkx.de>2012-06-24 19:21:40 +0200
commit48421e2da2538026a6e249e3b8a588d0fd40a860 (patch)
tree9d6f634469b6632933d67081ed1594c1d907c057
parent3c04c0d0a83982b4b05cdbe628b28d10c496e47d (diff)
downloadandroid_hardware_samsung-48421e2da2538026a6e249e3b8a588d0fd40a860.tar.gz
android_hardware_samsung-48421e2da2538026a6e249e3b8a588d0fd40a860.tar.bz2
android_hardware_samsung-48421e2da2538026a6e249e3b8a588d0fd40a860.zip
lights: lower battery led brightness
Change-Id: I9cd680a760f81d0b131dc3e9d37e5f8f19171c00
-rw-r--r--exynos4/exynos4x12/liblights/lights.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/exynos4/exynos4x12/liblights/lights.c b/exynos4/exynos4x12/liblights/lights.c
index 84ccc99..27a8d2e 100644
--- a/exynos4/exynos4x12/liblights/lights.c
+++ b/exynos4/exynos4x12/liblights/lights.c
@@ -54,7 +54,6 @@ struct led_config {
int red;
int green;
int blue;
- char brightness[MAX_WRITE_CMD];
char blink[MAX_WRITE_CMD];
};
@@ -153,7 +152,6 @@ 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);
@@ -172,7 +170,6 @@ 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:
@@ -180,7 +177,6 @@ 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:
@@ -199,6 +195,7 @@ 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)
{
+ int err = 0;
struct led_config led;
int brightness = rgb_to_brightness(state);
unsigned int colorRGB;
@@ -209,17 +206,19 @@ 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);
+ led.red = (((colorRGB >> 16) & 0xFF) / 255) * 20;
+ led.green = (((colorRGB >> 8) & 0xFF) / 255) * 20;
+ led.blue = ((colorRGB & 0xFF) / 255) * 20;
}
- return write_leds(led);
+ 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);
+ pthread_mutex_unlock(&g_lock);
+
+ return err;
}
static int set_light_leds_attention(struct light_device_t *dev,