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.
This commit is contained in:
Dave Hylands 2018-12-28 12:17:40 -08:00 committed by Damien George
parent 4d8504425a
commit c932639063
1 changed files with 1 additions and 1 deletions

View File

@ -85,7 +85,7 @@ def find_dfu_cfg_descr(descr):
nt = collections.namedtuple('CfgDescr', nt = collections.namedtuple('CfgDescr',
['bLength', 'bDescriptorType', 'bmAttributes', ['bLength', 'bDescriptorType', 'bmAttributes',
'wDetachTimeOut', 'wTransferSize', 'bcdDFUVersion']) 'wDetachTimeOut', 'wTransferSize', 'bcdDFUVersion'])
return nt(*struct.unpack('<BBBHHH', bytes(descr))) return nt(*struct.unpack('<BBBHHH', bytearray(descr)))
return None return None