Make sure that all buffers are empty after opening (on all supported
systems).

Signed-off-by: Wolfram Sang <w...@the-dreams.de>
---

This came up while debugging bug #1025. It doesn't fix the bug but I
think it is still nice to have. Opinions?

 serialport.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/serialport.c b/serialport.c
index eddd028..13c9a63 100644
--- a/serialport.c
+++ b/serialport.c
@@ -648,6 +648,10 @@ SP_API enum sp_return sp_open(struct sp_port *port, enum 
sp_mode flags)
                RETURN_CODEVAL(ret);
        }
 
+       ret = sp_flush(port, SP_BUF_BOTH);
+       if (ret < 0)
+               DEBUG("Flushing buffers failed");
+
        RETURN_OK();
 }
 
-- 
2.20.1



_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to