Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9aace37f authored by Danny Baumann's avatar Danny Baumann Committed by Arne Coucheron
Browse files

Disable backlight when blanking panel.

This used to be the behaviour up to and including cm-11.0 (see e.g.
commit f7ce72ca), but in newer versions the backlight is only turned on
and never off (see commit 1e961c04). Fix it.

Change-Id: I6c3bf6abbb4e11dc010c360ecfe9f3bb3e2f3548
(cherry picked from commit 35493c4c)
parent 105ddef5
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -266,7 +266,7 @@ static int set_battery_soc_leds(int soc)
}

#define BACKLIGHT_ON_LEVEL    100
static int set_backlight_on(void)
static int set_backlight(bool on)
{
    int fd;
    char buffer[10];
@@ -284,7 +284,7 @@ static int set_backlight_on(void)
        return 0;
    }
    LOGV("Enabling backlight\n");
    snprintf(buffer, sizeof(buffer), "%d\n", BACKLIGHT_ON_LEVEL);
    snprintf(buffer, sizeof(buffer), "%d\n", on ? BACKLIGHT_ON_LEVEL : 0);
    if (write(fd, buffer,strlen(buffer)) < 0) {
        LOGE("Could not write to backlight node : %s\n", strerror(errno));
    }
@@ -570,6 +570,7 @@ static void update_screen_state(struct charger *charger, int64_t now)
    if (batt_anim->cur_cycle == batt_anim->num_cycles) {
        reset_animation(batt_anim);
        charger->next_screen_transition = -1;
        set_backlight(false);
        gr_fb_blank(true);
        LOGV("[%" PRId64 "] animation done\n", now);
        if (charger->charger_connected)
@@ -606,7 +607,7 @@ static void update_screen_state(struct charger *charger, int64_t now)
    /* unblank the screen on first cycle */
    if (batt_anim->cur_cycle == 0) {
        gr_fb_blank(false);
        set_backlight_on();
        set_backlight(true);
    }

    /* draw the new frame (@ cur_frame) */
@@ -740,6 +741,7 @@ static void process_key(struct charger *charger, int code, int64_t now)
                } else {
                    reset_animation(batt_anim);
                    charger->next_screen_transition = -1;
                    set_backlight(false);
                    gr_fb_blank(true);
                    if (charger->charger_connected)
                        request_suspend(true);
@@ -783,6 +785,7 @@ static void handle_power_supply_state(struct charger *charger, int64_t now)
        request_suspend(false);
        if (charger->next_pwr_check == -1) {
            if (mode == QUICKBOOT) {
                set_backlight(false);
                gr_fb_blank(true);
                request_suspend(true);
                /* exit here. There is no need to keep running when charger