diff options
author | Chris Liechti <cliechti@gmx.net> | 2016-12-17 23:44:18 +0100 |
---|---|---|
committer | Chris Liechti <cliechti@gmx.net> | 2016-12-17 23:44:18 +0100 |
commit | e0063f13ab53b1a3c9fa9f0b9c65444385e3766f (patch) | |
tree | c2fd7ce69fc36088b8c49917d2adbf1e59e19d9e /serial/serialposix.py | |
parent | cc715f08ff530f41f03bfee8171c975d89200ef4 (diff) | |
download | pyserial-git-e0063f13ab53b1a3c9fa9f0b9c65444385e3766f.tar.gz |
posix: fix return value of write, fixes #189
Diffstat (limited to 'serial/serialposix.py')
-rw-r--r-- | serial/serialposix.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/serial/serialposix.py b/serial/serialposix.py index 980430c..dcc71a0 100644 --- a/serial/serialposix.py +++ b/serial/serialposix.py @@ -516,7 +516,7 @@ class Serial(SerialBase, PlatformSpecific): if not self.is_open: raise portNotOpenError d = to_bytes(data) - tx_len = len(d) + tx_len = length = len(d) timeout = Timeout(self._write_timeout) while tx_len > 0: try: @@ -555,7 +555,7 @@ class Serial(SerialBase, PlatformSpecific): # still calculate and check timeout if timeout.expired(): raise writeTimeoutError - return len(d) + return length - len(d) def flush(self): """\ |