From dad593a5f51e7fefcd9e5660d9313f58e20a83dd Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Wed, 13 Sep 2023 12:04:52 +0200 Subject: [PATCH] dist/tools/pyterm: set exclusive access on port A common source of error is that a user connects to a serial port that has already been opened in another terminal. This may lead to garbled output or no output at all. To avoid this, claim exclusive access on the serial port so we get a proper error instead of corrupted output. --- dist/tools/pyterm/pyterm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/tools/pyterm/pyterm b/dist/tools/pyterm/pyterm index 63f961017a1e..79f0d835005f 100755 --- a/dist/tools/pyterm/pyterm +++ b/dist/tools/pyterm/pyterm @@ -654,7 +654,7 @@ class SerCmd(cmd.Cmd): self.process_line(line) def serial_connect(self): - self.ser = serial.Serial(port=self.port, dsrdtr=0, rtscts=0) + self.ser = serial.Serial(port=self.port, dsrdtr=0, rtscts=0, exclusive=1) self.ser.baudrate = self.baudrate if self.toggle: