diff options
Diffstat (limited to 'extra/usb_updater/servo_updater.py')
-rwxr-xr-x | extra/usb_updater/servo_updater.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/extra/usb_updater/servo_updater.py b/extra/usb_updater/servo_updater.py index 06c36f37b6..397aa28566 100755 --- a/extra/usb_updater/servo_updater.py +++ b/extra/usb_updater/servo_updater.py @@ -1,8 +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. +# Note: This is a py2/3 compatible file. + from __future__ import print_function import argparse @@ -14,6 +16,8 @@ import time import tempfile import json +import six + import fw_update import ecusb.tiny_servo_common as c @@ -236,8 +240,13 @@ def find_available_version(boardname, binfile): Returns: the version string. """ + args = {} + if six.PY3: + args['encoding'] = 'utf-8' + rawstrings = subprocess.check_output( - ['cbfstool', binfile, 'read', '-r', 'RO_FRID', '-f', '/dev/stdout']) + ['cbfstool', binfile, 'read', '-r', 'RO_FRID', '-f', '/dev/stdout'], + **args) m = re.match(r'%s_v\S+' % boardname, rawstrings) if m: newvers = m.group(0).strip(' \t\r\n\0') |