mirror of
https://github.com/team-infusion-developers/android_hardware_samsung.git
synced 2024-11-06 21:55:41 +00:00
liblights: Allow devices to override node paths
* Update the copyrights while we're at it. Change-Id: Ie1bbf1f5150428a47baf6615f32d703d578efb82
This commit is contained in:
parent
1d09298e09
commit
ae27148492
3 changed files with 45 additions and 12 deletions
|
@ -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");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with 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
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
LOCAL_PATH:= $(call my-dir)
|
|
||||||
|
|
||||||
ifneq ($(TARGET_PROVIDES_LIBLIGHT),true)
|
ifneq ($(TARGET_PROVIDES_LIBLIGHT),true)
|
||||||
|
|
||||||
|
LOCAL_PATH := $(call my-dir)
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
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 := lights.$(TARGET_BOOTLOADER_BOARD_NAME)
|
||||||
LOCAL_MODULE_RELATIVE_PATH := hw
|
LOCAL_MODULE_RELATIVE_PATH := hw
|
||||||
LOCAL_SHARED_LIBRARIES := liblog
|
|
||||||
LOCAL_SRC_FILES := lights.c
|
|
||||||
LOCAL_MODULE_TAGS := optional
|
LOCAL_MODULE_TAGS := optional
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
31
liblights/include/samsung_lights.h
Normal file
31
liblights/include/samsung_lights.h
Normal file
|
@ -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
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2013 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -31,9 +31,7 @@
|
||||||
|
|
||||||
#include <hardware/lights.h>
|
#include <hardware/lights.h>
|
||||||
|
|
||||||
#define PANEL_FILE "/sys/class/backlight/panel/brightness"
|
#include "samsung_lights.h"
|
||||||
#define BUTTON_FILE "/sys/class/sec/sec_touchkey/brightness"
|
|
||||||
#define LED_BLINK "/sys/class/sec/led/led_blink"
|
|
||||||
|
|
||||||
#define COLOR_MASK 0x00ffffff
|
#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);
|
int brightness = rgb_to_brightness(state);
|
||||||
|
|
||||||
pthread_mutex_lock(&g_lock);
|
pthread_mutex_lock(&g_lock);
|
||||||
err = write_int(PANEL_FILE, brightness);
|
err = write_int(PANEL_BRIGHTNESS_NODE, brightness);
|
||||||
|
|
||||||
pthread_mutex_unlock(&g_lock);
|
pthread_mutex_unlock(&g_lock);
|
||||||
return err;
|
return err;
|
||||||
|
@ -130,7 +128,7 @@ static int set_light_buttons(struct light_device_t* dev __unused,
|
||||||
|
|
||||||
pthread_mutex_lock(&g_lock);
|
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);
|
pthread_mutex_unlock(&g_lock);
|
||||||
|
|
||||||
|
@ -179,7 +177,7 @@ static int write_leds(const struct led_config *led)
|
||||||
blink[count+1] = '\0';
|
blink[count+1] = '\0';
|
||||||
|
|
||||||
pthread_mutex_lock(&g_lock);
|
pthread_mutex_lock(&g_lock);
|
||||||
err = write_str(LED_BLINK, blink);
|
err = write_str(LED_BLINK_NODE, blink);
|
||||||
pthread_mutex_unlock(&g_lock);
|
pthread_mutex_unlock(&g_lock);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
|
Loading…
Reference in a new issue