diff options
author | Dmitri Plotnikov <dplotnikov@google.com> | 2017-04-12 13:00:52 -0700 |
---|---|---|
committer | Dmitri Plotnikov <dplotnikov@google.com> | 2017-04-12 14:38:23 -0700 |
commit | 00e1c4f330d0723dfe24267ccb5588c09ec9a12c (patch) | |
tree | 40b4f7212289e910a07624da595fbd6849d4242c /init/builtins.cpp | |
parent | e4e4777fc775447a0cc76c3b23c9920bd6b49631 (diff) |
Passing additional parameter to powerctl
Test: adb reboot recovery,foo and verify that the parameter reaches bootloader
Change-Id: I9690cf96cf9730e5324b9f5310c3d0341fe25fe2
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r-- | init/builtins.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp index 7298dff4f..e1d9b94ee 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -607,7 +607,7 @@ static int do_powerctl(const std::vector<std::string>& args) { bool runFsck = false; bool commandInvalid = false; - if (cmd_params.size() > 2) { + if (cmd_params.size() > 3) { commandInvalid = true; } else if (cmd_params[0] == "shutdown") { cmd = ANDROID_RB_POWEROFF; @@ -619,7 +619,7 @@ static int do_powerctl(const std::vector<std::string>& args) { } } else if (cmd_params[0] == "reboot") { cmd = ANDROID_RB_RESTART2; - if (cmd_params.size() == 2) { + if (cmd_params.size() >= 2) { reboot_target = cmd_params[1]; // When rebooting to the bootloader notify the bootloader writing // also the BCB. @@ -631,6 +631,10 @@ static int do_powerctl(const std::vector<std::string>& args) { << err; } } + // If there is an additional bootloader parameter, pass it along + if (cmd_params.size() == 3) { + reboot_target += "," + cmd_params[2]; + } } } else if (command == "thermal-shutdown") { // no additional parameter allowed cmd = ANDROID_RB_THERMOFF; |