From 3c82a33bdaeb6029c63071755100b32ec798bd02 Mon Sep 17 00:00:00 2001 From: dzollo Date: Wed, 15 Jul 2020 12:17:38 -0700 Subject: [PATCH 1/2] Remove short pyserial timeout. Timeout was causing console to disconnect during Piksi Multi restart. Timeout made serial driver not equivalent in behavior to file driver or network driver --- python/sbp/client/drivers/pyserial_driver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/sbp/client/drivers/pyserial_driver.py b/python/sbp/client/drivers/pyserial_driver.py index 59e04d3179..12f58f67ab 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: From 0b6e694e6df183e4dd9bd6981c6e70f6ea08c338 Mon Sep 17 00:00:00 2001 From: dzollo Date: Wed, 15 Jul 2020 12:19:29 -0700 Subject: [PATCH 2/2] Use basedriver.close(). call close on disconnect of CDC driver. extends behavior from commit 9b1592890f13ce1da0d94632035858a6a78871ab that addressed ESD-1111 --- python/sbp/client/drivers/cdc_driver.py | 3 +++ python/sbp/client/drivers/pyserial_driver.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) 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 12f58f67ab..9a4aa7c73e 100644 --- a/python/sbp/client/drivers/pyserial_driver.py +++ b/python/sbp/client/drivers/pyserial_driver.py @@ -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):