From 9d4846a292fbb724617c3b63f6be79a7b8a747be Mon Sep 17 00:00:00 2001 From: Mary Ruthven Date: Fri, 27 Apr 2018 10:37:36 -0700 Subject: cr50_rma_open: add support for checking prepvt and prod versions RMA support through the cr50 console is only a part images starting with 0.4.5. Check that the prepvt version is greater than or equal to 0.4.5. Versions 0.4.4 are greater than the prod version 0.3.3, but you can't use it to do RMA open through the console. It can only be done through the AP. BUG=none BRANCH=none TEST=none Change-Id: I7e08cc5dbc9f910686ea5917be755170c0587ee4 Signed-off-by: Mary Ruthven Reviewed-on: https://chromium-review.googlesource.com/1040356 Commit-Ready: Mary Ruthven Tested-by: Mary Ruthven Reviewed-by: Wai-Hong Tam --- extra/cr50_rma_open/cr50_rma_open.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'extra') diff --git a/extra/cr50_rma_open/cr50_rma_open.py b/extra/cr50_rma_open/cr50_rma_open.py index 2324677924..caddcb2f54 100644 --- a/extra/cr50_rma_open/cr50_rma_open.py +++ b/extra/cr50_rma_open/cr50_rma_open.py @@ -19,7 +19,8 @@ WP_IS_DISABLED = 1 << 1 RMA_OPENED = CCD_IS_UNRESTRICTED | WP_IS_DISABLED URL = 'https://www.google.com/chromeos/partner/console/cr50reset?' \ 'challenge=%s&hwid=%s' -RMA_SUPPORT = '0.3.3' +RMA_SUPPORT_PROD = '0.3.3' +RMA_SUPPORT_PREPVT = '0.4.5' CR50_USB = '18d1:5014' ERASED_BID = 'ffffffff' @@ -343,14 +344,20 @@ class RMAOpen(object): raise ValueError('Could not communicate with %s' % self.device) version = re.search('RW.*\* ([\d\.]+)/', output).group(1) - print 'RMA support added in:', RMA_SUPPORT print 'Running Cr50 Version:', version fields = [int(field) for field in version.split('.')] - rma_fields = [int(field) for field in RMA_SUPPORT.split('.')] + + # prePVT images have even major versions. Prod have odd + self.is_prepvt = fields[1] % 2 == 0 + rma_support = RMA_SUPPORT_PREPVT if self.is_prepvt else RMA_SUPPORT_PROD + + print 'prePVT' if self.is_prepvt else 'prod', + print 'RMA support added in:', rma_support + rma_fields = [int(field) for field in rma_support.split('.')] for i, field in enumerate(fields): if field < int(rma_fields[i]): raise ValueError('%s does not have RMA support. Update to at ' - 'least %s' % (version, RMA_SUPPORT)) + 'least %s' % (version, rma_support)) def device_matches_devid(self, devid, device): -- cgit v1.2.1