On Mon, 2020-06-08 at 11:13 +0200, Oliver Neukum wrote: > > Am Freitag, den 05.06.2020, 10:09 +0000 schrieb Joakim Tjernlund: > > > I can see that when I open the tty, a USB read is performed and then echoed back. > > Should an open really do that? > > Yes. The tty interface does not pass read(2) down to the driver. > > > If so, an flag to open(2), telling it to drop the input buffer would be really handy. > > That actually looks like an unavoidable race condition to me. > How would you tell the difference between old data and newly > arriving data? Most terminal programs I use tries to empty the read queue after open, just to avoid old garbage så I don't see a problem here. It it up to the terminal app. Maybe one could use O_DIRECT for this purpose ? Jocke