Subject: Re: New experimental ioctl's for serial driver
To: Ty Sarna <tsarna@endicor.com>
From: Bill Studenmund <wrstuden@loki.Stanford.EDU>
List: tech-kern
Date: 02/24/1996 12:35:09
> 
> In article <199602231240.HAA16762@Collatz.McRCIM.McGill.EDU>,
> der Mouse  <mouse@Collatz.McRCIM.McGill.EDU> wrote:
> > That said, I'm not that sure I like the proposed mechanism, with a
> > parallel set of ioctls.  That means that either stty needs a somewhat
> > ugly kludge or you can't use stty to frob the first-open state.
> 
> And worse, it doesn't even solve the problem! As explained, the problem
> is that defaults are needed because opening the device and issueing an
> ioctl to change them leaves a window where a character can be echoed.
> Yet, the proposed solution has the same window, from the time when the
> device is opened until the defaults are changed. Granted the window only
> exists once, but it still exists!

True. What the code really does is, depending upon a config flag passed
to the mac-68k kernel from the booter program we run under MacOS,
either fill this set of defaults with TTYDEF_XFLAG, or flags for
raw mode. Thus there is no window for the defaults to be wrong.

My thought was that, given this mechanism, let it be switchable on
the fly. Besides avoiding my aversion to things which are not
changeable on the fly when they really could be, I could see an
advantage for a long-lived machine. If you change the use of one
port to a device which really preferes a different set of defaults,
with such a default system, you don't have to take the machine
down. Just change the default for the port, and you're set.

About setting these defaults, wouldn't a '-d' option to stty work?
If this flag (whose name is flexable right now :-) ) is set,
you work on the defaults, not the current state. The places
which would need changing would be using a tcget/setdefattr
instead of tcget/setattr. This library routine would then just
use a different ioctl when actually calling the tty device,
going along with what Charles suggested earlier (about the
lib routines).

Using minor #'s would work, but each tty would have to latch onto
two devices, not one. The trick of looking at devicecd.cd_devs[unit]
would break (unless we used a really high bit, like 0x0080, for the
use-the-defaults-not-the-real-thing bit).

Thoughts?

Take care,

Bill