mirror of
https://github.com/espressif/esptool.git
synced 2025-10-15 21:07:25 +08:00
feat: add advisory port locking
Closes https://github.com/espressif/esptool/issues/946
This commit is contained in:

committed by
Radim Karniš

parent
f72b5ad13c
commit
8ad6d57ea9
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user