summaryrefslogtreecommitdiffstats
path: root/liblights
diff options
context:
space:
mode:
authorChristopher N. Hesse <raymanfx@gmail.com>2016-12-01 15:51:12 +0100
committerChristopher N. Hesse <raymanfx@gmail.com>2017-01-30 22:01:54 +0000
commitcfb71af13e86025f38f801c7e11eddd09be7645e (patch)
treecf541efc6ae11999015ac92835435cc595b92a81 /liblights
parente09167dc3c7b173ab8e6b86ba9867cfb66cf956e (diff)
downloadandroid_hardware_samsung-cfb71af13e86025f38f801c7e11eddd09be7645e.tar.gz
android_hardware_samsung-cfb71af13e86025f38f801c7e11eddd09be7645e.tar.bz2
android_hardware_samsung-cfb71af13e86025f38f801c7e11eddd09be7645e.zip
liblights: Allow devices to override node paths
* Update the copyrights while we're at it. Change-Id: Ie1bbf1f5150428a47baf6615f32d703d578efb82
Diffstat (limited to 'liblights')
-rw-r--r--liblights/Android.mk14
-rw-r--r--liblights/include/samsung_lights.h31
-rw-r--r--liblights/lights.c12
3 files changed, 45 insertions, 12 deletions
diff --git a/liblights/Android.mk b/liblights/Android.mk
index 08d7e87..3acc7ba 100644
--- a/liblights/Android.mk
+++ b/liblights/Android.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2015 The CyanogenMod Project
+# Copyright (C) 2015-2016 The CyanogenMod Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,16 +12,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-LOCAL_PATH:= $(call my-dir)
-
ifneq ($(TARGET_PROVIDES_LIBLIGHT),true)
+LOCAL_PATH := $(call my-dir)
+
include $(CLEAR_VARS)
+LOCAL_SRC_FILES := lights.c
+
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
+
+LOCAL_SHARED_LIBRARIES := liblog
+
LOCAL_MODULE := lights.$(TARGET_BOOTLOADER_BOARD_NAME)
LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SHARED_LIBRARIES := liblog
-LOCAL_SRC_FILES := lights.c
LOCAL_MODULE_TAGS := optional
include $(BUILD_SHARED_LIBRARY)
diff --git a/liblights/include/samsung_lights.h b/liblights/include/samsung_lights.h
new file mode 100644
index 0000000..b853b0e
--- /dev/null
+++ b/liblights/include/samsung_lights.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2016 The CyanogenMod Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SAMSUNG_LIGHTS_H
+#define SAMSUNG_LIGHTS_H
+
+/*
+ * Board specific nodes
+ *
+ * If your kernel exposes these controls in another place, you can either
+ * symlink to the locations given here, or override this header in your
+ * device tree.
+ */
+#define PANEL_BRIGHTNESS_NODE "/sys/class/backlight/panel/brightness"
+#define BUTTON_BRIGHTNESS_NODE "/sys/class/sec/sec_touchkey/brightness"
+#define LED_BLINK_NODE "/sys/class/sec/led/led_blink"
+
+#endif // SAMSUNG_LIGHTS_H
diff --git a/liblights/lights.c b/liblights/lights.c
index d439eda..6da32e2 100644
--- a/liblights/lights.c
+++ b/liblights/lights.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
- * Copyright (C) 2015 The CyanogenMod Project
+ * Copyright (C) 2015-2016 The CyanogenMod Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,7 @@
#include <hardware/lights.h>
-#define PANEL_FILE "/sys/class/backlight/panel/brightness"
-#define BUTTON_FILE "/sys/class/sec/sec_touchkey/brightness"
-#define LED_BLINK "/sys/class/sec/led/led_blink"
+#include "samsung_lights.h"
#define COLOR_MASK 0x00ffffff
@@ -116,7 +114,7 @@ static int set_light_backlight(struct light_device_t *dev __unused,
int brightness = rgb_to_brightness(state);
pthread_mutex_lock(&g_lock);
- err = write_int(PANEL_FILE, brightness);
+ err = write_int(PANEL_BRIGHTNESS_NODE, brightness);
pthread_mutex_unlock(&g_lock);
return err;
@@ -130,7 +128,7 @@ static int set_light_buttons(struct light_device_t* dev __unused,
pthread_mutex_lock(&g_lock);
- err = write_int(BUTTON_FILE, on ? 1 : 0);
+ err = write_int(BUTTON_BRIGHTNESS_NODE, on ? 1 : 0);
pthread_mutex_unlock(&g_lock);
@@ -179,7 +177,7 @@ static int write_leds(const struct led_config *led)
blink[count+1] = '\0';
pthread_mutex_lock(&g_lock);
- err = write_str(LED_BLINK, blink);
+ err = write_str(LED_BLINK_NODE, blink);
pthread_mutex_unlock(&g_lock);
return err;