summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--liblight/Android.mk4
-rw-r--r--liblight/lights.c22
2 files changed, 26 insertions, 0 deletions
diff --git a/liblight/Android.mk b/liblight/Android.mk
index 9933c34..8c4ae27 100644
--- a/liblight/Android.mk
+++ b/liblight/Android.mk
@@ -28,5 +28,9 @@ LOCAL_MODULE := lights.aries
LOCAL_MODULE_TAGS := optional
+ifdef BOARD_BUTTON_LIGHTS_PATH
+ LOCAL_CFLAGS += -DBUTTONS_FILE=\"$(BOARD_BUTTON_LIGHTS_PATH)\"
+endif
+
include $(BUILD_SHARED_LIBRARY)
diff --git a/liblight/lights.c b/liblight/lights.c
index 86feb9d..47bd5ce 100644
--- a/liblight/lights.c
+++ b/liblight/lights.c
@@ -98,6 +98,24 @@ static int set_light_backlight(struct light_device_t *dev,
return err;
}
+#ifdef BUTTONS_FILE
+static int set_light_buttons(struct light_device_t *dev,
+ struct light_state_t const *state)
+{
+ int touch_led_control = !!(state->color & 0x00ffffff);
+ int res;
+
+ ALOGD("set_light_buttons: color=%#010x, tlc=%u.", state->color,
+ touch_led_control);
+
+ pthread_mutex_lock(&g_lock);
+ res = write_int(BUTTONS_FILE, touch_led_control);
+ pthread_mutex_unlock(&g_lock);
+
+ return res;
+}
+#endif
+
static int close_lights(struct light_device_t *dev)
{
ALOGV("close_light is called");
@@ -119,6 +137,10 @@ static int open_lights(const struct hw_module_t *module, char const *name,
set_light = set_light_backlight;
else if (0 == strcmp(LIGHT_ID_NOTIFICATIONS, name))
set_light = set_light_notifications;
+#ifdef BUTTONS_FILE
+ else if (0 == strcmp(LIGHT_ID_BUTTONS, name))
+ set_light = set_light_buttons;
+#endif
else
return -EINVAL;