[autotest] Flash EC according to the chip name
The flash_ec doesn't keep all the board variants and doesn't know how
to program in some boards. Should call the flash_ec by passing the
chip name instead of the board name.
CQ-DEPEND=CL:287445,CL:287600
BUG=chromium:505003
TEST=Ran the following Python code to test:
> import common
> from autotest_lib.server.hosts import servo_host
> sh = servo_host.create_servo_host(DUT_IP_ADDRESS, {})
> sh._servo.program_ec(EC_IMAGE_PATH)
Change-Id: I82e9e2cc5c4ab6fd4d7eef0a977f665bc8b4f842
Reviewed-on: https://chromium-review.googlesource.com/287601
Trybot-Ready: Wai-Hong Tam <waihong@chromium.org>
Tested-by: Wai-Hong Tam <waihong@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
Commit-Queue: Wai-Hong Tam <waihong@chromium.org>
diff --git a/server/cros/servo/firmware_programmer.py b/server/cros/servo/firmware_programmer.py
index 29d9a83..6f79253 100644
--- a/server/cros/servo/firmware_programmer.py
+++ b/server/cros/servo/firmware_programmer.py
@@ -190,16 +190,14 @@
self._servo = servo
- def prepare_programmer(self, image, board=None):
+ def prepare_programmer(self, image):
"""Prepare programmer for programming.
@param image: string with the location of the image file
- @param board: Name of the board used in EC image. Some board's name used
- by servod might be different from EC. Default to None.
"""
# TODO: need to not have port be hardcoded
- self._program_cmd = ('flash_ec --board=%s --image=%s --port=%s' %
- (board or self._servo.get_board(), image, '9999'))
+ self._program_cmd = ('flash_ec --chip=%s --image=%s --port=%s' %
+ (self._servo.get('ec_chip'), image, '9999'))
class ProgrammerV2(object):
@@ -360,13 +358,11 @@
self._bios_programmer.program()
- def program_ec(self, image, board=None):
+ def program_ec(self, image):
"""Programs the DUT with provide ec image.
@param image: (required) location of ec image file.
- @param board: Name of the board used in EC image. Some board's name used
- by servod might be different from EC. Default to None.
"""
- self._ec_programmer.prepare_programmer(image, board)
+ self._ec_programmer.prepare_programmer(image)
self._ec_programmer.program()