diff options
| author | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2012-08-14 10:48:04 +0100 |
|---|---|---|
| committer | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2012-08-14 10:48:04 +0100 |
| commit | 51b14a69f822191de9cb569988296ab84091095a (patch) | |
| tree | 847cb814712a027fa8fb003df2268b19001a4499 /init/init.c | |
| parent | 82583bfef13e4ac6fb2a373992ce451717091552 (diff) | |
| download | system_core-51b14a69f822191de9cb569988296ab84091095a.tar.gz system_core-51b14a69f822191de9cb569988296ab84091095a.tar.bz2 system_core-51b14a69f822191de9cb569988296ab84091095a.zip | |
init: Reintroduce support for the older charger modes
For devices with pre-ICS bootloaders, bring in the support for
arbitrary cmdline charger flags from CM7
Change-Id: Ibf887f6aeca0b68aa38fe035aa586aed502f1662
Diffstat (limited to 'init/init.c')
| -rwxr-xr-x | init/init.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/init/init.c b/init/init.c index f6fb12c3..167661ae 100755 --- a/init/init.c +++ b/init/init.c @@ -69,11 +69,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; @@ -102,6 +108,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) { @@ -650,6 +658,8 @@ static void import_kernel_nv(char *name, int for_emulator) if (!strcmp(value,"true")) { emmc_boot = 1; } + } 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]; @@ -986,11 +996,11 @@ int main(int argc, char **argv) /* skip mounting filesystems in charger mode */ if (!is_charger) { action_for_each_trigger("early-fs", action_add_queue_tail); - if(emmc_boot) { - action_for_each_trigger("emmc-fs", action_add_queue_tail); - } else { - action_for_each_trigger("fs", action_add_queue_tail); - } + if(emmc_boot) { + action_for_each_trigger("emmc-fs", action_add_queue_tail); + } else { + action_for_each_trigger("fs", action_add_queue_tail); + } action_for_each_trigger("post-fs", action_add_queue_tail); action_for_each_trigger("post-fs-data", action_add_queue_tail); } @@ -999,6 +1009,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 { |
