flash_ec: Add dut_control_get_or_die function.
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
@@ -246,7 +246,7 @@ function dut_control() {
}
function dut_control_or_die {
- dut_control "$@" || die "dut-control $* exited $? (non-zero)"
+ dut_control "$@" || die "command exited $? (non-zero): dut-control $*"
}
function dut_control_get() {
@@ -256,7 +256,7 @@ function dut_control_get() {
fi
local ARGS DUT_GETVAL RETVAL
- ARGS=( "${DUT_CONTROL_CMD[@]}" "-o" "${DUT_CTRL_PREFIX}$1" )
+ ARGS=( "${DUT_CONTROL_CMD[@]}" "--value_only" "${DUT_CTRL_PREFIX}$1" )
RETVAL=0
# || statement is attached to avoid an exit if error exit is enabled.
DUT_GETVAL=$( "${ARGS[@]}" ) || RETVAL="$?"
@@ -268,6 +268,11 @@ function dut_control_get() {
echo "${DUT_GETVAL}"
}
+function dut_control_get_or_die {
+ dut_control_get "$@" || \
+ die "command exited $? (non-zero): dut-control --value_only $*"
+}
+
BOARD=${FLAGS_board}
in_array() {
