Line Settings

Team-Fly    

Solaris™ Operating Environment Boot Camp
By David Rhodes, Dominic Butler
Table of Contents
Chapter 14.  Connecting Serial Devices


When we use the ttyadm command, one of the parameters we need to specify is the line settings that we would like to apply to the port. In our example, we've used "contty5H," so let's find out what this means.

A file named /etc/ttydefs contains the list of all the line settings known to the system. Each one of these has a corresponding label that is matched against the option passed to ttyadm. Let's have a look at the one we have used:

 hydrogen# grep contty5H /etc/ttydefs contty5H:19200 opost onclr:19200 hupcl sane::conttyH hydrogen# 

So what does this mean? First, we can see that the file is colon-separated and split into fields. The first field contains the label that will be matched to find the correct entry. The next contains the initial line settings to apply. Following this we have the line settings that will be applied just before the service runs. Both of these can be any of the valid termio settings (see the manual pages for termio(7I) and stty(1)). Next we have the "autobaud" field. If this contains an "A," ttymon will determine the line speed by analyzing the carriage returns. Finally, the last field contains the name of the next entry to use if this one is unsuitable. This is often used to create a "hunt group" that cycles through each speed. The "hunt group" that relates to our settings (contty5H) is shown below:

 conttyH:9600 opost onclr:9600 hupcl sane::contty1H contty1H:1200 opost onclr:1200 hupcl sane::contty2H contty2H:300 opost onclr:300 hupcl sane::contty3H contty3H:2400 opost onclr:2400 hupcl sane::contty4H contty4H:4800 opost onclr:4800 hupcl sane::contty5H contty5H:19200 opost onclr:19200 hupcl sane::conttyH 

The only differences between each of these entries are the line speeds and the labels. This means that if contty5H (19200) is unsuitable, conttyH (9600) will be tried, and if that is unsuitable, contty1H (1200) will be tried, and so on. The remaining line settings are all the same; by checking the stty man page, we can see they perform the following functions:

  • opost Post-process output

  • onclr Map newline to carriage return-newline on output

  • hupcl Hang up the connection on the last close

  • sane Reset all modes to reasonable values

The /etc/ttydefs file has an associated administration command named sttydefs. This can be used to maintain the entries in the file, although many people simply edit it to make the necessary changes. It also provides options to list entries, so instead of running the grep command as we showed earlier, we could also run the following:

 hydrogen# sttydefs l contty5H ---------------------------------------------------- contty5H:19200 opost onlcr:19200 hupcl sane::conttyH ---------------------------------------------------- ttylabel:       contty5H initial flags:  19200 opost onlcr final flags:    19200 hupcl sane autobaud:       no nextlabel:      conttyH hydrogen# 

    Team-Fly    
    Top
     



    Solaris Operating Environment Boot Camp
    Solaris Operating Environment Boot Camp
    ISBN: 0130342874
    EAN: 2147483647
    Year: 2002
    Pages: 301

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net