From f948d674351a2ca87d33c0e0d8558cbbb2f59682 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Mon, 25 May 2020 19:33:47 -0400 Subject: Untested conversion to support Python 3 --- bin/dfu | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'bin') 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 -- cgit v1.2.3