summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2022-11-08 07:58:08 -0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-14 19:37:41 +0000
commit42b8994d8cdfc87d2a30aba37032538b65aaf102 (patch)
tree7cbcaed20c7d8aa09a859abe39f702aeb1aa47ab
parent2a657bc6b1a9d0f28b74e2c538fa0149dd4bd4bb (diff)
downloadchrome-ec-42b8994d8cdfc87d2a30aba37032538b65aaf102.tar.gz
flash_cr50: fix watchdog
The watchdog ccd name changed from ccd to ccd_cr50. Modify flash_cr50 to support both. BUG=none TEST=update hdctools and use flash_cr50 Change-Id: Ieafeac1275c582ec86a94a05cc7a31c216e3420b Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4024801 Reviewed-by: Ziting Shen <zitingshen@google.com> Commit-Queue: Ziting Shen <zitingshen@google.com>
-rwxr-xr-xutil/flash_cr50.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/util/flash_cr50.py b/util/flash_cr50.py
index 2e1a555e89..9d604adeab 100755
--- a/util/flash_cr50.py
+++ b/util/flash_cr50.py
@@ -219,6 +219,8 @@ class Cr50Reset(object):
# A list of requirements for the setup. The requirement strings must match
# something in the REQUIRED_CONTROLS dictionary.
REQUIRED_SETUP = ()
+ CCD = 'ccd'
+ CCD_WATCHDOG_RE = r'(ccd.*):'
def __init__(self, servo, name):
"""Make sure the setup supports the given reset_type.
@@ -228,10 +230,12 @@ class Cr50Reset(object):
name: The reset type.
"""
self._servo = servo
+ self._servo_type = self._servo.dut_control('servo_type')[1]
+ match = re.search(self.CCD_WATCHDOG_RE, self._servo.dut_control('watchdog')[1])
+ self._ccd_device = match.group(1) if match else ''
self._reset_name = name
self.verify_setup()
self._original_watchdog_state = self.ccd_watchdog_enabled()
- self._servo_type = self._servo.dut_control('servo_type')[1]
def verify_setup(self):
"""Verify the setup has all required controls to flash cr50.
@@ -304,11 +308,12 @@ class Cr50Reset(object):
def ccd_watchdog_enabled(self):
"""Return True if servod is monitoring ccd"""
- if 'ccd_cr50' not in self._servo_type:
+ if not self._ccd_device:
return False
watchdog_state = self._servo.dut_control('watchdog')[1]
logging.debug(watchdog_state)
- return not re.search('ccd:.*disconnect ok', watchdog_state)
+ return not re.search(self._ccd_device + ':.*disconnect ok',
+ watchdog_state)
def enable_ccd_watchdog(self, enable):
"""Control the CCD watchdog.
@@ -321,14 +326,14 @@ class Cr50Reset(object):
Args:
enable: If True, enable the CCD watchdog. Otherwise disable it.
"""
- if 'ccd_cr50' not in self._servo_type:
+ if not self._ccd_device:
logging.debug('Servo is not watching ccd device.')
return
if enable:
- self._servo.dut_control('watchdog_add:ccd')
+ self._servo.dut_control('watchdog_add:' + self._ccd_device)
else:
- self._servo.dut_control('watchdog_remove:ccd')
+ self._servo.dut_control('watchdog_remove:' + self._ccd_device)
if self.ccd_watchdog_enabled() != enable:
raise Error('Could not %sable ccd watchdog' %