flash_ec: Always define ACTIVE_DEVICE.
This will be used in CL:2441395.
BRANCH=none
TEST=With servo_v4 Type-A + servo_micro + ampton DUT:
$ util/flash_ec --board=ampton --verbose --read="$HOME"/ampton-ec-read0.bin
@@ -399,12 +399,18 @@ 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
