mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Merge pull request #198 from valeros/develop
Fix TouchSerialPort function on Linux system.
This commit is contained in:
@ -2,6 +2,7 @@
|
|||||||
# See LICENSE for details.
|
# See LICENSE for details.
|
||||||
|
|
||||||
from os.path import join
|
from os.path import join
|
||||||
|
from platform import system
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
@ -23,6 +24,12 @@ def FlushSerialBuffer(env, port):
|
|||||||
|
|
||||||
|
|
||||||
def TouchSerialPort(env, port, baudrate):
|
def TouchSerialPort(env, port, baudrate):
|
||||||
|
if system() == "Linux":
|
||||||
|
try:
|
||||||
|
s = Serial(env.subst(port))
|
||||||
|
s.close()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
s = Serial(port=env.subst(port), baudrate=baudrate)
|
s = Serial(port=env.subst(port), baudrate=baudrate)
|
||||||
s.setDTR(False)
|
s.setDTR(False)
|
||||||
s.close()
|
s.close()
|
||||||
|
Reference in New Issue
Block a user