Skip to content

Commit 519cef8

Browse files
dhylandsdpgeorge
authored andcommitted
tools: Allow pyboard.py to work when boot.py prints things.
1 parent cbc489d commit 519cef8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tools/pyboard.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,14 @@ def enter_raw_repl(self):
165165
raise PyboardError('could not enter raw repl')
166166

167167
self.serial.write(b'\x04') # ctrl-D: soft reset
168-
data = self.read_until(1, b'soft reboot\r\nraw REPL; CTRL-B to exit\r\n')
169-
if not data.endswith(b'soft reboot\r\nraw REPL; CTRL-B to exit\r\n'):
168+
data = self.read_until(1, b'soft reboot\r\n')
169+
if not data.endswith(b'soft reboot\r\n'):
170+
print(data)
171+
raise PyboardError('could not enter raw repl')
172+
# By splitting this into 2 reads, it allows boot.py to print stuff,
173+
# which will show up after the soft reboot and before the raw REPL.
174+
data = self.read_until(1, b'raw REPL; CTRL-B to exit\r\n')
175+
if not data.endswith(b'raw REPL; CTRL-B to exit\r\n'):
170176
print(data)
171177
raise PyboardError('could not enter raw repl')
172178

0 commit comments

Comments
 (0)