Subject: Re: tty driver vs. CLOCAL
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-kern
Date: 09/19/2003 20:10:07
In article <20030919192549.GD563@drowsy.duskware.de>,
Martin Husemann <martin@duskware.de> wrote:
>This may be a stupid question, but neither the docs nor the current state
>of the source tree did answer it clearly for me:
>
>Imagine a driver for a (not semi-intelligent) serial chip. Is the driver
>supposed to check for CLOCAL before activating CTS/RTS? From an applications
>POV I always thought setting CLOCAL would override any handshake options, but
>it's not clear to me which kernel part takes care of this.
>
>So should it be:
>
>  if (ISSET(t->c_cflag, CRTSCTS) && !ISSET(t->c_cflag, CLOCAL))
>    /* change hardware to RTS/CTS mode */
>
>or just
>
>  if (ISSET(t->c_cflag, CRTSCTS))
>    /* change hardware to RTS/CTS mode */
>
>?
>
>Or is my application view of the issue wrong?

I don't think that CLOCAL has to do anything with CTS/RTS handshaking,
but it is there for ignoring DTR. So my answer would be the "or
just".  Imagine the scenario, where you are talking to a modem with
let's say kermit, but you have not connected yet and you want to
dial. You need CLOCAL to talk to the modem because DTR is not set.
At the same time you definitely don't want to clear flow control,
because you might lose bits if you talk to it too fast.

christos

christos