diff options
author | Aseda Aboagye <aaboagye@google.com> | 2017-08-01 17:00:05 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-08-02 12:47:50 -0700 |
commit | 7ed19ed220b795f9bc28832e7bddb891c383b4b2 (patch) | |
tree | 751a2eb34ad08c59a5fadc4cb9b529c3e2b8ee77 /util/flash_ec | |
parent | d633871ef6b95078da5a735c81f8d34f90d647a0 (diff) | |
download | chrome-ec-7ed19ed220b795f9bc28832e7bddb891c383b4b2.tar.gz |
flash_ec: Update method of retrieving serial num.
There have been some new methods added to servod to retrieve the serial
numbers of the servos attached. Prior to this, with a servo micro
connected to a servo v4, retrieving the serial number would always
return that of the servo v4. This would cause flashing to fail. This
change updates the method to retrieve the serial numbers.
CQ-DEPEND=CL:597209
BUG=chromium:740026
BRANCH=maybe some fw branches.
TEST=With updated hdctools, flash a kevin using a servo micro connected
to a servo v4.
TEST=Flash kevin with a servo v2.
TEST=Attempt to flash a hammer and verify that the only issue is
stm32mon not being able to determine the startup of the monitor mode
(since I don't actually have a hammer).
Change-Id: I82c2907d689311fe65717a833390b8d0f6e15a94
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/597211
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'util/flash_ec')
-rwxr-xr-x | util/flash_ec | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/util/flash_ec b/util/flash_ec index 1663214189..e471ee10fd 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -495,6 +495,24 @@ function claim_pty() { done } +function get_serial() { + if [[ "${SERVO_TYPE}" =~ "servo_v4_with_servo_micro" ]]; then + if [[ -z "${BOARD}" ]]; then + sn_ctl="servo_micro_" + else + sn_ctl="servo_micro_for_${BOARD}_" + fi + elif [[ "${SERVO_TYPE}" =~ "_with_ccd" ]] ; then + sn_ctl="ccd_" + else + # If it's none of the above, the main serialname will do. + sn_ctl="" + fi + + SERIALNAME=$(${DUT_CONTROL_CMD} "${sn_ctl}serialname" | cut -d: -f2) + echo $SERIALNAME +} + # Board specific flashing scripts # helper function for using servo v2/3 with openocd @@ -542,15 +560,14 @@ function flash_flashrom() { die "no flashrom util found." fi - if ! on_raiden || [[ "${SERVO_TYPE}" =~ "servo_micro" ]] ; then - if ! on_servov3; then - SERIALNAME=$(${DUT_CONTROL_CMD} serialname | \ - cut -d: -f2) - if [[ "$SERIALNAME" != "" ]] ; then - FLASHROM_PARAM+="serial=${SERIALNAME}" - fi + if ! on_servov3; then + SERIALNAME=$(get_serial) + if [[ "$SERIALNAME" != "" ]] ; then + FLASHROM_PARAM+="serial=${SERIALNAME}" fi + fi + if ! on_raiden || [[ "${SERVO_TYPE}" =~ "servo_micro" ]] ; then if $(in_array "${BOARDS_SPI_1800MV[@]}" "${BOARD}"); then SPI_VOLTAGE="pp1800" else |