#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;