aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Hylands2018-12-28 12:17:40 -0800
committerDamien George2018-12-30 01:20:48 +1100
commitc93263906307f208f47cb5885ed091e9e1d617c4 (patch)
tree3550ec3900b85bbe51c18c999c4d4d5e3be05fcf
parent4d8504425a1b43a9b90a9a3b7a596e919b8cdb67 (diff)
tools/pydfu.py: Fix regression so tool runs under Python 2 again.
Under python3 (tested with 3.6.7) bytes with a list of integers as an argument returns a different result than under python 2.7 (tested with 2.7.15rc1) which causes pydfu.py to fail when run under 2.7. Changing bytes to bytearray makes pydfu work properly under both Python 2.7 and Python 3.6.
-rwxr-xr-xtools/pydfu.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/pydfu.py b/tools/pydfu.py
index 394ecca5e..658ce59ae 100755
--- a/tools/pydfu.py
+++ b/tools/pydfu.py
@@ -85,7 +85,7 @@ def find_dfu_cfg_descr(descr):
nt = collections.namedtuple('CfgDescr',
['bLength', 'bDescriptorType', 'bmAttributes',
'wDetachTimeOut', 'wTransferSize', 'bcdDFUVersion'])
- return nt(*struct.unpack('<BBBHHH', bytes(descr)))
+ return nt(*struct.unpack('<BBBHHH', bytearray(descr)))
return None