import serial import struct import sys import time offset = 0x800 tty = 'tty' baud = 115200 chunksize = 128 def write(s, offset, dat): for i in range(0, len(dat), chunksize): chunk = dat[i: i + chunksize] cmd = struct.pack(' 1.0: print('Data timeout') break continue last_dat = time.time() sys.stdout.buffer.write(dat) if __name__ == "__main__": main()