feat: add advisory port locking

Closes https://github.com/espressif/esptool/issues/946
This commit is contained in:
Peter Dragun
2024-01-16 10:35:37 +01:00
committed by Radim Karniš
parent f72b5ad13c
commit 8ad6d57ea9
3 changed files with 3 additions and 3 deletions

View File

@@ -256,7 +256,7 @@ def main():
logging.getLogger("rfc2217").setLevel(level)
# connect to serial port
ser = serial.serial_for_url(args.SERIALPORT, do_not_open=True)
ser = serial.serial_for_url(args.SERIALPORT, do_not_open=True, exclusive=True)
ser.timeout = 3 # required so that the reader thread can exit
# reset control line as no _remote_ "terminal" has been connected yet
ser.dtr = False

View File

@@ -300,7 +300,7 @@ class ESPLoader(object):
if isinstance(port, str):
try:
self._port = serial.serial_for_url(port)
self._port = serial.serial_for_url(port, exclusive=True)
except serial.serialutil.SerialException as e:
port_issues = [
[ # does not exist error

View File

@@ -128,7 +128,7 @@ setup(
"bitstring>=3.1.6",
"cryptography>=2.1.4",
"ecdsa>=0.16.0",
"pyserial>=3.0",
"pyserial>=3.3",
"reedsolo>=1.5.3,<1.8",
"PyYAML>=5.1",
"intelhex",