serialhdl: Catch SerialException as well as OSError on serial open
Catch the right exceptions so that a retry is possible when attempting to open the serial port. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
e60779bfe1
commit
d2027cb4a9
|
@ -65,7 +65,7 @@ class SerialReader:
|
||||||
starttime = self.reactor.monotonic()
|
starttime = self.reactor.monotonic()
|
||||||
try:
|
try:
|
||||||
self.ser = serial.Serial(self.serialport, self.baud, timeout=0)
|
self.ser = serial.Serial(self.serialport, self.baud, timeout=0)
|
||||||
except OSError, e:
|
except (OSError, serial.SerialException), e:
|
||||||
logging.warn("Unable to open port: %s" % (e,))
|
logging.warn("Unable to open port: %s" % (e,))
|
||||||
self.reactor.pause(starttime + 5.)
|
self.reactor.pause(starttime + 5.)
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue