SUMMARY: Solaris modem/terminal how-to: Rev 9.13.93

From: Celeste Stokely (celeste@xs.com)
Date: Mon Sep 13 1993 - 21:42:24 CDT


I've updated the Solaris 2.x Bidirectional Modem/Terminal setup to
include detail more about the stty settings in /etc/ttydefs, how to set it for
8bits, initial-flags, final-flags. See Appendix D.

Hope this helps someone!

..Celeste Stokely
Unix Systems Administration Consultant, Stokely Consulting
EMAIL: celeste@xs.com / Voice: 415-917-7893
USMAIL Address: Stokely Consulting
                211 Thompson Square / Mountain View CA 94043
--------------------------------------------------------------------------
Sep 13 13:16 1993 Setting up Terminals and Modems under Solaris 2.x Page 1

        Configuring Terminals and Modems under Solaris 2.x
        ==================================================

A. Setting up a terminal with Solaris 2.x

*********************************************************************
*** IMPORTANT NOTES: ***
*** 1. All single quotes in these directions are BACK QUOTES, ***
*** not FORWARD QUOTES, except where specifically noted. ***
*** ***
*** 2. Be sure and execute these commands as root, from a ***
*** BOURNE shell (sh), not ksh, tcsh, or csh. ***
*** ***
*** 3. If, after following these instructions, you get ***
*** terminal failures, then make sure ***
*** that root's default shell is /sbin/sh and not csh ***
*** Logging in as a csh-using user and doing an su to root ***
*** with a password-file shell of sh is not good enough. ***
*** You must login as root, and root's default shell must be ***
*** the Bourne shell. ***
*********************************************************************

A.1 BEFORE YOU BEGIN: SET UP THE TERMINAL
        - Set the terminal for the speed you wish (example below
          assumes you are using 9600 baud)
        - The only lines you really need in the terminal-to-Sun cable
          are 2, 3, and 7. Be sure to cross lines 2 and 3 in your cable.
        - Set the terminal for Xon/Xoff flow control
        - Set the terminal for 7 bits, Even Parity. (1 stop bit, if
          you have that setting.)

A.2 ENABLING SOLARIS FOR A TERMINAL:
        - Save the following script as add_terminal
        - make it executable with "chmod u+x add_terminal"
        - Edit add_terminal to meet your particular needs
        - Execute add_terminal
        - If the terminal doesn't give you a log when you hit <return>
          try rebooting the machine once.

Sep 13 13:16 1993 Setting up Terminals and Modems under Solaris 2.x Page 2

#!/bin/sh
#
##########################################################################
# add_terminal shell script. Must be run as root from bourne shell
# Change these parameters as needed for your particular needs.
# PARAMETER MEANING
# --------- -------
# -s ttya terminal is on ttya. you may want ttyb
# -d /dev/term/a actual port device. you may want /dev/term/b
# -l 9600E speed/stty setting from /etc/ttydefs. choose an
# entry that meets your needs
# -T tvi925 your default terminal type for this port. This
# is a terminfo terminal type
# -i 'terminal disabled' message sent to the tty port if the port is
# ever disabled
# QUOTE-ALERT: The single quotes the port-disabled message are
# FORWARD QUOTES
##########################################################################
# Remove any existing port monitor on ttya
# (Change the "ttya" to "ttyb" if that's the port you're dealing with)
#
pmadm -r -p zsmon -s ttya
#
# Create the new port monitor
#
# QUOTE-ALERT: The single quotes the port-disabled message are
# FORWARD QUOTES
pmadm -a -p zsmon -s ttya -i root -fu -v 1 -m "`ttyadm -l 9600E \
-d /dev/term/a -T tvi925 -i 'terminal disabled' -s /usr/bin/login -S y`"

Sep 13 13:16 1993 Setting up Terminals and Modems under Solaris 2.x Page 3

B. Setting Up a Bidirectional Modem with Solaris 2.x
====================================================

