Am Mittwoch, den 06.01.2010, 16:27 +0100 schrieb Michael Karcher:
> 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?
Don't worry. They changed cygwin. See tcflush in
http://cygwin.com/cgi-bin/cvsweb.cgi/src/winsup/cygwin/fhandler_serial.cc?rev=1.73&cvsroot=src
It maps to a native PurgeComm which is just fine. Thanks to patrickg for
the hint to recheck current code.
So no need to not use tcflush here.
Regards,
Michael Karcher
_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom