mmooddeemm -- Technical Information

The word  _m_o_d_e_m 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.

_I_n_t_e_r_n_a_l _v_s. _E_x_t_e_r_n_a_l _M_o_d_e_m_s
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  aassyy 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.

_P_l_u_g_g_i_n_g _i_n _a_n _E_x_t_e_r_n_a_l _M_o_d_e_m
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 RRSS-223322  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.

_S_e_r_i_a_l _P_o_r_t_s
The COHERENT system supports up to four serial ports; the devices for these
are named /ddeevv/ccoomm11rr through /ddeevv/ccoomm44rr. 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  TTXX light on  the modem blinks,  then you know the  modem is plugged
into ccoomm11. If it does not,  try the command again for /ddeevv/ccoomm22ll, and so on
through ccoomm44ll  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.

Some  communications  programs (e.g.,  cckkeerrmmiitt)  use  device /ddeevv/mmooddeemm  by
default.  Therefore,  you should link the port into  which you have plugged
your modem to /ddeevv/mmooddeemm. To do so, use the following command:

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

where ? gives the number of the port, 1 through 4.

_E_d_i_t /_e_t_c/_t_t_y_s
If you intend to use your  modem with UUCP, you must edit file /eettcc/ttttyyss 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 rroooott
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 ddiissaabbllee to
disable  the port.   When you  have finished dialing  out, run  the command
eennaabbllee 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 /eettcc/ttttyyss.

See the Lexicon article on ttttyyss for details on how to edit this file.  Note
that a modem is a remote  device, and must be so described in /eettcc/ttttyyss, or
it will not work correctly.

After you have made your changes, type the command

    kill quit 1

to make COHERENT re-read /eettcc/ttttyyss and implement your changes.

_R_e_m_o_t_e-_A_c_c_e_s_s _P_a_s_s_w_o_r_d_s
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  uuuucciiccoo; and  another  to the  users  who log  in  and use  the
interactive  shells kksshh  or sshh.  For  details on  how to  do this,  see the
Lexicon entries for dd_ppaasssswwdd and ddiiaalluuppss.

_E_d_i_t /_u_s_r/_l_i_b/_u_u_c_p/_d_i_a_l
Once  you  have  edited  file  /eettcc/ttttyyss  and have  set  the  remote-access
password,  check  the  file  /uussrr/lliibb/uuuuccpp/ddiiaall  and  see  if  it  holds  a
description that  matches your modem.  The commands ccuu  and uuuucciiccoo read the
descriptions  in ddiiaall  to control  how they talk  to modems.   ddiiaall 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 ddiiaall
will walk you through this process.

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

_E_d_i_t _P_o_r_t
If you intend to use your  modem with UUCP, you must insert an entry for it
into  your  the  file  /uussrr/lliibb/uuuuccpp/ppoorrtt.  This  file links  a  modem,  as
described in  file /uussrr/lliibb/uuuuccpp/ddiiaall,  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 ppoorrtt for details.

_M_o_d_e_m _M_a_l_a_d_i_e_s
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  /eettcc/ttttyyss; incorrect configuration of
the  modem;  and setting  the  port  to an  incorrect  state.  See  Lexicon
articles  tteerrmmiinnaall  and UUUUCCPP  for  additional  information.  The  following
paragraphs discuss the above-named items in detail.

_R_S-_2_3_2 _C_a_b_l_i_n_g
     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 RRSS-223322
     and tteerrmmiinnaall for further details on cabling.

_E_n_a_b_l_e_d _v_s. _D_i_s_a_b_l_e_d _P_o_r_t_s
     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 ddiissaabbllee to disable  the port before you
     access the port.  UUCP automatically disables and re-enables a port.

     The port  name supplied to  an eennaabbllee or ddiissaabbllee  command must _e_x_a_c_t_l_y
     match the last part of a  line in the /eettcc/ttttyyss file (see below).  For
     example, for the command eennaabbllee ccoomm22pprr to work, there must be an entry
     in the file /eettcc/ttttyyss which ends with ccoomm22pprr.

     When  a port  is enabled,  the first  character for  the port  in file
     /eettcc/ttttyyss is  set to  a `1'  (one), the permissions  for the  port are
     changed so that only the superuser rroooott 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.

ttttyyss _P_r_o_b_l_e_m_s
     This file  should have permissions  of 644 (-rw-r--r--)  and belong to
     owner and group rroooott. Review the Lexicon entry for ttttyyss to ensure that
     the format of your version of /eettcc/ttttyyss is correct.

     Leaving blanks  at the end of  a line in /eettcc/ttttyyss  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
     /eettcc/ttttyyss; this  digit is updated by the  commands eennaabbllee and ddiissaabbllee.
     See the Lexicon entries for eennaabbllee and ddiissaabbllee for more information.

_C_o_n_s_t_a_n_t _F_l_i_c_k_e_r_i_n_g
     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 _a_d _i_n_f_i_n_i_t_u_m.

     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.

_M_o_d_e_m _C_o_n_f_i_g_u_r_a_t_i_o_n
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  /ddeevv/ccoomm33rr. It is
only an example; your modem may need something different.  Please note that
the commands sslleeeepp and ssttttyy 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 /ddeevv/ccoomm22rr:

    # 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
    enable com2l

_M_o_d_e_m _C_o_n_t_r_o_l
This section  describes the modem-control protocol used  by the driver aassyy,
which COHERENT  uses to control serial ports.   _M_o_d_e_m _c_o_n_t_r_o_l describes how
COHERENT handles RS-232  signals other than ``Receive Data'' and ``Transmit
Data''.

Many processes can open a device  at the same time.  _F_i_r_s_t _o_p_e_n occurs if a
process opens a  device when no process has opened  the device.  _L_a_s_t _c_l_o_s_e
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), ooppeenn()
does not complete until CD is  true.  Once an aall[0011] device has been opened
with modem control, loss of CD to that port causes SSIIGGHHUUPP to be sent to all
processes in the group keeping the port open.

_S_e_e _A_l_s_o
AAddmmiinniisstteerriinngg CCOOHHEERREENNTT, ddiiaall, RRSS-223322, tteerrmmiinnaall, UUUUCCPP

_N_o_t_e_s
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.
