diff options
author | Chris Liechti <cliechti@gmx.net> | 2019-02-08 03:13:18 +0100 |
---|---|---|
committer | Chris Liechti <cliechti@gmx.net> | 2019-02-08 03:13:18 +0100 |
commit | a4d8f27bf636ee598c4368d7e488f78a226bf778 (patch) | |
tree | a3633420f2d1bcc0acc000876e6c60800a6d0a7a | |
parent | ba3f6e73bb68566ada43411a42140e53558ab353 (diff) | |
download | pyserial-git-a4d8f27bf636ee598c4368d7e488f78a226bf778.tar.gz |
threaded: "write" returns byte count
fixes #372
-rw-r--r-- | serial/threaded/__init__.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/serial/threaded/__init__.py b/serial/threaded/__init__.py index 9b8fa01..b8940b6 100644 --- a/serial/threaded/__init__.py +++ b/serial/threaded/__init__.py @@ -203,7 +203,7 @@ class ReaderThread(threading.Thread): break else: if data: - # make a separated try-except for called used code + # make a separated try-except for called user code try: self.protocol.data_received(data) except Exception as e: @@ -216,7 +216,7 @@ class ReaderThread(threading.Thread): def write(self, data): """Thread safe writing (uses lock)""" with self._lock: - self.serial.write(data) + return self.serial.write(data) def close(self): """Close the serial port and exit reader thread (uses lock)""" |