summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-03-22 11:29:02 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-03-22 11:29:02 +0100
commit7d078fe2e63c4a2fd573978a7cc847787473afa2 (patch)
treeaba45d1d0537d22dcb990ef667f1da2ace8e2351
parent6cb14ddacffcff3c6844429997a058c7826ec048 (diff)
SerialReader: Support both types of serial newlines
-rw-r--r--lib/runner.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/runner.py b/lib/runner.py
index fa08c01..9b95e6b 100644
--- a/lib/runner.py
+++ b/lib/runner.py
@@ -39,7 +39,12 @@ class SerialReader(serial.threaded.Protocol):
str_data = data.decode('UTF-8')
self.recv_buf += str_data
- lines = self.recv_buf.split("\n\r")
+ if '\n\r' in self.recv_buf:
+ lines = self.recv_buf.split('\n\r')
+ elif '\r\n' in self.recv_buf:
+ lines = self.recv_buf.split('\r\n')
+ else:
+ lines = []
if len(lines) > 1:
self.lines.extend(lines[:-1])
self.recv_buf = lines[-1]