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:
parent
d66bbceaa7
commit
ad7498553c
@ -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. */
|
||||||
|
Loading…
Reference in New Issue
Block a user