From f4f0b38f733c89929b2d108163ae5ca21719f07c Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Wed, 20 Apr 2011 14:03:41 +0000 Subject: [PATCH] Put a comment on tcflush(), it does not produce the attempted effect. ie. there are remaining bytes from old connections. --- libnfc/buses/uart_posix.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libnfc/buses/uart_posix.c b/libnfc/buses/uart_posix.c index facef9e..c45afe9 100644 --- a/libnfc/buses/uart_posix.c +++ b/libnfc/buses/uart_posix.c @@ -100,12 +100,13 @@ uart_open (const char *pcPortName) sp->tiNew.c_cc[VMIN] = 0; // block until n bytes are received sp->tiNew.c_cc[VTIME] = 0; // block until a timer expires (n * 100 mSec.) + // This line seems to produce absolutely no effect on my system (GNU/Linux 2.6.35) + tcflush (sp->fd, TCIFLUSH); + if (tcsetattr (sp->fd, TCSANOW, &sp->tiNew) == -1) { uart_close (sp); return INVALID_SERIAL_PORT; } - - tcflush (sp->fd, TCIFLUSH); return sp; }