tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Closing a serial device takes one second



On Fri, 07 Feb 2014, Marc Balmer wrote:
Am 06.02.14 17:18, schrieb Marc Balmer:
fd = open("/dev/dty03", O_RDWR);  /* returns immediately */
close(fd); /* returns after one second */

So it is clear now that the delay is there for a specific application case: A modem on a tty line that hangs up when DTR is gone for one second. For probably all other use cases the delay is not necessary.

Yes, for many use cases, the delay is not necessary. If you have one of those use cases then you can clear the termios(4) HUPCL flag.

For use cases where the delay is desired, it would be better if the delay was neither unconditionally inserted at close time, not unconditionally inserted at open time, but rather if the delay was inserted only when necessary, such as when a close (with HUPCL set) is followed very soon by an open.

In conclusion, the delay probably comes from times long gone when people used dial-in modems. For "modern" serial applications they are more a nuisance. Is it time to switch the default to no delay?

I think this idea should be rephrased in terms of changing the default
termios(4) flags.

--apb (Alan Barrett)


Home | Main Index | Thread Index | Old Index