COHERENT manpages

This page displays the COHERENT manpage for modem [Technical Information].

List of available manpages
Index


modem -- Technical Information

The word  modem is an abbreviation  for ``modulation/demodulation device''.
With the COHERENT system, you can attach a modem to your computer either to
dial out  for remote communication,  to let others dial  into your COHERENT
system,  or  both.  With  your  modem,  too, you  can  use COHERENT's  UUCP
commands to exchange mail and files with remote sites automatically, and to
download news and files from networks.

This article gives a summary of how to connect your modem to your computer,
describe it to the COHERENT system, and set it up for UUCP connections.  It
also discusses some problems that may  crop up when you attempt to use your
modem.

Internal vs. External Modems

You can use  internal and external modems with COHERENT.   You must plug an
external modem into  a serial port on your system,  whereas you must jumper
an internal modem to use one  of your system's COM ports.  Be sure to use a
COM port that is not already  used on your system, or problems will result.
See  the Lexicon  entry for  asy for  details on  how COHERENT  handles COM
ports.

It is  more difficult to  diagnose problems with an  internal modem because
you have  no status lights  to indicate operation;  otherwise, they operate
almost identically.  The rest of  this article assumes that you are working
with an external modem.

Plugging in an External Modem

A modem must be hooked up  to a serial port on your computer.  To plug your
modem into  the computer, simply take a normal  serial-port cable, one with
an RS-232  plug of the  appropriate gender at  each end, plug  one end into
your modem and the other into the serial port you wish to use.  The Lexicon
article RS-232  describes the wiring of  the RS-232 plug in  detail; but if
you are not  skilled with a soldering iron, you  are well advised simply to
purchase a cable from your local electronics store and be done with it.

Serial Ports

The COHERENT system supports up to four serial ports; the devices for these
are named /dev/com1r through /dev/com4r. If you are not sure which port you
have plugged  your modem into,  perform the following test:  First, turn on
the modem.  Then, type the following command:

    echo FOO >/dev/com1l

If the  TX light on  the modem blinks,  then you know the  modem is plugged
into com1. If it does not,  try the command again for /dev/com2l, and so on
through com4l  until you find  the appropriate port.  If  no command works,
check the  wiring on your cable  and make sure that  the plugs are securely
inserted.

Edit /etc/ttys

If you intend to use your  modem with UUCP, you must edit file /etc/ttys to
tell COHERENT  how you want it  to handle that serial  port.  You must know
(1) whether you want the port enabled or disabled; (2) the baud rate of the
port (as set  by your modem); and (3) the  name of the port (which you just
determined).

If a  port is enabled, remote  users can log into the  system, either via a
terminal directly plugged  into the port or via a  modem.  COHERENT sends a
login prompt  to every  enabled port.   The COHERENT system  also restricts
permissions on  all enabled serial  ports, so that only  the superuser root
can read and write to the port.  This prevents other users who may be using
the system from accessing the serial  port.  If a port is disabled, you can
dial out  or use a  direct-connect UUCP connection via  that disabled port.
To dial out  on an enabled port, you must  first use the command disable to
disable  the port.   When you  have finished dialing  out, run  the command
enable to  re-enable the port.  (Note that  UUCP automatically disables and
re-enables a  port when it dials  out to poll a  remote system.) Before you
can use these commands with a port, the port must first be described in the
file /etc/ttys.

See the Lexicon article on ttys for details on how to edit this file.  Note
that a modem is a remote  device, and must be so described in /etc/ttys, or
it will not work correctly.

After you have made your changes, type the command

    kill quit 1

to make COHERENT re-read /etc/ttys and implement your changes.

Remote-Access Passwords

If you intend  to let people dial into your  computer, you are well advised
to set the remote-access password.   This will require that people who dial
in know a special password  in addition to whatever password their personal
account may have.

If you wish, you can set  a different remote-access password for each group
of users who log into your system, as organized by the program invoked upon
logging in.  For example, you can give one password to the users who log in
and  invoke  uucico; and  another  to the  users  who log  in  and use  the
interactive  shells ksh  or sh.  For  details on  how to  do this,  see the
Lexicon entries for d_passwd and dialups.

Edit /usr/lib/uucp/dial

Once  you  have  edited  file  /etc/ttys  and have  set  the  remote-access
password,  check  the  file  /usr/lib/uucp/dial  and  see  if  it  holds  a
description that  matches your modem.  The commands cu  and uucico read the
descriptions  in dial  to control  how they talk  to modems.   dial already
contains descriptions for many commonly  used modems; but you may find that
you must edit an existing entry to match your modem's features exactly; for
example, the existing entry may assume that you have a Touch-Tone telephone
whereas you  actually have  a pulse telephone.   The Lexicon entry  on dial
will walk you through this process.

When you  have completed editing  this entry, write  it down, for  you will
need to insert it elsewhere.

Edit Port

If you intend to use your  modem with UUCP, you must insert an entry for it
into  your  the  file  /usr/lib/uucp/port.  This  file links  a  modem,  as
described in  file /usr/lib/uucp/dial,  with a  port on your  system.  This
arrangement permits UUCP to use  one description with several modems of the
same type, each plugged into a different port.

