tools/pyboard.py: Wait a bit before accessing the PTY serial port.

Some PTY targets, namely `NETDUINO2` and `MICROBIT` under Qemu, take a bit
more time to present a REPL than usual.  The pyboard tool is a bit too
impatient and would bail out before any of those targets had a chance to
respond to the raw REPL request.

Co-authored-by: Damien George <damien@micropython.org>
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit is contained in:
Alessandro Gatti
2024-09-06 15:50:35 +02:00
committed by Damien George
parent d533c9067a
commit 0950f65ac4

View File

@@ -244,6 +244,8 @@ class ProcessPtyToTerminal:
self.close()
sys.exit(1)
pty = m.group()
# Compensate for some boards taking a bit longer to start
time.sleep(0.1)
# rtscts, dsrdtr params are to workaround pyserial bug:
# http://stackoverflow.com/questions/34831131/pyserial-does-not-play-well-with-virtual-port
self.serial = serial.Serial(pty, interCharTimeout=1, rtscts=True, dsrdtr=True)