From 761c68e469bb2bc4734d8e2b44147e8640d14434 Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Sat, 9 Jan 2021 16:50:08 +0100 Subject: [PATCH] frontend: fix disconnect when autodetection fails We don't know the protocol version so we can't actually disconnect, just skip it. --- stcgal/frontend.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stcgal/frontend.py b/stcgal/frontend.py index 627ead2..31a0978 100644 --- a/stcgal/frontend.py +++ b/stcgal/frontend.py @@ -181,7 +181,8 @@ class StcGal: except (StcFramingException, StcProtocolException) as ex: sys.stdout.flush() print("Protocol error: %s" % ex, file=sys.stderr) - self.protocol.disconnect() + if not isinstance(self.protocol, StcAutoProtocol): + self.protocol.disconnect() return 1 except serial.SerialException as ex: sys.stdout.flush()