Skip to content

Commit

Permalink
tools/mpremote: Support any prompt string when detecting soft reset.
Browse files Browse the repository at this point in the history
The prompt may be changed by sys.ps1.

Signed-off-by: Damien George <damien@micropython.org>
  • Loading branch information
dpgeorge committed Mar 28, 2022
1 parent b312a7a commit 35dbde1
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions tools/mpremote/mpremote/pyboardextended.py
Expand Up @@ -653,12 +653,12 @@ def write_ctrl_d(self, out_callback):
# Check if a soft reset occurred.
if data_all.find(b"MPY: soft reboot") == -1:
return
if data_all.endswith(b">>> "):
in_friendly_repl = True
elif data_all.endswith(b">"):
if data_all.endswith(b">"):
in_friendly_repl = False
prompt = b">"
else:
return
in_friendly_repl = True
prompt = data_all.rsplit(b"\r\n", 1)[-1]

# Clear state while board remounts, it will be re-set once mounted.
self.mounted = False
Expand All @@ -676,9 +676,6 @@ def write_ctrl_d(self, out_callback):
# Exit raw REPL if needed, and wait for the friendly REPL prompt.
if in_friendly_repl:
self.exit_raw_repl()
prompt = b">>> "
else:
prompt = b">"
self.read_until(len(prompt), prompt)
out_callback(prompt)
self.serial = SerialIntercept(self.serial, self.cmd)
Expand Down

0 comments on commit 35dbde1

Please sign in to comment.