1 # Copyright 2017 The Chromium OS Authors. All rights reserved. 2 # Use of this source code is governed by a BSD-style license that can be 3 # found in the LICENSE file. 4 5 import logging 6 import time 7 8 from autotest_lib.client.bin import utils 9 from autotest_lib.client.common_lib import error 10 from autotest_lib.server import autotest, test 11 from autotest_lib.server.cros.faft.firmware_test import FirmwareTest 12 13 14 class firmware_Cr50Unlock(FirmwareTest): 15 """Verify cr50 unlock. 16 17 Enable the lock on cr50, run 'lock disable', and then press the power 18 button until it is unlocked. 19 """ 20 version = 1 21 22 ACCESS_DENIED = 'Access Denied' 23 24 25 def initialize(self, host, cmdline_args): 26 super(firmware_Cr50Unlock, self).initialize(host, cmdline_args) 27 if not hasattr(self, 'cr50'): 28 raise error.TestNAError('Test can only be run on devices with ' 29 'access to the Cr50 console') 30 if self.cr50.using_ccd(): 31 raise error.TestNAError('Use a flex cable instead of CCD cable.') 32 33 34 def run_once(self): 35 # Enable the lock 36 rv = self.cr50.send_command_get_output('lock dummy', ['[\w\s]+']) 37 # Certain prod images are permanently locked out. We can't do anything 38 # on these images. 39 if self.ACCESS_DENIED in rv[0]: 40 raise error.TestNAError('Cr50 image is permanently locked.') 41 self.cr50.lock_enable() 42 self.cr50.lock_disable() 43 44