Subject: Re: stty doesn't stick!??
To: noud de brouwer <noud@pop.knot.nl>
From: Bill Studenmund <skippy@macro.stanford.edu>
List: port-i386
Date: 01/14/1997 11:16:16
On Tue, 14 Jan 1997, noud de brouwer wrote:
> now i've swaped the ppp-server from mac68k to i386..
> i saw the ports 'locked' to 9600, while all the previous
> working settings are in place??
>
> if i do a stty -f /dev/tty00 57600, the next time someone
> does dial-in and deconnect stty -f /dev/tty00 shows 9600.
>
> my guess is that's a port specific issue, is it??
> what extra's do i have to do, besides /etc/ttys and stty -f to
> keep the speed stick??
This issue is driver-specific, and thus ends up being port-specific.
To make sense of the discussion, I need to define "first open," which is
the open when the serial port goes from being closed to being open (a
second or third open, while the first fd is still open, don't count).
The current mac zstty serial driver (not the M.I. one), the zs driver the
mac68k had since 1.1 (the one you tested over a year ago), the original
ser driver (and the 1.2 atari and amiga serial drivers) all reset the port
settings to the defaults only if the speed was 0 - only the first time
after boot. Most other serial drivers (certainly the com driver on the
i386) will reset to defaults on every first open. The difference is two
fold.
1) a user can't set the port into a bizzar state and hose it for everyone
else.
2) stty won't work the way you're used to (the settings aren't sticky).
There actually was a great debate on current-users a few months ago about
this very point. Both sides have merit.
My solution was to come up with per-port settable defaults. They're kinda
like what people have called "BSDI defaults," but I've never used BSDI.
The patches to impliment them are sitting in a languishing pr (I've
forgotten the #). Basically stty gains a "-D" flag, and you can change the
defaults for a port. Just what you want to do.
I think the pr's patches include a patch to the dev/isa/com driver.
(thech note: basically the tty structure grew to include a defaults
termios. On first open, the defaults get copied to the in-use termios.
Setting up the defaults got put in ttymalloc to keep things simple, and
the driver code actually got smaller because now it's just a memcopy (or
bcopy; whichever you like), not tp->t_ospeed = X, tp->t_cflag = Y ...
Plus there are patches to stty, and to libc to support new calls to handle
the get and set defaults ioctl's).
Your other option is to set the default speeds in the ppp optins file, or
to change the speed in the getty setup (depends on how people call in).
Good luck,
Bill