1754398 Members
2888 Online
108813 Solutions
New Discussion юеВ

stty

 
j773303
Super Advisor

stty

"stty -a" can view interruput , del and so on setting.
Where can find the stty default configraion file?
Hero
8 REPLIES 8
Bill Hassell
Honored Contributor

Re: stty

The stty defaults are in the driver and set when the port is first opened. The most important is that the baud rate is always 300 until overridden. And even more important, using stty on a closed serial port will cause the changes to be made only during the duration of stty. Once the port is no longer open, the defaults are set again. The defaults are documented in the termio man page.


Bill Hassell, sysadmin
Rajeev  Shukla
Honored Contributor

Re: stty

The best way you might want to change the stty parameters is in the .profile of the user or /etc/profile if you want for all users.
j773303
Super Advisor

Re: stty

When man termio, the message are too long. I'm not familar with stty and termio. Do you please tell where to define the stty defaut setting? Or any document deccription the stty default configuration?
Hero
Steven E. Protter
Exalted Contributor

Re: stty


HP-UX hpweb B.11.11 U 9000/803 (ta)

login: root
Password:
Last successful login for root: Wed Nov 26 11:11:50 CST6CDT 2003 on pts/tb
Last unsuccessful login for root: Wed Nov 26 10:59:35 CST6CDT 2003
Please wait...checking for disk quotas
(c)Copyright 1983-2000 Hewlett-Packard Co., All Rights Reserved.
(c)Copyright 1979, 1980, 1983, 1985-1993 The Regents of the Univ. of California
(c)Copyright 1980, 1984, 1986 Novell, Inc.
(c)Copyright 1986-1992 Sun Microsystems, Inc.
(c)Copyright 1985, 1986, 1988 Massachusetts Institute of Technology
(c)Copyright 1989-1993 The Open Software Foundation, Inc.
(c)Copyright 1986 Digital Equipment Corp.
(c)Copyright 1990 Motorola, Inc.
(c)Copyright 1990, 1991, 1992 Cornell University
(c)Copyright 1989-1991 The University of Maryland
(c)Copyright 1988 Carnegie Mellon University
(c)Copyright 1991-2000 Mentat Inc.
(c)Copyright 1996 Morning Star Technologies, Inc.
(c)Copyright 1996 Progressive Systems, Inc.
(c)Copyright 1991-2000 Isogon Corporation, All Rights Reserved.


RESTRICTED RIGHTS LEGEND
Use, duplication, or disclosure by the U.S. Government is subject to
restrictions as set forth in sub-paragraph (c)(1)(ii) of the Rights in
Technical Data and Computer Software clause in DFARS 252.227-7013.

Hewlett-Packard Company
3000 Hanover Street
Palo Alto, CA 94304 U.S.A.

Rights for non-DOD U.S. Government Departments and Agencies are as set
forth in FAR 52.227-19(c)(1,2).
You have mail.



Value of TERM has been set to "ansi".
WARNING: YOU ARE SUPERUSER !!

Thu Nov 27 06:05:05 2003:/root
[2806#] stty -a
speed 9600 baud; line = 0;
rows = 25; columns = 80
min = 4; time = 0;
intr = ^C; quit = ^\; erase = ^H; kill = ^U
eof = ^D; eol = ^@; eol2 ; swtch
stop = ^S; start = ^Q; susp = ^Z; dsusp
werase ; lnext
parenb -parodd cs7 -cstopb hupcl -cread -clocal -loblk -crts
-ignbrk brkint ignpar -parmrk -inpck istrip -inlcr -igncr icrnl -iuclc
ixon -ixany ixoff -imaxbel -rtsxoff -ctsxon -ienqak
isig icanon -iexten -xcase echo echoe echok -echonl -noflsh
-echoctl -echoprt -echoke -flusho -pendin
opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel -tostop
Thu Nov 27 06:05:05 2003:/root
[2807#]

These are the defaults with one acception. Ctrl-Z stops the current task and gives me the chance to background it if I wish. Everything else is vanilla HP-UX.

Off a 11.11 System, 32 bit pretty agressively patched.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
j773303
Super Advisor

Re: stty

Hi Steven,
What did you mean? Reboot the machine and type stty -a???
Hero
Elmar P. Kolkman
Honored Contributor

Re: stty

To view the defaults, temporarily move /etc/profile out of the way and login as a user without a .profile
Or replace /bin/stty by a script
Or do a stty -a as the first line in /etc/profile to view the settings.

It might be interesting to do this test on several connections (xterm -ls, rlogin, ssh, console, ...)

As for the default speed: it could very well be that 300 baud is the default, but as long as you have a getty running, the speed is set by getty before login is started.
Every problem has at least one solution. Only some solutions are harder to find.
Mark Grant
Honored Contributor

Re: stty

It is worth noting that for the console and serially attached terminals, and possibly even other terminals (I'm not sure) the stty settings that apply to the communication is set by "login" when it reads /etc/gettydefs.
Never preceed any demonstration with anything more predictive than "watch this"
Bill Hassell
Honored Contributor

Re: stty

Serial devices that have login capability (ie, not printers, etc) are indeed controlled by getty and the settings start with /etc/gettydefs. For the console and all login-enabled serial port, getty is started in /etc/inittab. NOTE: The default settings for terminals is more than 20 years out of date!!! The terminal settings in /etc/gettydefs (except for the console) are 9600 7bits, even parity--which is why modems and terminals seem to behave strangely using the defaults. The "H" entry in /etc/gettydefs is a good starting point for setting up hardwaired login terminals, and for modems, you can use the various entries in gettydefs except change CS7 to CS8 and decide if you want the BREAK key to change baud rates for you.

Now all the above refers to login terminals. A port that is connected to a printer or other device that is not controlled by getty will use the driver defaults which can be seen by using:

stty -a < /dev/tty0p2

or whatever port you want to check. Note that if the port is already open. HOWEVER: starting with recent patches to 11.0 and 11.11, a new device file called /dev/ttyconf now exists and it can be used to set new driver defaults for ALL terminal ports, including pty devices used in telnet connections. This is especially helpful for logins where LOGIN and PASSWORD will have the defaults are:

intr = DEL; erase = #; kill = @

That's why backspace doesn't work for login and password (you have to use # as the erase character). However, if you type this command:

stty erase "^H" kill "^U" intr "^C" eof "^D" < /dev/ttyconf

And now all tty and pty devices will have the 'expected' settings. NOTE: the /dev/console device and any alread-opened devices will not inherit the new login settings until a reboot.


Bill Hassell, sysadmin