1
0
mirror of git://sigrok.org/libserialport synced 2023-08-10 21:13:24 +03:00

Flush only the requested buffers

Fix the sp_flush() so that it flushes only the requested buffers
also in unix.
This commit is contained in:
Janne Huttunen 2014-10-11 12:13:41 +03:00 committed by Uwe Hermann
parent d66bbceaa7
commit ad7498553c

View File

@ -618,11 +618,11 @@ SP_API enum sp_return sp_flush(struct sp_port *port, enum sp_buffer buffers)
RETURN_FAIL("PurgeComm() failed"); RETURN_FAIL("PurgeComm() failed");
#else #else
int flags = 0; int flags = 0;
if (buffers & SP_BUF_BOTH) if (buffers == SP_BUF_BOTH)
flags = TCIOFLUSH; flags = TCIOFLUSH;
else if (buffers & SP_BUF_INPUT) else if (buffers == SP_BUF_INPUT)
flags = TCIFLUSH; flags = TCIFLUSH;
else if (buffers & SP_BUF_OUTPUT) else if (buffers == SP_BUF_OUTPUT)
flags = TCOFLUSH; flags = TCOFLUSH;
/* Returns 0 upon success, -1 upon failure. */ /* Returns 0 upon success, -1 upon failure. */