diff options
author | Yilin Yang <kerker@google.com> | 2020-09-23 17:55:53 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-09-26 02:04:22 +0000 |
commit | e4486b47c0e617e867439665dd1a774f50f68f4c (patch) | |
tree | 45105ac70dd06e69779386d5a07f7de435590de6 /extra | |
parent | dac57f3eb1cad9e181ea7efa130299a473db50a6 (diff) | |
download | chrome-ec-e4486b47c0e617e867439665dd1a774f50f68f4c.tar.gz |
usb_updater: Migrate fw_update.py to python2/3 compatible
BUG=chromium:1031705
BRANCH=master
TEST=None
Signed-off-by: kerker <kerker@chromium.org>
Change-Id: I00a1c0868980e9b8a03ad13ea000fbe94ef3192f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2425791
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'extra')
-rwxr-xr-x | extra/usb_updater/fw_update.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/extra/usb_updater/fw_update.py b/extra/usb_updater/fw_update.py index 3755ba9d20..739fa2fe80 100755 --- a/extra/usb_updater/fw_update.py +++ b/extra/usb_updater/fw_update.py @@ -1,9 +1,10 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python # Copyright 2016 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Upload firmware over USB +# Note: This is a py2/3 compatible file. from __future__ import print_function @@ -48,7 +49,7 @@ class Supdate(object): pass - def connect_usb(self, serialname=None ): + def connect_usb(self, serialname=None): """Initial discovery and connection to USB endpoint. This searches for a USB device matching the VID:PID specified @@ -367,7 +368,7 @@ class Supdate(object): Exception on file not found or filesize not matching. """ self._filesize = os.path.getsize(binfile) - self._binfile = open(binfile) + self._binfile = open(binfile, 'rb') if self._filesize != self._flashsize: raise Exception("Update", "Flash size 0x%x != file size 0x%x" % (self._flashsize, self._filesize)) |