Skip to content
Snippets Groups Projects
Commit f1236734 authored by Damien George's avatar Damien George
Browse files

tools/pyboard.py: Make enter_raw_repl stricter and more reliable.

When looking for chars to indicate raw repl is active, look for the full
string of chars to improve reliability of entering raw repl correctly.

Previous to this patch there was the possibility that raw repl was
entered in a dirty state, where not all input chars from previous
invocation were drained.
parent 9de53bf7
No related branches found
No related tags found
No related merge requests found
...@@ -79,14 +79,14 @@ class Pyboard: ...@@ -79,14 +79,14 @@ class Pyboard:
n = self.serial.inWaiting() n = self.serial.inWaiting()
self.serial.write(b'\r\x01') # ctrl-A: enter raw REPL self.serial.write(b'\r\x01') # ctrl-A: enter raw REPL
data = self.read_until(1, b'to exit\r\n>') data = self.read_until(1, b'raw REPL; CTRL-B to exit\r\n>')
if not data.endswith(b'raw REPL; CTRL-B to exit\r\n>'): if not data.endswith(b'raw REPL; CTRL-B to exit\r\n>'):
print(data) print(data)
raise PyboardError('could not enter raw repl') raise PyboardError('could not enter raw repl')
self.serial.write(b'\x04') # ctrl-D: soft reset self.serial.write(b'\x04') # ctrl-D: soft reset
data = self.read_until(1, b'to exit\r\n') data = self.read_until(1, b'soft reboot\r\nraw REPL; CTRL-B to exit\r\n')
if not data.endswith(b'raw REPL; CTRL-B to exit\r\n'): if not data.endswith(b'soft reboot\r\nraw REPL; CTRL-B to exit\r\n'):
print(data) print(data)
raise PyboardError('could not enter raw repl') raise PyboardError('could not enter raw repl')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment