Merge pull request #198 from valeros/develop

Fix TouchSerialPort function on Linux system.
This commit is contained in:
Ivan Kravets
2015-05-14 17:00:08 +02:00

View File

@ -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()