static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER;
char const*const PANEL_FILE = "/sys/class/backlight/panel/brightness";
-#ifndef EXYNOS4X12_TABLET
char const*const BUTTON_FILE = "/sys/class/sec/sec_touchkey/brightness";
char const*const LED_RED = "/sys/class/sec/led/led_r";
char const*const LED_BLUE = "/sys/class/sec/led/led_b";
char const*const LED_BLINK = "/sys/class/sec/led/led_blink";
char const*const LED_BRIGHTNESS = "/sys/class/sec/led/led_br_lev";
-#endif
#define MAX_WRITE_CMD 25
{
int err = 0;
int brightness = rgb_to_brightness(state);
- int previous_brightness = read_int(PANEL_FILE);
pthread_mutex_lock(&g_lock);
err = write_int(PANEL_FILE, brightness);
set_light_buttons(struct light_device_t* dev,
struct light_state_t const* state)
{
-#ifdef EXYNOS4X12_TABLET
- return 0;
-#else
int err = 0;
int brightness = rgb_to_brightness(state);
pthread_mutex_unlock(&g_lock);
return err;
-#endif
}
/* LEDs */
static int write_leds(struct led_config led)
{
int err = 0;
-#ifndef EXYNOS4X12_TABLET
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);
err = write_str(LED_BLINK, led.blink);
pthread_mutex_unlock(&g_lock);
-#endif
return err;
}
static int set_light_leds(struct light_state_t const *state, int type)
{
-#ifdef EXYNOS4X12_TABLET
- return 0;
-#else
-
struct led_config led;
unsigned int colorRGB;
}
return write_leds(led);
-#endif
}
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)
{
-#ifdef EXYNOS4X12_TABLET
- return 0;
-#else
struct led_config led;
int brightness = rgb_to_brightness(state);
unsigned int colorRGB;
g_BatteryStore = led;
return write_leds(led);
-#endif
}
static int set_light_leds_attention(struct light_device_t *dev,
if (0 == strcmp(LIGHT_ID_BACKLIGHT, name))
set_light = set_light_backlight;
+#if !defined(EXYNOS4X12_TABLET) || defined(EXYNOS4X12_TABLET_HAS_LED_BUTTONS)
else if (0 == strcmp(LIGHT_ID_BUTTONS, name))
set_light = set_light_buttons;
+#endif
+#ifndef EXYNOS4X12_TABLET
else if (0 == strcmp(LIGHT_ID_NOTIFICATIONS, name))
set_light = set_light_leds_notifications;
else if (0 == strcmp(LIGHT_ID_ATTENTION, name))
set_light = set_light_leds_attention;
else if (0 == strcmp(LIGHT_ID_BATTERY, name))
set_light = set_light_battery;
+#endif
else
return -EINVAL;