1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:12:57 +01:00

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.
This commit is contained in:
Benjamin Valentin 2023-09-13 12:04:52 +02:00
parent f1df27b381
commit dad593a5f5

View File

@ -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: