[flashrom] [PATCH] Move OS-dependent serial code from buspirate_spi.c to serial.c
Michael Karcher
flashrom at mkarcher.dialup.fu-berlin.de
Wed Jan 6 16:27:40 CET 2010
Am Mittwoch, den 06.01.2010, 16:13 +0100 schrieb Carl-Daniel Hailfinger:
> +int serialport_discard_read(void)
> +{
> + int flags;
> +
> + printf_debug("%s\n", __func__);
> + flags = fcntl(sp_fd, F_GETFL);
> + flags |= O_NONBLOCK;
> + fcntl(sp_fd, F_SETFL, flags);
> + sp_flush_incoming();
> + flags &= ~O_NONBLOCK;
> + fcntl(sp_fd, F_SETFL, flags);
> +
> + return 0;
> +}
I know that this patch is just about moving code, so of course the code
will go in this way, but is there any reason not to use
tcflush(sp_fd, TCIFLUSH);
instead of this complicated function?
OK, I think I got it. tcflush is or was broken on Windows. See for
example http://www.cygwin.com/ml/cygwin/2003-10/msg00797.html
Maybe add a reference to cygwin as explanation?
Regards,
Michael Karcher
More information about the flashrom
mailing list