diff options
author | Ruben Rodriguez Buchillon <coconutruben@chromium.org> | 2021-02-03 17:19:44 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-02-12 19:35:59 +0000 |
commit | 282ce47b9dfe6b8f18e70ac871e531e25300d313 (patch) | |
tree | ea5ca5a6ae4c871d7ff62b48e53762efe2c2ee28 /extra | |
parent | eddea1320c3733c17b56bbd57313fe9bcc1ee451 (diff) | |
download | chrome-ec-282ce47b9dfe6b8f18e70ac871e531e25300d313.tar.gz |
servo_updater: print available version
This change introduces -p/--print to servo_updater. Rather than
performing an update, it will print for the chosen board/channel what
firmware is available. See TEST below for output.
BRANCH=None
BUG=b:179310743
TEST=servo_updater -b servo_micro -c alpha -p
board: servo_micro
channel: alpha
firmware: servo_micro_v2.4.35-f1113c92b
// showing py2 compatibility
TEST=python2 /usr/lib64/python2.7/site-packages/servo_updater.py -b \
servo_micro --print -c alpha
board: servo_micro
channel: alpha
firmware: servo_micro_v2.4.0-dc38d9bbb
Change-Id: I9899e1cacc0496a46a41e94cc9355438a5abe491
Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2674381
Reviewed-by: Brian Nemec <bnemec@chromium.org>
Diffstat (limited to 'extra')
-rwxr-xr-x | extra/usb_updater/servo_updater.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/extra/usb_updater/servo_updater.py b/extra/usb_updater/servo_updater.py index 575f4dbbdb..20ef51803c 100755 --- a/extra/usb_updater/servo_updater.py +++ b/extra/usb_updater/servo_updater.py @@ -340,7 +340,10 @@ def get_files_and_version(cname, fname=None, channel=DEFAULT_CHANNEL): return cname, fname, binvers def main(): - parser = argparse.ArgumentParser(description="Image a servo micro device") + parser = argparse.ArgumentParser(description="Image a servo device") + parser.add_argument('-p', '--print', dest='print_only', action='store_true', + default=False, + help='only print available firmware for board/channel') parser.add_argument('-s', '--serialno', type=str, help="serial number to program", default=None) parser.add_argument('-b', '--board', type=str, @@ -363,6 +366,15 @@ def main(): brdfile, binfile, newvers = get_files_and_version(args.board, args.file, args.channel) + # If the user only cares about the information then just print it here, + # and exit. + if args.print_only: + output = ('board: %s\n' + 'channel: %s\n' + 'firmware: %s') % (args.board, args.channel, newvers) + print(output) + return + serialno = args.serialno with open(brdfile) as data_file: |