diff options
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 |