summaryrefslogtreecommitdiffstatshomepage
path: root/tools/pyboard.py
diff options
context:
space:
mode:
authorAlessandro Gatti <a.gatti@frob.it>2024-09-06 15:50:35 +0200
committerDamien George <damien@micropython.org>2025-01-16 12:10:28 +1100
commit0950f65ac48bb8315a9ae51be0d4099432cad548 (patch)
treec85cbaf3fc668d5940df874f1ffcb5aaec2425b4 /tools/pyboard.py
parentd533c9067a3a2709d56304944e5142ff71830c8d (diff)
downloadmicropython-0950f65ac48bb8315a9ae51be0d4099432cad548.tar.gz
micropython-0950f65ac48bb8315a9ae51be0d4099432cad548.zip
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>
Diffstat (limited to 'tools/pyboard.py')
-rwxr-xr-xtools/pyboard.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/pyboard.py b/tools/pyboard.py
index 8459bcf655..dac51e7d6b 100755
--- a/tools/pyboard.py
+++ b/tools/pyboard.py
@@ -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)