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

Commit 91137e19 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

init: Bring back support for arbitrary chargermode cmdlines

This was accidentally removed while debugging the init breakage
fixed in change I8ef5c932efcd5e7f8d6f6fce0915683d84c3ee11. Put
it back

Change-Id: If35b9d5db281f8aab6de26f2bb63717d28b2db30
parent a39679fb
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -72,11 +72,17 @@ static int property_triggers_enabled = 0;
static int   bootchart_count;
#endif

#ifndef BOARD_CHARGING_CMDLINE_NAME
#define BOARD_CHARGING_CMDLINE_NAME "androidboot.battchg_pause"
#define BOARD_CHARGING_CMDLINE_VALUE "true"
#endif

static char console[32];
static char bootmode[32];
static char hardware[32];
static unsigned revision = 0;
static char qemu[32];
static char battchg_pause[32];

#ifdef HAVE_SELINUX
static int selinux_enabled = 1;
@@ -104,6 +110,8 @@ static const char *ENV[32];

static unsigned emmc_boot = 0;

static unsigned charging_mode = 0;

/* add_environment - add "key=value" to the current environment */
int add_environment(const char *key, const char *val)
{
@@ -667,6 +675,8 @@ static void import_kernel_nv(char *name, int for_emulator)
            emmc_boot = 1;
        }
#endif
    } else if (!strcmp(name,BOARD_CHARGING_CMDLINE_NAME)) {
        strlcpy(battchg_pause, value, sizeof(battchg_pause));
    } else if (!strncmp(name, "androidboot.", 12) && name_len > 12) {
        const char *boot_prop_name = name + 12;
        char prop[PROP_NAME_MAX];
@@ -1012,6 +1022,11 @@ int main(int argc, char **argv)
    queue_builtin_action(signal_init_action, "signal_init");
    queue_builtin_action(check_startup_action, "check_startup");

    /* Older bootloaders use non-standard charging modes. Check for
     * those now, after mounting the filesystems */
    if (strcmp(battchg_pause, BOARD_CHARGING_CMDLINE_VALUE) == 0)
        is_charger = 1;

    if (is_charger) {
        action_for_each_trigger("charger", action_add_queue_tail);
    } else {