diff --git a/utils/serload.py b/utils/serload.py index e69837f..0ee6962 100644 --- a/utils/serload.py +++ b/utils/serload.py @@ -78,6 +78,9 @@ def commandwait(ser, cmd): print("timeout sending '{}' command".format(cmd)) return None + if resp.startswith(b"> "): + resp = resp[2:] + if resp != bytearray(cmd + b"\r\n"): print("invalid response to '{}' command".format(cmd)) return None @@ -323,7 +326,7 @@ def showdata(ser): promptseen = True else: print(c.decode('utf8'), end='') - rest = ser.read(1) + rest = ser.read(1) # read trailing space of prompt def localdir(): @@ -360,8 +363,10 @@ def interactive(ser): print("superfluous argument") else: localdir() + elif cmd == 'exit' or cmd == 'x': + done = True else: - print("Unknown command. Valid commands are: dir get ldir put") + print("Unknown command. Valid commands are: dir get ldir put exit") if __name__ == "__main__":