diff options
author | XpLoDWilD <xplodgui@gmail.com> | 2012-06-26 13:23:55 +0200 |
---|---|---|
committer | XpLoDWilD <xplodgui@gmail.com> | 2012-06-26 13:23:55 +0200 |
commit | f2d31f2429158e5d7e62264e302a28cea327a5f1 (patch) | |
tree | a5e544f889e03a5f4fcf92c8b01d21f60cfe28c7 /exynos4 | |
parent | 48421e2da2538026a6e249e3b8a588d0fd40a860 (diff) | |
download | hardware_samsung-f2d31f2429158e5d7e62264e302a28cea327a5f1.zip hardware_samsung-f2d31f2429158e5d7e62264e302a28cea327a5f1.tar.gz hardware_samsung-f2d31f2429158e5d7e62264e302a28cea327a5f1.tar.bz2 |
liblights: Store LED battery status and restore it after a notification LED blinking
Change-Id: Ifd01e3dea28ecc0dac94f2ff44b94e81493ba2a4
Diffstat (limited to 'exynos4')
-rw-r--r-- | exynos4/exynos4x12/liblights/lights.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/exynos4/exynos4x12/liblights/lights.c b/exynos4/exynos4x12/liblights/lights.c index 27a8d2e..43801ff 100644 --- a/exynos4/exynos4x12/liblights/lights.c +++ b/exynos4/exynos4x12/liblights/lights.c @@ -57,6 +57,8 @@ struct led_config { char blink[MAX_WRITE_CMD]; }; +struct led_config g_BatteryStore; + void init_g_lock(void) { pthread_mutex_init(&g_lock, NULL); @@ -167,10 +169,8 @@ static int set_light_leds(struct light_state_t const *state, int type) switch (state->flashMode) { case LIGHT_FLASH_NONE: - led.red = 0; - led.green = 0; - led.blue = 0; - snprintf(led.blink, MAX_WRITE_CMD, "0x000000 0 0"); + // use battery led state stored (black if nothing) + led = g_BatteryStore; break; case LIGHT_FLASH_TIMED: case LIGHT_FLASH_HARDWARE: @@ -213,6 +213,7 @@ static int set_light_battery(struct light_device_t *dev, } pthread_mutex_lock(&g_lock); + g_BatteryStore = led; err = write_int(LED_RED, led.red); err = write_int(LED_GREEN, led.green); err = write_int(LED_BLUE, led.blue); @@ -246,6 +247,10 @@ static int open_lights(const struct hw_module_t *module, char const *name, pthread_once(&g_init, init_g_lock); + g_BatteryStore.red = 0; + g_BatteryStore.green = 0; + g_BatteryStore.blue = 0; + struct light_device_t *dev = malloc(sizeof(struct light_device_t)); memset(dev, 0, sizeof(*dev)); |