Windows specific serial port open bug fixed.

This commit is contained in:
klaute 2016-09-25 10:57:24 +02:00
parent a2e59d7a61
commit 76cc8a2828

View file

@ -285,9 +285,10 @@ def openSerialDevice(d):
global ser global ser
try: try:
ser = serial.Serial(d) #serial.Serial.close()
ser = serial.Serial("\\\\.\\"+d)
except: except:
print "ERROR: Can't open the serial device " + device print "ERROR (1): Can't open the serial device " + d
exit(1) exit(1)
# Toggle DTR to reset Arduino # Toggle DTR to reset Arduino
@ -299,8 +300,9 @@ def openSerialDevice(d):
ser.setDTR(True) ser.setDTR(True)
try: try:
ser.close()
ser = serial.Serial( ser = serial.Serial(
port=d,\ port="\\\\.\\"+d,\
baudrate=115200,\ baudrate=115200,\
parity=serial.PARITY_NONE,\ parity=serial.PARITY_NONE,\
stopbits=serial.STOPBITS_ONE,\ stopbits=serial.STOPBITS_ONE,\
@ -308,7 +310,7 @@ def openSerialDevice(d):
rtscts=0,\ rtscts=0,\
timeout=0) timeout=0)
except: except:
print "ERROR: Can't open the serial device " + device print "ERROR (2): Can't open the serial device " + d
exit(2) exit(2)
##### #####