aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2020-09-01 10:57:21 -0400
committerRob Austein <sra@hactrn.net>2020-09-01 10:57:21 -0400
commit4050df583c3221e55e7ada23c211cfc38fae7d89 (patch)
treef04203d9c483b26d89ce0f99419090965b22ae9e /bin
parentb7e1cf46f7c88740732dea1d9885193567af2e78 (diff)
One more set of silly Python3 bytes handling errors
Diffstat (limited to 'bin')
-rwxr-xr-xbin/dfu6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/dfu b/bin/dfu
index b3f0be1..fd783e0 100755
--- a/bin/dfu
+++ b/bin/dfu
@@ -77,7 +77,7 @@ def parse_args():
def _write(dst, data):
for i in range(len(data)):
- dst.write(data[i])
+ dst.write(data[i:i+1])
time.sleep(0.1)
if len(data) == 4:
print("Wrote 0x{}".format(hexlify(data).decode("ascii")))
@@ -111,7 +111,7 @@ def send_file(filename, args):
except serial.SerialException:
time.sleep(0.2)
continue
- dst.write('\r')
+ dst.write(b'\r')
response = _read(dst, args.verbose)
if 'OK' in response:
dst.timeout=2
@@ -137,7 +137,7 @@ def send_file(filename, args):
if len(ack_bytes) == 4:
break
print('ERROR: Did not receive an ACK, got {!r}'.format(ack_bytes))
- dst.write('\r') # eventually get back to the CLI prompt
+ dst.write(b'\r') # eventually get back to the CLI prompt
ack = struct.unpack('<I', ack_bytes)[0]
if ack != counter + 1:
print('ERROR: Did not receive the expected counter as ACK (got {!r}/{!r}, not {!r})'.format(ack, ack_bytes, counter))