From 18b11939bf24b2f75ea54eb93d7d29273262c476 Mon Sep 17 00:00:00 2001 From: Fredrik Thulin Date: Tue, 17 May 2016 09:50:38 +0200 Subject: Write in 4k-chunks, with acks for flow control. --- projects/cli-test/filetransfer | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'projects/cli-test/filetransfer') diff --git a/projects/cli-test/filetransfer b/projects/cli-test/filetransfer index 451a1d9..3e8e043 100755 --- a/projects/cli-test/filetransfer +++ b/projects/cli-test/filetransfer @@ -64,13 +64,19 @@ def send_file(filename, device='/dev/ttyUSB0', initiate=True): _read(dst) # 2. Write file contents while calculating CRC-32 crc = 0 + counter = 0 while True: - data = src.read(1024) + data = src.read(4096) if not data: break dst.write(data) print("Wrote {!s} bytes".format(len(data))) crc = crc32(data, crc) & 0xffffffff + new_counter = struct.unpack('