From e5707317e85f7e8d79c8d9bcddc582ec00f97b69 Mon Sep 17 00:00:00 2001 From: Sam McNally Date: Wed, 5 Jan 2022 16:12:56 +1100 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3367518 Reviewed-by: Edward O'Callaghan --- futility/updater_utils.c | 6 ++++-- 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. -- cgit v1.2.1