diff options
author | leozwang <leozwang@google.com> | 2016-03-13 09:58:48 -0700 |
---|---|---|
committer | leozwang <leozwang@google.com> | 2016-03-14 10:38:46 -0700 |
commit | b523f437c66adbb87275fae2ab78d257188b5590 (patch) | |
tree | dd4851ba7cabb106db8dd29d60cbe1cf7b46ff9b | |
parent | ded919318b50551c02632b1afa558a20bce202db (diff) | |
download | rockchip-b523f437c66adbb87275fae2ab78d257188b5590.tar.gz |
Add some empty lights functions
Bug: 27381177
Change-Id: Ia8e4bf8394032f7ec6d700e0bfb9281085ce3cd0
-rw-r--r-- | lights/Android.mk | 2 | ||||
-rw-r--r-- | lights/lights.c | 27 |
2 files changed, 27 insertions, 2 deletions
diff --git a/lights/Android.mk b/lights/Android.mk index 1aea964..1c488d3 100644 --- a/lights/Android.mk +++ b/lights/Android.mk @@ -18,7 +18,7 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := lights.c LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_SHARED_LIBRARIES := liblog -LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"lights\" +LOCAL_CFLAGS := $(common_flags) -Wno-unused-parameter -DLOG_TAG=\"lights\" LOCAL_MODULE := lights.$(TARGET_BOARD_PLATFORM) LOCAL_MODULE_TAGS := optional diff --git a/lights/lights.c b/lights/lights.c index 9f5b2d2..098e641 100644 --- a/lights/lights.c +++ b/lights/lights.c @@ -67,12 +67,29 @@ static int set_light_notifications(struct light_device_t* dev, if(!dev) { return -1; } + pthread_mutex_lock(&g_lock); - err = write_int(LED1_LED_FILE, SET_LIGHT(state->color)); + switch (state->flashMode) { + case LIGHT_FLASH_NONE: + err = write_int(LED1_LED_FILE, SET_LIGHT(state->color)); + break; + + /** Doesn't support flash. */ + case LIGHT_FLASH_TIMED: + default: + err = -EINVAL; + } pthread_mutex_unlock(&g_lock); return err; } +/** Not available on Kylin. */ +static int set_light_unavailable(struct light_device_t* dev, + struct light_state_t const* state) +{ + return -EINVAL; +} + /** Close the lights device */ static int close_lights(struct light_device_t *dev) { @@ -98,6 +115,14 @@ static int open_lights(const struct hw_module_t* module, char const* name, if (0 == strcmp(LIGHT_ID_NOTIFICATIONS, name)) set_light = set_light_notifications; + else if (0 == strcmp(LIGHT_ID_ATTENTION, name)) + set_light = set_light_notifications; + else if (0 == strcmp(LIGHT_ID_BUTTONS, name)) + set_light = set_light_unavailable; + else if (0 == strcmp(LIGHT_ID_BLUETOOTH, name)) + set_light = set_light_unavailable; + else if (0 == strcmp(LIGHT_ID_WIFI, name)) + set_light = set_light_unavailable; else return -EINVAL; |