B.1 BEFORE YOU BEGIN: SET UP THE MODEM
  Be sure that the modem is configured for the following:

    - Hardware DTR, that is, when the Sun drops DTR the modem should hang up
        and reset the modem.
    - Hardware Carrier Detect, that is, the modem only raises the CD line when
      there is an active carrier signal on the phone connection, when carrier
      drops, either when the other end of the connection terminated or in
      the event the phone connection is broken, the Sun will be notified and
      act appropriately. The CD signal is also used for coordinating dial-in
      and dial-out use on a single serial port and modem.
    - Respond with numeric result codes. (Usually this is ATV0)
    - Sends BASIC result codes ONLY. (Sometimes this is ATX0 or ATQ0)
    - Does not echo commands. (Usually this is ATE0)
    - Modem is locked at a single speed setting between Sun and modem.
        Speed may vary as needed between local and remote modem, but
        should remain constant between Sun and modem.

B.2 ENABLING SOLARIS FOR A BIDIRECTIONAL MODEM

*********************************************************************
*** IMPORTANT NOTES: ***
*** 1. All single quotes in these directions are BACK QUOTES, ***
*** not FORWARD QUOTES, except where specifically noted. ***
*** ***
*** 2. Be sure and execute these commands as root, from a ***
*** BOURNE shell (sh), not ksh, tcsh, or csh. ***
*** ***
*** 3. If, after following these instructions, you get ***
*** modem failures, or if step #7 gives an error message ***
*** about "ttyadm: -V: invalid parameter", then make sure ***
*** that root's default shell is /sbin/sh and not csh ***
*** Logging in as a csh-using user and doing an su to root ***
*** with a password-file shell of sh is not good enough. ***
*** You must login as root, and root's default shell must be ***
*** the Bourne shell. ***
*********************************************************************

1. Login as root and type:
        prompt# eeprom ttya-ignore-cd=true <carriage return>
        prompt# eeprom ttya-rts-dtr-off=true <carriage return>
>> go to step 2

2. Reboot the system by typing:
        prompt# init 6
>> Go to step 3

3. Make sure the modem is properly connected and configured.
   Make sure the cable is ok.
>> Go to step 4

Sep 13 13:16 1993 Setting up Terminals and Modems under Solaris 2.x Page 4

4. Is zsmon configured and running?
   (The following instructions assume that the modem cable to serial port A.)
   Login as root and type:
        prompt# sacadm -l -t ttymon

   If you get a message like:
      "Invalid request, zsmon does not exist"
      then the zsmon port monitor is not configured.
>> Go to step 5

   If you get a result like:
       PMTAG PMTYPE FLGS RCNT STATUS COMMAND
       zsmon ttymon - 0 ENABLED /usr/lib/saf/ttymon
>> Go to step 6

5. To configure the zsmon port monitor

      prompt# sacadm -a -p zsmon -t ttymon -c /usr/lib/saf/ttymon \
              -v `ttyadm -V` -y "dial in/out on serial port a"

      (Note: zsmon = PMTAG
             "dial in/out on serial port a" = "any comment")
>> Go to step 6

6. Is ttymon configured and running?
   Type:
      prompt# pmadm -l -s ttya (where ttya is the SVCTAG)

   a) If there is no service, you will get a result like: the
   
           Service <a> does not exist.
>> Go to step 7.

   b) If you got a result like:

      PMTAG PMTYPE SVCTAG FLGS ID <PMSPECIFIC>
      zsmon ttymon ttya u root /dev/term/a I - /

      Then you need to remove the existing service by typing:
            prompt# pmadm -r -p zsmon -s ttya
                                 ^ ^
                                 | |
                               (PMTAG) (SVCTAG)
>> Go to step 7.

Sep 13 13:16 1993 Setting up Terminals and Modems under Solaris 2.x Page 5

