From 5cee174602d8ea851cc434a2f07b71e21cbaa214 Mon Sep 17 00:00:00 2001 From: Nick Sanders Date: Mon, 13 Nov 2017 14:57:41 -0800 Subject: [PATCH] servo_updater: allow differing console enpoints servo_micro has the console on intf 3, while servo_v4 has it's console on intf 0. Abstract this into the config file rather than hardcoding. BUG=b:37513705 BRANCH=None TEST=update servo_micro Signed-off-by: Nick Sanders Change-Id: I0090a0d081e001e62ffa7235eebbd6131ea00dcf Reviewed-on: https://chromium-review.googlesource.com/769794 Reviewed-by: Nicolas Boichat --- extra/usb_updater/servo_micro.json | 1 + extra/usb_updater/servo_updater.py | 10 ++++++---- extra/usb_updater/servo_v4.json | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/extra/usb_updater/servo_micro.json b/extra/usb_updater/servo_micro.json index b0966817ac..02e59a4b3c 100644 --- a/extra/usb_updater/servo_micro.json +++ b/extra/usb_updater/servo_micro.json @@ -3,6 +3,7 @@ "board": "servo micro", "vid": "0x18d1", "pid": "0x501a", + "console": "3", "Comment on flash": "This is the base address of writeable flash", "flash": "0x8000000", "Comment on region format": "name: [baseoffset, length]", diff --git a/extra/usb_updater/servo_updater.py b/extra/usb_updater/servo_updater.py index 0f7d640c39..ad453a5c20 100755 --- a/extra/usb_updater/servo_updater.py +++ b/extra/usb_updater/servo_updater.py @@ -33,7 +33,7 @@ def flash(brdfile, serialno, binfile): p.stop() -def select(vidpid, serialno, region, debuglog=False): +def select(vidpid, iface, serialno, region, debuglog=False): if region not in ["rw", "ro"]: raise Exception("Region must be ro or rw") @@ -41,7 +41,8 @@ def select(vidpid, serialno, region, debuglog=False): c.wait_for_usb(vidpid, serialname=serialno) # make a console - pty = c.setup_tinyservod(vidpid, 0, serialname=serialno, debuglog=debuglog) + pty = c.setup_tinyservod(vidpid, iface, + serialname=serialno, debuglog=debuglog) cmd = "sysjump %s\nreboot" % region pty._issue_cmd(cmd) @@ -71,12 +72,13 @@ def main(): data = json.load(data_file) vidpid = "%04x:%04x" % (int(data['vid'], 0), int(data['pid'], 0)) + iface = int(data['console'], 0) - select(vidpid, serialno, "ro", debuglog=debuglog) + select(vidpid, iface, serialno, "ro", debuglog=debuglog) flash(brdfile, serialno, binfile) - select(vidpid, serialno, "rw", debuglog=debuglog) + select(vidpid, iface, serialno, "rw", debuglog=debuglog) flash(brdfile, serialno, binfile) diff --git a/extra/usb_updater/servo_v4.json b/extra/usb_updater/servo_v4.json index 0167fa1cb4..47925ef04e 100644 --- a/extra/usb_updater/servo_v4.json +++ b/extra/usb_updater/servo_v4.json @@ -3,6 +3,7 @@ "board": "servo v4", "vid": "0x18d1", "pid": "0x501b", + "console": "0", "Comment on flash": "This is the base address of writeable flash", "flash": "0x8000000", "Comment on region format": "name: [baseoffset, length]",