servo: power-cycle image usb port before image download
This is a temporary fix to see whether this can alleviate the v3 usb
image download failures, where the usb stick is failing to properly
enumerate (No mediu found).
BUG=chromium:1017308
TEST=None
Change-Id: Ibd57c1460d20870622edce199999f7731c494a78
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2070679
Commit-Queue: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
Tested-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
Reviewed-by: Garry Wang <xianuowang@chromium.org>
diff --git a/server/cros/servo/servo.py b/server/cros/servo/servo.py
index 07d7ee6..ee805cc 100644
--- a/server/cros/servo/servo.py
+++ b/server/cros/servo/servo.py
@@ -982,6 +982,12 @@
if image_path:
# Set up Servo's usb mux.
self.switch_usbkey('host')
+ # TODO(crbug.com/1017308: remove this power-cycling once
+ # the bug has been fixed on the hdctools side of things.
+ logging.info('Power cycling the usb stick port before download '
+ 'one more time')
+ self.set('image_usbkey_pwr', 'off')
+ self.set('image_usbkey_pwr', 'on')
logging.info('Searching for usb device and copying image to it. '
'Please wait a few minutes...')
if not self._server.download_image_to_usb(image_path):
@@ -996,9 +1002,10 @@
def boot_in_recovery_mode(self):
"""Boot host DUT in recovery mode."""
+ self.set('image_usbkey_pwr', 'off')
self._power_state.power_on(rec_mode=self._power_state.REC_ON)
self.switch_usbkey('dut')
-
+ self.set('image_usbkey_pwr', 'on')
def install_recovery_image(self, image_path=None,
make_image_noninteractive=False):