Subject: Re: PR 6502
To: Andreas Gustafsson <gson@araneus.fi>
From: Bill Studenmund <wrstuden@nas.nasa.gov>
List: tech-kern
Date: 04/16/1999 12:42:42
Note Reply-To: tech-kern. :-)
On Fri, 16 Apr 1999, Andreas Gustafsson wrote:
> Michael Graff <explorer@flame.org> kindly forwarded me the following
> message since I'm not on the developers list:
>
> > From: Paul Kranenburg <pk@cs.few.eur.nl>
> > Message-Id: <199904140857.KAA18301@kaa.cs.few.eur.nl>
> > To: developers@netbsd.org, explorer@flame.org
> > Subject: Re: PR 6502
> >
> > > It fixes a problem in com.c where, even if a device is not open by any
> > > process, characters are echoed.
> > >
> > > The situation is when getty has blocked in open() call, waiting for CD
> > > to become true, but nothing actually has the port open fully yet.
> > >
> > > Anyone see a problem with committing it?
> >
> > This is not only a problem with the `com' driver. It should be fixed
> > in tty.c.
>
> I have two comments about this.
>
> First, when you decide that a PR has an inappropriate patch, as the PR
> author I would appreciate being informed so that I can reply to your
> criticism and/or try to come up with a better patch.
I agree, that's what "feedback" should be for. :-)
> Second, I still think the tty layer is the wrong place to fix this
> problem. We are talking about a state where the com port is not yet
> open, and the hardware is set to the arbitrarily chosen default speed
> of 9600 bps (there is no way it can be changed before the open
> succeeds). The port may be connected to a modem set to a completely
> different speed. What you are proposing is in effect that the com
> driver should interpret the incoming serial signal at the default
> speed, give the resulting garbage characters (with framing errors)
> to the tty layer, and then have the tty layer ignore them. That's
> hardly a more elegant solution than dropping any garbage data in the
> com driver itself.
I think both sides are correct - the tty layer MUST ignore input iff
!ISSET(tp->t_state, TS_ISOPEN), but I also think it's an acceptable
optimization for the driver to drop characters in this case.
I think the PR's title is a bit off. Rather than echoing characters when
CD is not asserted (which is perfectly valid if we have clocal set), the
problem is that the system's echoing characters when TS_ISOPEN is not set.
Which is a problem!
> This problem did not exist in 1.2, because its com driver (not tty.c!)
> did ignore serial input while closed. I'm not asking for a change to
> the way the com driver has historically worked, I'm just asking that
> the 1.2 behaviour (which I consider correct) be restored.
The problem is that the port is not "closed" at this point, and speaking
just in terms of "closed" and "open" will get into a semantic mess. :-)
Take care,
Bill