aboutsummaryrefslogtreecommitdiff
path: root/bin/dfu
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2020-05-25 19:33:47 -0400
committerRob Austein <sra@hactrn.net>2020-05-25 19:33:47 -0400
commitf948d674351a2ca87d33c0e0d8558cbbb2f59682 (patch)
treebf3e5c562e24929da786d8834d3ffe455d974e67 /bin/dfu
parent52f72e1e5dc5d3b646b54363f811ee2fd7958c19 (diff)
Untested conversion to support Python 3
Diffstat (limited to 'bin/dfu')
-rwxr-xr-xbin/dfu8
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/dfu b/bin/dfu
index e270438..d37d3ba 100755
--- a/bin/dfu
+++ b/bin/dfu
@@ -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