From d2d26ffc5cc1cba8e563259b6e15384024cc9224 Mon Sep 17 00:00:00 2001 From: Mrcl1450 Date: Thu, 30 Jul 2015 18:03:09 +0100 Subject: [PATCH] healthd: Add secondary backlight path support Some devices require two backlight brightness paths to turn off the screen. Change-Id: Ibf2ee853657c602158af219de0ba132f29dc4571 Signed-off-by: Mrcl1450 --- healthd/Android.mk | 1 + healthd/healthd_mode_charger.cpp | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/healthd/Android.mk b/healthd/Android.mk index 71fd8f367e2..cd2f1705781 100644 --- a/healthd/Android.mk +++ b/healthd/Android.mk @@ -36,6 +36,7 @@ HEALTHD_CHARGER_DEFINES := RED_LED_PATH \ GREEN_LED_PATH \ BLUE_LED_PATH \ BACKLIGHT_PATH \ + SECONDARY_BACKLIGHT_PATH \ CHARGING_ENABLED_PATH $(foreach healthd_charger_define,$(HEALTHD_CHARGER_DEFINES), \ diff --git a/healthd/healthd_mode_charger.cpp b/healthd/healthd_mode_charger.cpp index 75f001d0216..4e6586d0fa5 100644 --- a/healthd/healthd_mode_charger.cpp +++ b/healthd/healthd_mode_charger.cpp @@ -289,6 +289,25 @@ static int set_backlight(bool on) } close(fd); +#ifdef SECONDARY_BACKLIGHT_PATH + if (access(SECONDARY_BACKLIGHT_PATH, R_OK | W_OK) != 0) + { + LOGW("Secondary Backlight control not support\n"); + return 0; + } + + fd = open(SECONDARY_BACKLIGHT_PATH, O_RDWR); + if (fd < 0) { + LOGE("Could not open secondary backlight node : %s\n", strerror(errno)); + return 0; + } + LOGV("Enabling secondary backlight\n"); + if (write(fd, buffer,strlen(buffer)) < 0) { + LOGE("Could not write to secondary backlight node : %s\n", strerror(errno)); + } + close(fd); +#endif + return 0; }