diff options
author | Rob Austein <sra@hactrn.net> | 2020-05-25 19:33:47 -0400 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2020-05-25 19:33:47 -0400 |
commit | f948d674351a2ca87d33c0e0d8558cbbb2f59682 (patch) | |
tree | bf3e5c562e24929da786d8834d3ffe455d974e67 /bin | |
parent | 52f72e1e5dc5d3b646b54363f811ee2fd7958c19 (diff) |
Untested conversion to support Python 3
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/dfu | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -43,7 +43,7 @@ import struct import serial import argparse -from binascii import crc32 +from binascii import crc32, hexlify CHUNK_SIZE = 4096 @@ -80,20 +80,20 @@ def _write(dst, data): dst.write(data[i]) time.sleep(0.1) if len(data) == 4: - print("Wrote 0x{:02x}{:02x}{:02x}{:02x}".format(ord(data[0]), ord(data[1]), ord(data[2]), ord(data[3]))) + print("Wrote 0x{}".format(hexlify(data))) else: print("Wrote {!r}".format(data)) def _read(dst, verbose=False): - res = '' + res = b'' while True: x = dst.read(1) if not x: break res += x if res and verbose: - print ("Read {!r}".format(res)) + print("Read {!r}".format(res)) return res |