autotest: use servo_v4p1 uart console when use servo_v4p1
Cherry pick from labpack (https://crrev.com/c/3244852)
BUG=b:204134915
TEST=run local repair
Change-Id: I3a6b1e380a81ad8f7682a8c2d5180d639956b16c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/3244079
Reviewed-by: Xianuo Wang <xianuowang@chromium.org>
Commit-Queue: Otabek Kasimov <otabek@google.com>
Tested-by: Otabek Kasimov <otabek@google.com>
diff --git a/server/hosts/servo_repair.py b/server/hosts/servo_repair.py
index 180f184..4ba2eb0 100644
--- a/server/hosts/servo_repair.py
+++ b/server/hosts/servo_repair.py
@@ -1160,7 +1160,10 @@
@timeout_util.TimeoutDecorator(cros_constants.REPAIR_TIMEOUT_SEC)
def repair(self, host):
logging.info('Turn off configuration channel and wait 10 seconds.')
- host.get_servo().set_nocheck('servo_v4_uart_cmd', 'cc off')
+ servo_uart_cmd = 'servo_v4_uart_cmd'
+ if not host.get_servo().has_control(servo_uart_cmd):
+ servo_uart_cmd = 'servo_v4p1_uart_cmd'
+ host.get_servo().set_nocheck(servo_uart_cmd, 'cc off')
# wait till command will be effected
time.sleep(self.CC_OFF_TIMEOUT)
@@ -1214,7 +1217,10 @@
disc_cmd = ('fakedisconnect %d %d' %
(self.DISC_DELAY_MS, self.DISC_TIMEOUT_MS))
# cannot use 'set' as control is not returned executed commands
- host.get_servo().set_nocheck('servo_v4_uart_cmd', disc_cmd)
+ servo_uart_cmd = 'servo_v4_uart_cmd'
+ if not host.get_servo().has_control(servo_uart_cmd):
+ servo_uart_cmd = 'servo_v4p1_uart_cmd'
+ host.get_servo().set_nocheck(servo_uart_cmd, disc_cmd)
logging.debug('Waiting %ss for affect of action', self.EXEC_TIMEOUT)
time.sleep(self.EXEC_TIMEOUT)
host.restart_servod()