diff options
author | codeworkx <codeworkx@cyanogenmod.org> | 2013-03-02 18:23:50 +0000 |
---|---|---|
committer | codeworkx <codeworkx@cyanogenmod.org> | 2013-03-02 18:23:50 +0000 |
commit | 7800b3bc1b6fe88f67eacb1e0df919526fe1904e (patch) | |
tree | 90a1a261a1c236b2068a7c89e78080b597d585a9 | |
parent | ee21f4bdd1e8b4d4302938c12a64f2efe6d9f49b (diff) | |
download | hardware_samsung-7800b3bc1b6fe88f67eacb1e0df919526fe1904e.zip hardware_samsung-7800b3bc1b6fe88f67eacb1e0df919526fe1904e.tar.gz hardware_samsung-7800b3bc1b6fe88f67eacb1e0df919526fe1904e.tar.bz2 |
exynos4210: lights: add missing brightness check
Change-Id: I7d307fbfe7581bfa76e7f4f6ce50f759683bf9dc
-rw-r--r-- | exynos4/exynos4210/liblights/lights.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/exynos4/exynos4210/liblights/lights.c b/exynos4/exynos4210/liblights/lights.c index fe1e83f..2d22b7c 100644 --- a/exynos4/exynos4210/liblights/lights.c +++ b/exynos4/exynos4210/liblights/lights.c @@ -254,14 +254,19 @@ set_light_buttons(struct light_device_t* dev, #ifdef EXYNOS4210_TABLET return 0; #else + int err = 0; + int brightness = rgb_to_brightness(state); load_settings(); - int err = 0; - pthread_mutex_lock(&g_lock); - ALOGD("set_light_button on=%d\n", g_enable_touchlight ? 1 : 0); - err = write_int(BUTTON_FILE, g_enable_touchlight ? 1 : 0); + if (brightness > 0) { + ALOGD("set_light_buttons on=%d\n", g_enable_touchlight ? 1 : 0); + err = write_int(BUTTON_FILE, g_enable_touchlight ? 1 : 0); + } else { + ALOGD("set_light_buttons off\n"); + err = write_int(BUTTON_FILE, 0); + } pthread_mutex_unlock(&g_lock); return err; |