Operating System - HP-UX
1844076 Members
2518 Online
110227 Solutions
New Discussion

Changing the tty settings for a different terminal.

 
Managed Services
Frequent Advisor

Changing the tty settings for a different terminal.

Quick one for someone!!
I wish to change the tty settings for a different terminal then the one I am currently on. It goes something like
stty ixany /dev/ttyx5, however I need a bit of help with the exact syntax please!!
8 REPLIES 8
Rodney Hills
Honored Contributor

Re: Changing the tty settings for a different terminal.

You can't change the stty settings of another terminal session. "stty" on works on the current session you are running.

If you have a session that you wish to always set certain "stty" options, then add "stty" to the .profile file to set it before the application starts.

HTH

-- Rod Hills
There be dragons...
A. Clay Stephenson
Acclaimed Contributor

Re: Changing the tty settings for a different terminal.

Actually you can change the terminal settings for any port (as long as you have the permissions and the port is actually open). You were close. Stty uses stdin so all you needed to change is
"stty ixany /dev/ttyx5" to
"stty ixany < /dev/ttyx5"
and you are done.
If it ain't broke, I can fix that.
Rodney Hills
Honored Contributor

Re: Changing the tty settings for a different terminal.

Harry is right. I forgot about stdin.

by the way, to set the default control characters for all new connections, eg-
stty erase '^H' kill '^U' intr '^C' susp '^Z'
This gets around the problem of "@" being backspace on the Login: prompt.

see man stty

HTH

-- Rod Hills
There be dragons...
Bill Hassell
Honored Contributor

Re: Changing the tty settings for a different terminal.

stty settings are normally placed into /etc/profile so that normal logins will inherit the new settings. A typical set of stty values in /etc/profile might be:

/sbin/stty erase "^H" kill "^U" intr "^C" eof "^D" -parity ixoff
/sbin/stty susp \^Z dsusp \^Y

Note that you can also apply these settings one time (on 11.0 with patches and higher only) by using the ttyconf device file:

/sbin/stty erase "^H" kill "^U" intr "^C" eof "^D" -parity ixoff < /dev/ttyconf

/sbin/stty susp \^Z dsusp \^Y < /dev/ttyconf

Thwe advantage in using ttyconf is that ot changes the tty prior to login so now, the backspace key works during login (the @ and # character defaults are removed).


Bill Hassell, sysadmin
Managed Services
Frequent Advisor

Re: Changing the tty settings for a different terminal.

Many thanks for that. I am also getting a number of problems with a printer whereby a number of columns are not aligning properly. I presume this is connected with the float control in some way. From the stty controls, are there any particular ones that need to be switched on or off, e.g. xon, xoff.
Rodney Hills
Honored Contributor

Re: Changing the tty settings for a different terminal.

If columns are not aligned on your printer, it could be one of the following:

1) Using spaces to line up text and the font is variable width.

2) Using tabs to line up text and printer not set with proper spacing (ie terminal set at 8 characters and printer at 10).

3) A serial printer with incorrect handshaking. You can lose text due to buffer overruns. You shouldn't have to use "stty" to set this. If you are connected to a serial mux port, then /etc/gettydefs is where you would set flowcontrol. If you are using DTC's then you would use dtcmodify to set the flowcontrol.

HTH

-- Rod Hills
There be dragons...
A. Clay Stephenson
Acclaimed Contributor

Re: Changing the tty settings for a different terminal.

Well, handshaking on serial lines can take many forms but the first thing that you must do is determine if you are going to use hardware (signaled using RTS/CTS lines) or software (look for special characters usually DC3 (0x11) for stop and DC1 (0x19) for start -- usually referred to as XON/XOFF protocol -- transmitted along with the data stream.

If your printer is using the full 8-bit character set then you have no choice but hardware handshake because the stop/start characters could then be part of a normal data stream.

The first thing that you need is to choose the device node for the port. Some will not use any hardware flow control and others will.

The stty settings of interest to you are
-clocal
ctsxon
rtsxoff
crts
ixon
-ixany

Man stty, termio, termiox, and modem for details.
If it ain't broke, I can fix that.
Bill Hassell
Honored Contributor

Re: Changing the tty settings for a different terminal.

stty knows nothing about formatting, it just controls handshaking and special character interpretation. If everything is readable but columns of numbers do not line up, this is due to a proportional font. Virtually all fonts found in modern printers and PCs sre proportinal, so a line of five 8's is muchy wider than five 1's. Modern word processors have very complex codes setup to position characters across the page. Change the font used on your printer to a fixed-width font such as Courier rather than Times Roman or Arial.


Bill Hassell, sysadmin