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 6 Feb, 2014, at 11:16 , Matthias Drochner 
<> wrote:
> On Thu, 6 Feb 2014 19:50:04 +0100
> Marc Balmer <> wrote:
>> If I find the spot, I will probably remove it.
> It is line 784 in dev/ic/com.c. It depends on the HUPCL
> flag unset which is done around line 1344, depending
> The comment in com_shutdown() makes some sense, but
> it could be done more elegantly, eg set a timer and
> do the delay on next open if it is done immediately.

I think the logic is broken in any case, it shouldn't
be doing this in com_shutdown().  Notice that com_shutdown()
isn't always executed on last close (which is when the
documentation says the HUPCL flag is supposed to have an
effect), it is executed on last close only when no one is
waiting for open, e.g. waiting for the dial-in device to
go active.  Yet the case where someone is waiting for the
dial-in device is exactly the situation where you want to
make sure the previous phone call is hung up, so the dial-in
guy doesn't end up talking to the call the dial-out guy

com_shutdown() shuts down the hardware.  You only want to
shut down the hardware when no one has the device open and
no one is waiting for it to be open (i.e. the condition
under which it is called is correct), but if HUPCL is set
you want to drop DTR on last close whether anyone is waiting
or not.

I hence think the delay needs to be removed from com_shutdown()
in any case, and moved somewhere else, for this to work
correctly.  If you just removed the delay from com_shutdown()
and didn't move it somewhere else, however, it might be that
no one would ever notice...

Dennis Ferguson

Home | Main Index | Thread Index | Old Index