From f38a3509a571d014e2e38108c1bc4b07f2fbb969 Mon Sep 17 00:00:00 2001 From: Dave Hylands Date: Tue, 18 Jun 2019 20:55:46 -0700 Subject: [PATCH] Call os.sync to make UART transfer more reliable --- rshell/main.py | 3 +++ rshell/version.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/rshell/main.py b/rshell/main.py index 47fed75..5bb5b7a 100755 --- a/rshell/main.py +++ b/rshell/main.py @@ -969,6 +969,7 @@ def recv_file_from_host(src_file, dst_filename, filesize, dst_mode='wb'): """Function which runs on the pyboard. Matches up with send_file_to_remote.""" import sys import ubinascii + import os if HAS_BUFFER: try: import pyb @@ -1011,6 +1012,8 @@ def recv_file_from_host(src_file, dst_filename, filesize, dst_mode='wb'): dst_file.write(write_buf[0:read_size]) else: dst_file.write(ubinascii.unhexlify(write_buf[0:read_size])) + if hasattr(os, 'sync'): + os.sync() bytes_remaining -= read_size return True except: diff --git a/rshell/version.py b/rshell/version.py index 858d0a1..af2cb9a 100644 --- a/rshell/version.py +++ b/rshell/version.py @@ -1 +1 @@ -__version__ = '0.0.25' +__version__ = '0.0.26'