See the Lexicon entry port for details.

Walking Through UUCP Configuration

The following  description walks you  through the task  of configuring your
modem to handle UUCP.  It is  adapted from a posting to comp.os.coherent by
Rob Schofield (schofld@mebv.mhs.compuserve.com).

First, decide whether you  want outsiders (including outside UUCP sites) to
log  into your  COHERENT system.   If  you do,  then you  must add  to file
/etc/ttys the  name the  incoming device  -- that is,  the device  that the
remote users will log into.  If you do not want incoming logins, you do not
need to have  an incoming device installed in /etc/ttys  and you can safely
omit it.

As described  above, an entry in /etc/ttys  consists of three one-character
fields, followed by the name of the device:

-> The first field indicates whether the device is enabled (that is, gets a
   login prompt) or disabled (that is, does not get a login prompt).

-> The  second field  indicates whether  the device is  in ``raw''  mode or
   whether it  ``cooks'' its input (that  is, handles backspaces correctly,
   and so on).  You should use `l' (for cooked input).

-> The  third field  gives the  speed of  the port;  see the  Lexicon entry
   /etc/ttys for a list of recognized codes.

-> The device has the name /dev/com?r.  The `?' in this name stands for the
   number of the COM port into which you've plugged your modem, from `1' to
   `4'.  The `r' in the device name stands for the ``remote'' (i.e., modem)
   device.  If your modem is high  speed (i.e., faster than 9600 baud) then
   use  the  hardware-handshaking  version  of  the  remote  device  (i.e.,
   /dev/com?fr).

For example, if you have plugged  a 14.4-kilobaud modem into serial port 3,
insert the following line into file /etc/ttys:

    1lQcom3fr

Once you have inserted this line into /etc/ttys, type the command:

    kill quit 1

This forces COHERENT to re-read /etc/ttys and so recognize your change.

If you wish to dial out on your modem via programs cu or ckermit, or if you
wish to have your UUCP system  dial other, remote sites, those systems must
use the local  /dev/com?l on the same port number  as your modem.  If it is
high speed,  again use the `f' version  /dev/com?fl, which enables hardware
handshaking.  This sounds may sound strange (after all, why use a terminal-
type device  on a modem?), but  there's a reason for it.   When you use the
UNIX or COHERENT system call open() on a com?r port, the function call does
not return until it detects a ``true'' value on DCD -- and that occurs only
when someone has dialed in and the modems have connected.  By using a com?r
device, you  are only setting up  the system for a  getty to detect someone
dialing in; if you're dialing out, you do not need to detect DCD, hence the
use of a terminal device.  Hence,  cu, UUCP, and ckermit should all be used
with the outgoing port device, and not the incoming.

Do not  add this  port to  /etc/ttys; rather, add  it to  the configuration
files used  by the applications.  In  the case of ckermit,  use its command
set  speed. You  can type  this  command either  by hand,  when you  invoke
ckermit; or  you can add  it to file  .kermrc in your  home directory.  For
details, see the Lexicon entry for ckermit. In the case of cu and UUCP, the
device must  be named in the file /usr/lib/uucp/port.  For example, to dial
out via our 14.4-kilobaud modem plugged into COM 3, add the following entry
to /usr/lib/uucp/port:

    port exampleport
    type modem
    device /dev/com3fl
    baud 19200
    dialer exampledialer

The  device  is  /dev/com3fl,  not  the  device  /dev/com3fr  we  added  to
/etc/ttys. The  `r' version of a  port is used exclusively  for dialing in;
the `l' version for dialing out.

Last little  trick is to link  the device you are using  to a pseudo device
used by a few communication packages:

    ln -f /dev/com?fl /dev/modem

Be sure to substitute the number of the port you're using (from `1' through
`4') for the `?' in the above example.

Modem Maladies

This  section discusses  problems that  have arisen  with remote  login via
modem,  as  diagnosed  by the  technical  support  staff  of Mark  Williams
Company.

Difficulty in logging in from a  remote site via modem can be the result of
problems in  one or more of the  following: cabling; enabling/disabling the
port; flaws  in the contents of file  /etc/ttys; incorrect configuration of
the  modem;  and setting  the  port  to an  incorrect  state.  See  Lexicon
articles  terminal  and UUCP  for  additional  information.  The  following
paragraphs discuss the above-named items in detail.

RS-232 Cabling
     When attaching an external modem  to your computer, it is important to
     use  a modem  cable that  supports  ``full modem  control''.  COHERENT
     relies  on modem-control  signals when  operating  a modem  for remote
     access purposes.  When attaching a terminal directly to a serial port,
     a  ``null modem''  cable  must be  used.   When attaching  a modem,  a
     ``straight through'' cable  must be used.  See Lexicon articles RS-232
     and terminal for further details on cabling.

