diff options
author | Sam McNally <sammc@chromium.org> | 2022-01-05 16:12:56 +1100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-01-07 04:47:47 +0000 |
commit | e5707317e85f7e8d79c8d9bcddc582ec00f97b69 (patch) | |
tree | d033981907651205a8e64ac448a19aa77a38a62e | |
parent | bf7497d5a55442f0067397c789d6e02b861822cc (diff) | |
download | vboot-e5707317e85f7e8d79c8d9bcddc582ec00f97b69.tar.gz |
vboot_reference/futility: Pass through SERVOD_NAME.
SERVOD_PORT and SERVOD_NAME environment variables are both used by
dut-control to identify the servod instance to use. If SERVOD_NAME is
set, query the servo serial number just like when SERVOD_PORT is set.
BUG=None
TEST=futility --servo -i with SERVOD_NAME set
BRANCH=None
Change-Id: I0c656e25d4f5da67570e3ff7d6cf28fdca5ec1cf
Signed-off-by: Sam McNally <sammc@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3367518
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
-rw-r--r-- | futility/updater_utils.c | 6 | ||||
-rw-r--r-- | futility/updater_utils.h | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/futility/updater_utils.c b/futility/updater_utils.c index 238a7bc4..50a33267 100644 --- a/futility/updater_utils.c +++ b/futility/updater_utils.c @@ -459,6 +459,7 @@ static int host_get_platform_version(void) char *host_detect_servo(int *need_prepare_ptr) { const char *servo_port = getenv(ENV_SERVOD_PORT); + const char *servo_name = getenv(ENV_SERVOD_NAME); char *servo_type = host_shell("dut-control -o servo_type 2>/dev/null"); const char *programmer = NULL; char *ret = NULL; @@ -466,10 +467,11 @@ char *host_detect_servo(int *need_prepare_ptr) char *servo_serial = NULL; /* Get serial name if servo port is provided. */ - if (servo_port && *servo_port) { + if ((servo_port && *servo_port) || (servo_name && *servo_name)) { const char *cmd = "dut-control -o serialname 2>/dev/null"; - VB2_DEBUG("Select servod using port: %s\n", servo_port); + VB2_DEBUG("Select servod using port: %s or name: %s\n", + servo_port, servo_name); if (strstr(servo_type, "with_servo_micro")) cmd = ("dut-control -o servo_micro_serialname" " 2>/dev/null"); diff --git a/futility/updater_utils.h b/futility/updater_utils.h index ca6771e5..2ab6f071 100644 --- a/futility/updater_utils.h +++ b/futility/updater_utils.h @@ -180,6 +180,9 @@ enum wp_state flashrom_get_wp(const char *programmer); /* The environment variable name for setting servod port. */ #define ENV_SERVOD_PORT "SERVOD_PORT" +/* The environment variable name for setting servod name. */ +#define ENV_SERVOD_NAME "SERVOD_NAME" + /* * Helper function to detect type of Servo board attached to host. * Returns a string as programmer parameter on success, otherwise NULL. |