From: Janne Huttunen Date: Sat, 11 Oct 2014 09:13:41 +0000 (+0300) Subject: Flush only the requested buffers X-Git-Tag: libserialport-0.1.1~91 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=ad7498553c7951ae5a559bd25512297be253696c;p=libserialport.git Flush only the requested buffers Fix the sp_flush() so that it flushes only the requested buffers also in unix. --- diff --git a/serialport.c b/serialport.c index d437140..4f42740 100644 --- a/serialport.c +++ b/serialport.c @@ -618,11 +618,11 @@ SP_API enum sp_return sp_flush(struct sp_port *port, enum sp_buffer buffers) RETURN_FAIL("PurgeComm() failed"); #else int flags = 0; - if (buffers & SP_BUF_BOTH) + if (buffers == SP_BUF_BOTH) flags = TCIOFLUSH; - else if (buffers & SP_BUF_INPUT) + else if (buffers == SP_BUF_INPUT) flags = TCIFLUSH; - else if (buffers & SP_BUF_OUTPUT) + else if (buffers == SP_BUF_OUTPUT) flags = TCOFLUSH; /* Returns 0 upon success, -1 upon failure. */