diff options
author | Matthew Blecker <matthewb@chromium.org> | 2020-09-30 11:42:20 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-10-07 20:20:24 +0000 |
commit | b993c2473905c33281ffe68c168243ef89c1ac3b (patch) | |
tree | be1e7c4c1a41fbb6816d72542f384cbbf23d188a | |
parent | 4f8947aa5be0fba7f3b9bee7a6e9dc5697f7470c (diff) | |
download | chrome-ec-b993c2473905c33281ffe68c168243ef89c1ac3b.tar.gz |
flash_ec: Always define ACTIVE_DEVICE.
This will be used in CL:2441395.
BRANCH=none
BUG=b:130165933
TEST=With servo_v4 Type-A + servo_micro + ampton DUT:
$ util/flash_ec --board=ampton --verbose --read="$HOME"/ampton-ec-read0.bin
Signed-off-by: Matthew Blecker <matthewb@chromium.org>
Change-Id: I548692099ee5f94acc7cb05065b400829e6147c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2453714
Reviewed-by: Namyoon Woo <namyoon@chromium.org>
-rwxr-xr-x | util/flash_ec | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/util/flash_ec b/util/flash_ec index 20241001de..feac11e165 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -399,18 +399,24 @@ case "${CHIP}" in esac SERVO_TYPE="$(dut_control_get servo_type || :)" -if [[ ${SERVO_TYPE} =~ servo_v4_with_.*_and_.* ]] ; then + +if [[ "${SERVO_TYPE}" =~ ^servo_v4_with_.*$ ]]; then + ACTIVE_DEVICE="$(dut_control_get active_v4_device)" +else + ACTIVE_DEVICE="${SERVO_TYPE}" +fi + +if [[ "${SERVO_TYPE}" =~ ^servo_v4_with_.*_and_.*$ ]]; then # If there are two devices, servo v4 type will show both devices. The # default device is first. The other device is second. # servo_type:servo_v4_with_servo_micro_and_ccd_cr50 SECOND_DEVICE="${SERVO_TYPE#*_and_}" - ACTIVE_DEVICE="$(dut_control_get active_v4_device || :)" SERVO_TYPE="servo_v4_with_${ACTIVE_DEVICE}" # Controls sent through the default device don't have a prefix. The # second device controls do. If the default device isn't active, we # need to use the second device controls to send commands. Use the # prefix for all dut control commands. - if [[ "${SECOND_DEVICE}" = "${ACTIVE_DEVICE}" ]] ; then + if [[ "${SECOND_DEVICE}" = "${ACTIVE_DEVICE}" ]]; then DUT_CTRL_PREFIX="${ACTIVE_DEVICE}." fi fi |