aboutsummaryrefslogtreecommitdiff
path: root/bin/dfu
diff options
context:
space:
mode:
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