From 76cc8a28281f0d5ec93cb00e365e15ad4d3c3eee Mon Sep 17 00:00:00 2001 From: klaute Date: Sun, 25 Sep 2016 10:57:24 +0200 Subject: [PATCH] Windows specific serial port open bug fixed. --- tools/meas.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/meas.py b/tools/meas.py index fc5c73f..1b42397 100644 --- a/tools/meas.py +++ b/tools/meas.py @@ -285,9 +285,10 @@ def openSerialDevice(d): global ser try: - ser = serial.Serial(d) + #serial.Serial.close() + ser = serial.Serial("\\\\.\\"+d) except: - print "ERROR: Can't open the serial device " + device + print "ERROR (1): Can't open the serial device " + d exit(1) # Toggle DTR to reset Arduino @@ -299,8 +300,9 @@ def openSerialDevice(d): ser.setDTR(True) try: + ser.close() ser = serial.Serial( - port=d,\ + port="\\\\.\\"+d,\ baudrate=115200,\ parity=serial.PARITY_NONE,\ stopbits=serial.STOPBITS_ONE,\ @@ -308,7 +310,7 @@ def openSerialDevice(d): rtscts=0,\ timeout=0) except: - print "ERROR: Can't open the serial device " + device + print "ERROR (2): Can't open the serial device " + d exit(2) #####