7. Create a new bidirectional port service. Type:

     prompt# # pmadm -a -p zsmon -s ttya -i root -v `ttyadm -V` -fu -m \
   "`ttyadm -d /dev/term/a -s /usr/bin/login -l contty5H -b -S n -m \
   ldterm,ttcompat`" -y "dial in/out on serial port a"

>> Go to step 8.

   (NOTE: zsmon = PMTAG
          ttya = SVCTAG
          /dev/term/a = <PMSPECIFIC>
          contty5H - ttylabel, defined in /etc/ttydefs file (speed setting.
                contty5H=19200 baud. see ttydefs for other baud rates)
          -b flag for bi-directional port use
          -S n to turn software carrier off
          "dial in/out on serial port a" - "any comment")

8. TIP and /etc/remote

    Edit /etc/remote and find the entry beginning with "hardwire:". Change
    the portion which says:
        :dv=/dev/??????:
    to read
        :dv=/dev/cua/a: (or /dev/cua/b if you're using the B port)

    Change the portion which says:
        :br#somenumber:
    to read
        :br#9600: (or 19200, or whatever baud rate you plan to use)
>> Go to step 9

9. Type:
   prompt# tip hardwire
               you should see "connected"
   type:
      ATE1V1<carriage return>
               you should see "OK"
>> Go to step 10
   If you don't see "OK", you are not communicating with the modem.
   See if the modem is plugged in, verify the baud rate of the modem
   and the hardwire entry in /etc/remote, verify the modem cable.

10. Test the dialin
    Test your modem setup by dialing into the Solaris 2.x machine. If
    you get logged in, congratulate yourself!
>> Go to step 11

11. Further setup for using the modem
    At this point, you have established basic outgoing computer-to-modem
    setup. If you plan to use uucp, then start setting up the /etc/uucp
    files. (This is left as an exercise for the reader.)
    If you are interested in more ways to use tip with your modem, see
    Section C of this document.
>> Go To Section C

Sep 13 13:16 1993 Setting up Terminals and Modems under Solaris 2.x Page 6

C. More on tip and /etc/remote
==============================
1. The cuaa entry (below) allows you to type "tip cuaa" and talk
directly to a modem on port a at 2400 baud.

2. "tip phonenumber" will look for the tip0 entry and use that
definition. (In the example below, it will use tip0, which points to
UNIX-2400, which sets up a dialup 2400 baud hayes-compatible modem.
UNIX-2400 points to dialers, which references /dev/cua/a.

3. "tip mysystem" (below) looks up the "mysystem" entry, and dials the
number 14155551212 via a 19200 baud connection on /dev/cua/a.

The following sample file is set up for
        port a, 2400 baud hayes-compatible modem
        port b, 9600 baud modem, may or may not be hayes compatible

/etc/remote:
============

cuaa:dv=/dev/cua/a:br#2400
mysystem:pn=14155551212:tc=UNIX-19200:
hardwire:\
        :dv=/dev/cua/b:br#9600:el=^C^S^Q^U^D:ie=%$:oe=^D:
tip1200:tc=UNIX-1200:
tip0|tip2400:tc=UNIX-2400:
tip9600:tc=UNIX-9600:
tip19200:tc=UNIX-19200:
cu1200:tc=UNIX-1200:
cu0|cu2400:tc=UNIX-2400:
UNIX-1200:\
        :el=^D^U^C^S^Q^O@:du:at=hayes:ie=#$%:oe=^D:br#1200:tc=dialers:
UNIX-2400:\
        :el=^D^U^C^S^Q^O@:du:at=hayes:ie=#$%:oe=^D:br#2400:tc=dialers:
UNIX-9600:\
        :el=^D^U^C^S^Q^O@:du:at=hayes:ie=#$%:oe=^D:br#9600:tc=dialers:
UNIX-19200:\
        :el=^D^U^C^S^Q^O@:du:at=hayes:ie=#$%:oe=^D:br#19200:tc=dialers:
dialers:\
        :dv=/dev/cua/a:
--------------------------------------------------------------------
The attributes are:
dv device to use for the tty
du make a call flag (dial up)
pn phone numbers (@ =>'s search phones file; possibly taken from
                              PHONES environment variable)
at ACU type
ie input EOF marks (default is NULL)
oe output EOF string (default is NULL)
cu call unit (default is dv)
br baud rate (defaults to 300)
tc to continue a capability

Sep 13 13:16 1993 Setting up Terminals and Modems under Solaris 2.x Page 7

D. Setting other serial port modes
==================================
Serial port modes (the terminal I/O options found in stty(1) ) are set in the
file /etc/ttydefs. The name of the serial port mode (like contty5H) is used
as the argument to the "-l" option in the "ttyadm" portion of the "pmadm
-a" command. (This is the "speed" setting you use when you add a new port
monitor.) See the stty man page for all the available terminal I/O options.

The format of the entries in ttydefs is defined as:

   ttylabel:initial-flags:final-flags:autobaud:nextlabel

   ttylabel The string ttymon tries to match against the TTY port's
                ttylabel field in the port monitor administrative file.
                It often describes the speed at which the terminal is
                supposed to run, for example, 1200.

  initial-flags Contains the initial termio(7) settings to which the
                terminal is to be set. For example, the system administrator
                will be able to specify what the default erase and kill
                characters will be. initial-flags must be specified inthe
                syntax recognized by the stty command.

   final-flags final-flags must be specified in the same format as
                initial-flags. ttymon sets these final settings after a
                connection request has been made and immediately prior to
                invoking a port's service.

   autobaud If the autobaud field contains the character `A', autobaud
                will be enabled. Otherwise, autobaud will be disabled.
                ttymon determines what line speed to set the TTY port to by
                analyzing the carriage returns entered. If autobaud has been
                disabled, the hunt sequence is used for baud rate determination.
 
   nextlabel If the user indicates that the current terminal setting is
                not appropriate by sending a BREAK, ttymon searchs for a
                ttydefs entry whose ttylabel field matches the nextlabel field.
                If a match is found, ttymon uses 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.

 WARNING: These stty modes are processed from left to right within each set
 of "initial-flags" or "final-flags". So, the order of the modes in each
 entry is significant.

 In particular, when setting the mode to 8bits, do NOT enter it as
 ".... -parity ... sane", but as "... sane... -parity" because "sane" sets the
 port to 7 bits.

Sep 13 13:16 1993 Setting up Terminals and Modems under Solaris 2.x Page 8

/etc/ttydefs examples:
=====================

1. contty5H, as supplied by Sun, is 19200 bps, 7 bits even parity
        contty5H:19200 opost onlcr:19200 hupcl sane::conttyH

   This is equivalent to:
        contty5H:19200 evenp opost onlcr:19200 sane evenp hupcl::conttyH
             or
        contty5H:19200 parenb -parodd opost onlcr:19200 sane parenb -parodd \
        hupcl::conttyH

2. Change contty5H to "7 bits, no parity" (-parenb)
        contty5H:19200 -parenb opost onlcr:19200 sane -parenb hupcl::conttyH

3. Change contty5H to "8 bits, no parity" (-parenb cs8, or -parity)
  contty5H:19200 -parenb cs8 opost onlcr:19200 sane -parenb cs8 hupcl::conttyH
           or
  contty5H:19200 -parity opost onlcr:19200 sane -parity hupcl::conttyH

4. Change contty5H to "7bits, odd parity" (parenb parodd, or oddp)
        contty5H:19200 parenb parodd opost onlcr:19200 sane parenb parodd \
        hupcl::conttyH
           or
        contty5H:19200 oddp opost onlcr:19200 sane oddp hupcl::conttyH

[This doc is revision 9/13/93]



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:08:10 CDT