summaryrefslogtreecommitdiffstats
path: root/healthd/healthd_mode_charger.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'healthd/healthd_mode_charger.cpp')
-rw-r--r--healthd/healthd_mode_charger.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/healthd/healthd_mode_charger.cpp b/healthd/healthd_mode_charger.cpp
index d6c31cf6a..6df9f125e 100644
--- a/healthd/healthd_mode_charger.cpp
+++ b/healthd/healthd_mode_charger.cpp
@@ -82,6 +82,10 @@ char *locale;
#define BLUE_LED_PATH "/sys/class/leds/blue/brightness"
#endif
+#ifndef BLINK_PATH
+#define BLINK_PATH "/sys/class/leds/red/device/blink"
+#endif
+
#define LOGE(x...) do { KLOG_ERROR("charger", x); } while (0)
#define LOGW(x...) do { KLOG_WARNING("charger", x); } while (0)
#define LOGV(x...) do { KLOG_DEBUG("charger", x); } while (0)
@@ -214,6 +218,26 @@ static int char_height;
static bool minui_inited;
#ifndef NO_CHARGER_LED
+static int set_blink(int val)
+{
+ int fd;
+ char buffer[10];
+
+ fd = open(BLINK_PATH, O_RDWR);
+ if (fd < 0) {
+ LOGE("Could not open blink file\n");
+ return -1;
+ }
+ snprintf(buffer, sizeof(buffer), "%d\n", val);
+ if (write(fd, buffer, strlen(buffer)) < 0) {
+ LOGE("Could not write to blink file\n");
+ close(fd);
+ return -1;
+ }
+ close(fd);
+ return 0;
+}
+
static int set_tricolor_led(int on, int color)
{
int fd, i;
@@ -258,6 +282,9 @@ static int set_battery_soc_leds(int soc)
LOGV("soc = %d, set led color 0x%x\n", soc, soc_leds[i].color);
}
+ /* This is required to commit the changes to hardware */
+ set_blink(0);
+
return 0;
}
#endif