Enable battery cutoff flow for in-place wiping
It supports the following cutoff options in test list and gooftool:
- cutoff_method: battery cutoff method after wiping.
- cutoff_ac_state: either 'connect_ac' or 'remove_ac'.
- min_charge_pct: min battery percentage when performing battery
cutoff.
- max_charge_pct: max battery percentage when performing
battery cutoff.
- min_charge_voltage: min battery voltage when performing battery
cutoff.
- max_charge_voltage: max battery voltage when performing battery
cutoff.
BUG=chromium:544021
TEST=Manually tested on Samus
CQ-DEPEND=CL:304535
Change-Id: I972b72fa4eafde16a9b9bb8e20708d16a97bfd8e
Reviewed-on: https://chromium-review.googlesource.com/304474
Commit-Ready: Shun-Hsing Ou <shunhsingou@chromium.org>
Tested-by: Shun-Hsing Ou <shunhsingou@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
diff --git a/py/gooftool/gooftool.py b/py/gooftool/gooftool.py
index e87cd7f..1f8d149 100755
--- a/py/gooftool/gooftool.py
+++ b/py/gooftool/gooftool.py
@@ -670,14 +670,24 @@
GetGooftool(options).GenerateStableDeviceSecret()
event_log.Log('generate_stable_device_secret')
+_cutoff_args_cmd_arg = CmdArg(
+ '--cutoff_args',
+ help='Battery cutoff arguments to be passed to battery_cutoff.sh '
+ 'after wiping. Should be the following format: '
+ '[--method shutdown|reboot|battery_cutoff|battery_cutoff_at_shutdown] '
+ '[--check-ac connect_ac|remove_ac] '
+ '[--min-battery-percent <minimum battery percentage>] '
+ '[--max-battery-percent <maximum battery percentage>] '
+ '[--min-battery-voltage <minimum battery voltage>] '
+ '[--max-battery-voltage <maximum battery voltage>]')
@Command('wipe_in_place',
CmdArg('--fast', action='store_true',
- help='use non-secure but faster wipe method.'))
+ help='use non-secure but faster wipe method.'),
+ _cutoff_args_cmd_arg)
def WipeInPlace(options):
"""Start factory wipe directly without reboot."""
- GetGooftool(options).WipeInPlace(options.fast)
-
+ GetGooftool(options).WipeInPlace(options.fast, options.cutoff_args)
@Command('prepare_wipe',
CmdArg('--fast', action='store_true',
@@ -869,6 +879,7 @@
help='use non-secure but faster wipe method.'),
CmdArg('--wipe_in_place', action='store_true',
help='Start factory wiping in place without reboot.'),
+ _cutoff_args_cmd_arg,
_hwid_version_cmd_arg,
_hwdb_path_cmd_arg,
_hwid_status_list_cmd_arg,