diff options
author | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2013-05-31 00:47:16 +0000 |
---|---|---|
committer | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2013-05-31 00:47:16 +0000 |
commit | 2640978be7673cdd230241de2be32bd9c410b709 (patch) | |
tree | 07e7704682c42764145f5d9912ea3d7a3b8b4d06 | |
parent | ec5c636cce8572932472e26a519640d7f938c07c (diff) | |
download | pyserial-git-2640978be7673cdd230241de2be32bd9c410b709.tar.gz |
[Bug pyserial:146] flush() does nothing in windows (despite docs)
-rw-r--r-- | pyserial/CHANGES.txt | 2 | ||||
-rw-r--r-- | pyserial/serial/serialwin32.py | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/pyserial/CHANGES.txt b/pyserial/CHANGES.txt index 8359d28..f57eab7 100644 --- a/pyserial/CHANGES.txt +++ b/pyserial/CHANGES.txt @@ -456,4 +456,6 @@ Bugfixes (win32): - [Bug 3444941] ctypes.WinError() unicode error - [Bug 3550043] on Window in tools global name 'GetLastError' is not defined +- [Bug pyserial:146] flush() does nothing in windows (despite docs) + diff --git a/pyserial/serial/serialwin32.py b/pyserial/serial/serialwin32.py index 3802d4b..4df8041 100644 --- a/pyserial/serial/serialwin32.py +++ b/pyserial/serial/serialwin32.py @@ -273,6 +273,14 @@ class Win32Serial(SerialBase): else: return 0 + def flush(self): + """Flush of file like objects. In this case, wait until all data + is written.""" + while self.outWaiting(): + time.sleep(0.05) + # XXX could also use WaitCommEvent with mask EV_TXEMPTY, but it would + # require overlapped IO and its also only possible to set a single mask + # on the port--- def flushInput(self): """Clear input buffer, discarding all that is in the buffer.""" |