summaryrefslogtreecommitdiff
path: root/util/flash_cr50.py
diff options
context:
space:
mode:
Diffstat (limited to 'util/flash_cr50.py')
-rwxr-xr-xutil/flash_cr50.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/util/flash_cr50.py b/util/flash_cr50.py
index 6dde1148af..d94ef7fb6e 100755
--- a/util/flash_cr50.py
+++ b/util/flash_cr50.py
@@ -410,6 +410,8 @@ class BatteryCutoffReset(Cr50Reset):
# EC console needs to be read-write to issue cutoff command.
'ec_uart',
)
+ CHECK_EC_RETRIES = 5
+ WAIT_EC = 3
def run_reset(self):
"""Use EC commands to cutoff the battery."""
@@ -423,9 +425,14 @@ class BatteryCutoffReset(Cr50Reset):
self._servo.dut_control('ec_uart_cmd:reboot', check_error=False,
wait=True)
- if not self._servo.dut_control('ec_board', check_error=False)[0]:
+ for i in range(self.CHECK_EC_RETRIES):
+ time.sleep(self.WAIT_EC)
+ if self._servo.dut_control('ec_board', check_error=False)[0]:
+ logging.info('Device is cutoff')
+ return
+ logging.info('EC still responsive')
+ else:
raise Error('EC still responsive after cutoff')
- logging.info('Device is cutoff')
def recover_from_reset(self):
"""Connect power using servo v4 to recover from cutoff."""