liblights: Add support for variable touchkey brightness

Change-Id: Icc5c589e88dc342ae50b432187bae65a9b3a23d7
tirimbino
Dominggoes Isakh 8 years ago committed by Christopher N. Hesse
parent 63b5bd7d6b
commit d81a0a3b06
  1. 3
      liblights/include/samsung_lights.h
  2. 9
      liblights/lights.c

@ -30,6 +30,9 @@
#define BUTTON_BRIGHTNESS_NODE "/sys/class/sec/sec_touchkey/brightness"
#define LED_BLINK_NODE "/sys/class/sec/led/led_blink"
// Set to 1 to enable variable button brightness
#define VAR_BUTTON_BRIGHTNESS 0
/*
* Brightness adjustment factors
*

@ -145,12 +145,13 @@ static int set_light_buttons(struct light_device_t* dev __unused,
struct light_state_t const* state)
{
int err = 0;
int on = (state->color & COLOR_MASK);
pthread_mutex_lock(&g_lock);
int brightness = (state->color & COLOR_MASK) ? 1 : 0;
err = set_cur_button_brightness(on ? 1 : 0);
#ifdef VAR_BUTTON_BRIGHTNESS
brightness = rgb_to_brightness(state);
#endif
err = set_cur_button_brightness(brightness);
pthread_mutex_unlock(&g_lock);
return err;

Loading…
Cancel
Save