davinci: lights: Adjust for davincis LEDs
Change-Id: If9e5afe292b023a8aa4d5ba509e206f9a4ff371f
This commit is contained in:
parent
3e94ffe9a3
commit
5af8701925
@ -22,8 +22,8 @@
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#define LCD_LED "/sys/class/backlight/panel0-backlight/"
|
||||
#define WHITE_LED "/sys/class/leds/white/"
|
||||
#define PANEL_LED "/sys/class/backlight/panel0-backlight/"
|
||||
#define NOTIFICATION_LED "/sys/class/leds/green/"
|
||||
|
||||
#define BREATH "breath"
|
||||
#define BRIGHTNESS "brightness"
|
||||
@ -83,24 +83,24 @@ static inline uint32_t getScaledBrightness(const LightState& state, uint32_t max
|
||||
|
||||
static void handleBacklight(const LightState& state) {
|
||||
uint32_t brightness = getScaledBrightness(state, MAX_LCD_BRIGHTNESS);
|
||||
set(LCD_LED BRIGHTNESS, brightness);
|
||||
set(PANEL_LED BRIGHTNESS, brightness);
|
||||
}
|
||||
|
||||
static void handleNotification(const LightState& state) {
|
||||
uint32_t whiteBrightness = getScaledBrightness(state, MAX_LED_BRIGHTNESS);
|
||||
uint32_t notificationBrightness = getScaledBrightness(state, MAX_LED_BRIGHTNESS);
|
||||
|
||||
/* Disable breathing or blinking */
|
||||
set(WHITE_LED BREATH, 0);
|
||||
set(NOTIFICATION_LED BREATH, 0);
|
||||
|
||||
switch (state.flashMode) {
|
||||
case Flash::HARDWARE:
|
||||
case Flash::TIMED:
|
||||
/* Breathing */
|
||||
set(WHITE_LED BREATH, 1);
|
||||
set(NOTIFICATION_LED BREATH, 1);
|
||||
break;
|
||||
case Flash::NONE:
|
||||
default:
|
||||
set(WHITE_LED BRIGHTNESS, whiteBrightness);
|
||||
set(NOTIFICATION_LED BRIGHTNESS, notificationBrightness);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
on boot
|
||||
chown system system /sys/class/backlight/panel0-backlight/brightness
|
||||
chown system system /sys/class/backlight/panel0-backlight/max_brightness
|
||||
chown system system /sys/class/leds/white/brightness
|
||||
chown system system /sys/class/leds/white/breath
|
||||
chown system system /sys/class/leds/green/brightness
|
||||
chown system system /sys/class/leds/green/breath
|
||||
|
||||
chmod 0644 /sys/class/backlight/panel0-backlight/brightness
|
||||
chmod 0644 /sys/class/backlight/panel0-backlight/max_brightness
|
||||
chmod 0644 /sys/class/leds/white/brightness
|
||||
chmod 0644 /sys/class/leds/white/breath
|
||||
chmod 0644 /sys/class/leds/green/brightness
|
||||
chmod 0644 /sys/class/leds/green/breath
|
||||
|
||||
service vendor.light-hal-2-0 /vendor/bin/hw/android.hardware.light@2.0-service.davinci
|
||||
interface android.hardware.light@2.0::ILight default
|
||||
|
Loading…
Reference in New Issue
Block a user