Enabled vs. Disabled Ports
     A serial  port can  be either enabled  or disabled for  remote access.
     Enabling a  port allows a  user on a  remote terminal or  modem to log
     into your  COHERENT system.  Disabling  a port permits a  user to dial
     out or use a direct connect UUCP connection via that disabled port.

     If a  port is enabled  for remote logins  and you will use  it to call
     out, you must  use the command disable to disable  the port before you
     access the port.  UUCP automatically disables and re-enables a port.

     The port  name supplied to  an enable or disable  command must exactly
     match the last part of a  line in the /etc/ttys file (see below).  For
     example, for the command enable com2pr to work, there must be an entry
     in the file /etc/ttys which ends with com2pr.

     When  a port  is enabled,  the first  character for  the port  in file
     /etc/ttys is  set to  a `1'  (one), the permissions  for the  port are
     changed so that only the superuser root can read and write to the port
     (to prevent other users on the  system from accessing the port while a
     remote session  is in  progress), and  a login prompt  is sent  to the
     port.

ttys Problems
     This file  should have permissions  of 644 (-rw-r--r--)  and belong to
     owner and group root. Review the Lexicon entry for ttys to ensure that
     the format of your version of /etc/ttys is correct.

     Leaving blanks  at the end of  a line in /etc/ttys  usually results in
     error messages stating that a device could not be found.

     You  do  not  need to  edit  the  initial `0'  or  `1'  in entries  in
     /etc/ttys; this  digit is updated by the  commands enable and disable.
     See the Lexicon entries for enable and disable for more information.

Constant Flickering
     Another problem  is a constant flickering of  send/receive LEDs and an
     unexplained continual access of  the hard drive.  This occurs when the
     port is enabled and the modem  is set in echo mode: COHERENT sends the
     login  prompt to  the modem,  the  modem echoes  it back  to COHERENT,
     COHERENT then thinks  the modem is trying to talk  to it and sends the
     password prompt, and so on ad infinitum.

     To fix this  problem, place the modem into no-echo  mode, and turn off
     the display of result  codes.  The following section discusses this in
     more detail.

Modem Configuration

A modem that fails to answer an incoming call, hangs up before locking onto
the remote carrier,  becomes stuck in a loop echoing  characters sent to it
from the computer,  or fails to operate at the  expected baud rate probably
is configured  improperly.  To remedy this  situation, send the appropriate
control string to the modem.

We offer some guidelines here for modem settings.  Be warned, however, that
modems from different  manufacturers usually behave differently, regardless
of claims of Hayes compatibility: you must check the manual for your modem.

-> Echo should be OFF (usually by setting ``E0'').

-> Result codes should be OFF (usually by setting ``Q1'').

-> Modem status  ``DCD'' should follow  true carrier detect  status, rather
   than being always on (usually by setting ``&C1'').

-> Auto answer should  be ON (usually obtained by setting  register S0 to a
   nonzero value equal to the number of rings before answer).

-> The delay value for ``Wait for Carrier/Dial Tone'' (usually register S7)
   should not be too short.

The scripts  below show  typical initialization for  a ``Hayes-compatible''
modem that  runs at 2400  baud and is  plugged into port  /dev/com3r. It is
only an example; your modem may need something different.  Please note that
the commands sleep and stty are  necessary in the first example so that the
command  string will  be sent  to the  modem at  2400 baud;  otherwise, the
string is sent at the default port speed, which is 9600 baud.

    # initialize 2400-baud Hayes-compatible modem
    sleep 3 > /dev/com3l &
    stty 2400 < /dev/com3l
    echo 'AT E0 Q1 V0 S0=1 &C1 M3' > /dev/com3l
    sleep 3

The following gives  a similar script for a Trailblazer  modem that runs at
9600 baud and is plugged into port /dev/com2r:

    # initialize 9600 baud internal Trailblazer on com2
    /etc/disable com2r
    sleep 3 > /dev/com2l &
    stty 9600 < /dev/com2l
    echo 'AT E0 T V0 X3 H0' > /dev/com2l
    echo 'AT S0=1 S7=60 S48=1 S51=252 S52=0 S54=3 S58=2' > /dev/com2l
    /etc/enable com2r

Modem Control

This section  describes the modem-control protocol used  by the driver asy,
which COHERENT  uses to control serial ports.   Modem control describes how
COHERENT handles RS-232  signals other than ``Receive Data'' and ``Transmit
Data''.

Many processes can open a device  at the same time.  First open occurs if a
process opens a  device when no process has opened  the device.  Last close
occurs when  a process closes the  port and no other  remaining process has
the port  open.  On first open,  RTS and DTR are  asserted by the computer,
regardless of  whether the specified  device used modem  control.  If modem
control is  used (the high-order bit  in minor number set  to zero), open()
does not complete until CD is  true.  Once an al[01] device has been opened
with modem control, loss of CD to that port causes SIGHUP to be sent to all
processes in the group keeping the port open.

See Also

Administering COHERENT,
dial,
RS-232,
terminal,
UUCP

Notes

One final  bit of hard-won  wisdom: once you have  something working, write
down what you did, and store it in a place where you won't lose it.