diff --git a/python/sbp/client/drivers/cdc_driver.py b/python/sbp/client/drivers/cdc_driver.py index 157ee658de..ae7a81f340 100644 --- a/python/sbp/client/drivers/cdc_driver.py +++ b/python/sbp/client/drivers/cdc_driver.py @@ -39,12 +39,14 @@ def _read(self, size): print() print("Piksi disconnected") print() + self.close() raise IOError return return_val except OSError: print() print("Piksi disconnected") print() + self.close() raise IOError def _write(self, s): @@ -62,6 +64,7 @@ def _write(self, s): print() print("Piksi disconnected") print() + self.close() raise IOError def close(self): diff --git a/python/sbp/client/drivers/pyserial_driver.py b/python/sbp/client/drivers/pyserial_driver.py index 59e04d3179..9a4aa7c73e 100644 --- a/python/sbp/client/drivers/pyserial_driver.py +++ b/python/sbp/client/drivers/pyserial_driver.py @@ -46,7 +46,7 @@ def __init__(self, port, baud=115200, rtscts=False): try: handle = serial.serial_for_url(port) handle.baudrate = baud - handle.timeout = 1 + handle.timeout = None handle.rtscts = rtscts super(PySerialDriver, self).__init__(handle) except (OSError, serial.SerialException) as e: @@ -81,7 +81,7 @@ def _read(self, size): print() print("Piksi disconnected") print() - self.handle.close() + self.close() raise IOError def _write(self, s): @@ -104,7 +104,7 @@ def _write(self, s): print() print("Piksi disconnected") print() - self.handle.close() + self.close() raise IOError def __enter__(self):