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



Am 06.02.14 18:08, schrieb Dennis Ferguson:
> 
> On 6 Feb, 2014, at 08:18 , Marc Balmer <marc%msys.ch@localhost> wrote:
>> Closing a serial port (e.g. /dev/dtyXX) takes almost exactly one second.
>> Why is that so?  Why does the call not return immediately?
>>
>> int fd;
>>
>> fd = open("/dev/dty03", O_RDWR);  /* returns immediately */
>> close(fd); /* returns after one second */
> 
> The com driver (at least) sometimes pauses for a second after DTR is
> deasserted in the last close to make sure the thing it is talking to
> notices the hangup before the next open asserts DTR again.
> 
> I can't remember the last time I used a serial port to talk to something
> that cared much about DTR.

I see the 1 sec delay also when the device is set to local mode.  I see
this on i386 and amd64 with ISA, PCI, and USB serial devices.

Martin Husemann reports that there is no such delay on sparc64.

The driver should not wait one second on the last close, imo.  The
application should, if needed.  But that's a different point.



Home | Main Index | Thread Index | Old Index