Fix TouchSerialPort function on Linux system.

This commit is contained in:
Valeriy Koval
2015-05-14 17:57:21 +03:00
parent e960302b6d
commit 9c4960ab2f

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