From 679d203f63c9c6c64825b2df0b0f005e4aaaeee4 Mon Sep 17 00:00:00 2001 From: Gary D Date: Thu, 28 Jun 2012 05:05:36 -0400 Subject: [PATCH] fix keypad lighting up when screen backlight auto-adjusts If the screen backlight was already lit and is just changing brightness, don't blindly illuminate the keypad Change-Id: If7473eb57aa4d48bc98a4bb42b9becc80764b1f8 Signed-off-by: Gary D --- exynos4/exynos4x12/liblights/lights.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/exynos4/exynos4x12/liblights/lights.c b/exynos4/exynos4x12/liblights/lights.c index 43801ff8..de2f6530 100644 --- a/exynos4/exynos4x12/liblights/lights.c +++ b/exynos4/exynos4x12/liblights/lights.c @@ -126,11 +126,15 @@ static int set_light_backlight(struct light_device_t *dev, struct light_state_t const *state) { int err = 0; + status int s_previous_brightness = -1; int brightness = rgb_to_brightness(state); pthread_mutex_lock(&g_lock); err = write_int(PANEL_FILE, brightness); - err = write_int(BUTTON_FILE, brightness > 0 ? 1 : 2); + if (!s_previous_brightness && (brightness > 0)) { + err = write_int(BUTTON_FILE, brightness > 0 ? 1 : 2); + s_previous_brightness = brightness; + } pthread_mutex_unlock(&g_lock); return err;