Configuring terminal line settings

The ttydefs file

/etc/ttydefs is an administrative file used by ttymon. It defines the speed and terminal settings for TTY ports. Each line in /etc/ttydefs contains five fields (``ttylabel'', ``initial-flags'', ``final-flags'', ``autobaud'', and ``nextlabel''), each of which is described below:

When ttymon initializes a port, it searches the ttydefs file for the entry that contains the termio settings for that port. The correct entry is the one whose ``ttylabel'' matches the ``ttylabel'' for the port. The ``ttylabel'' for the port is part of the pmspecific information included in ttymon's administrative file. By convention, ``ttylabel'' identifies a baud rate (for example, ``1200''), but it need not.

Contains the termio options to which the terminal is initially set. ``initial-flags'' must be specified using the syntax recognized by the stty(1) command.

Contains the termio options set by ttymon after a connection request has been made and immediately before invoking a port's service. Final flags must be specified using the syntax recognized by stty.

Autobaud is a line-speed option. When autobaud is used instead of a baud rate setting, ttymon determines the line speed of the TTY port by analyzing the first carriage return entered and sets the speed accordingly. If the autobaud field contains the character ``A'', the autobaud facility is enabled. Otherwise, autobaud is disabled.

If the user indicates (by sending a BREAK) that the current ttydefs entry does not provide a compatible line speed, ttymon will search for the ttydefs entry whose ``ttylabel'' matches the ``nextlabel'' field. ttymon will then use that field as its ``ttylabel'' field. A series of speeds is often linked together in this way into a closed set called a hunt sequence. For example, ``4800'' may be linked to ``1200'', which, in turn, is linked to ``2400'', which is finally linked to ``4800''.
All termio settings supported by the stty command are supported as options in the ttydefs file. For example, you can specify the default erase and kill characters.

The following figure shows the relationship between the ``ttylabel'' and ``nextlabel'' fields in the ttymon administrative files and ttydefs files.

Links between the port monitor administrative file and the ttydefs file

NOTE: The format of the /etc/ttydefs file may change in future releases. For continuity across releases, use the sttydefs(1M) command to access this file.

The following is a sample ttydefs file:

38400:38400 hupcl erase ^h:38400 sane ixany tab3 hupcl erase ^h::19200
19200:19200 hupcl erase ^h:19200 sane ixany tab3 hupcl erase ^h::9600
9600:9600 hupcl erase ^h:9600 sane ixany tab3 hupcl erase ^h::4800
4800:4800 hupcl erase ^h:4800 sane ixany tab3 hupcl erase ^h::2400
2400:2400 hupcl erase ^h:2400 sane ixany tab3 hupcl erase ^h::1200
1200:1200 hupcl erase ^h:1200 sane ixany tab3 hupcl erase ^h::300
300:300 hupcl erase ^h:300 sane ixany tab3 hupcl erase ^h::19200

The autobaud option

Autobaud allows the system to set the line speed of a given TTY port to the line speed of the device connected to the port without the user's intervention. Each time a service to be monitored by a ttymon port monitor is added, a ttylabel must be supplied (see ``Configuring terminal line settings''). If this ttylabel points to an entry in the /etc/ttydefs file that has an ``A'' in the autobaud field, ttymon will try to determine the proper line speed before printing the prompt.

After receiving a carrier indication on one of its TTY ports, but before printing a prompt, ttymon does the following:

  1. It reads the next character received from the port. Provided the character read is a newline character and that it is transmitted at a line speed autobaud can support, ttymon will determine this line speed and change the port's line speed to that speed.

  2. If a baud rate cannot be determined from the character that is read (for example, if the user entered a character other than a newline) or if a break is received rather than a character, ttymon considers this to be an autobaud failure and the character is discarded. If after five opportunities, a newline is not recognized, the search proceeds to the next ttydefs entry in the hunt sequence. If an autobaud flag is encounted again, the prompt will not be written and the procedure just described is repeated. If no autobaud flag is set, the search again proceeds to the next ttydefs entry in the hunt sequence.
See ttymon(1M) for more information about the autobaud option.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 22 April 2004