From 889b52a87e471615ba908246317ef6a502b70160 Mon Sep 17 00:00:00 2001 From: Eric Yilun Lin Date: Wed, 9 Sep 2020 13:39:05 +0800 Subject: flash_ec: fallback to servo_micro SN if servo_micro_for_board not found This CL simply fallback the servo serial number to the generic one if servo_micro_for_${BOARD}_serialname not found. This might happen if the servod's invoke parameter (e.g. servod --board=asurada) differs to the EC board to flash (e.g. hayato, symlink to asurada), and flash_ec would query servod for servo_micro_for_hayato_serialname, however, servod only knows servo_micro_for_asurada_serialname, and it returns 'unknown'. BUG=b:168074868 TEST=sudo servod -b asurada; make BOARD=asurada flash_ec; make BOARD=hayato flash_ec BRANCH=none Change-Id: I6e190c483dd0c596a9ba294939bc5f85d363c016 Signed-off-by: Eric Yilun Lin Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2397941 Reviewed-by: Wai-Hong Tam --- util/flash_ec | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/util/flash_ec b/util/flash_ec index b8d701c5ff..bacd3fa7ae 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -796,10 +796,15 @@ function claim_pty() { done } +# Returns the serialnumber of the specified servo. function get_serial() { if [[ "${SERVO_TYPE}" =~ "servo_v4_with_servo_micro" ]]; then if [[ -z "${BOARD}" ]]; then sn_ctl="servo_micro_" + elif [[ "$(dut_control_get "servo_micro_for_${BOARD}_serialname")" =~ \ + "unknown" ]] ; then + # Fall back to servo_micro_ if S/N is uknown. + sn_ctl="servo_micro_" else sn_ctl="servo_micro_for_${BOARD}_" fi -- cgit v1.2.1