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 | 3067da1bb2dc414d6a07bc6d4751ac460c9672ee (patch) | |
tree | 975fcc04ad1470c61c4e9039a2299f6d8f67eff9 | |
parent | d3919081ab599bdb17e476fe3049f8f7451dd893 (diff) | |
download | pyserial-3067da1bb2dc414d6a07bc6d4751ac460c9672ee.tar.gz |
[Bug pyserial:146] flush() does nothing in windows (despite docs)
git-svn-id: http://svn.code.sf.net/p/pyserial/code/trunk/pyserial@456 f19166aa-fa4f-0410-85c2-fa1106f25c8a
-rw-r--r-- | CHANGES.txt | 2 | ||||
-rw-r--r-- | serial/serialwin32.py | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 8359d28..f57eab7 100644 --- a/CHANGES.txt +++ b/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/serial/serialwin32.py b/serial/serialwin32.py index 3802d4b..4df8041 100644 --- a/serial/serialwin32.py +++ b/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.""" |