.TH modem "" "" "Technical Information"
.PC
.PP
.II "modem^adding"
.II "adding a modem"
.II "remote communication"
.II UUCP
The word
.I modem
is an abbreviation for ``modulation/demodulation device''.
With the \*(CO system, you can attach a modem to your computer either
to dial out for remote communication, to let others dial into your
\*(CO system, or both.
With your modem, too, you can use \*(CO's \*(UU commands to exchange
mail and files with remote sites automatically, and to download news and
files from networks.
.PP
This article gives a summary of how to connect your modem to your computer,
describe it to the \*(CO system, and set it up for \*(UU connections.
It also discusses some problems that may crop up when you attempt to use
your modem.
.SH "Internal vs. External Modems"
You can use internal and external modems with \*(CO.
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
.B asy
for details on how \*(CO handles COM ports.
.PP
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.
.SH "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
.B 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.
.SH "Serial Ports"
The \*(CO system supports up to four serial ports; the devices for
these are named
.B /dev/com1r
through
.BR /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:
.DM
	echo FOO >/dev/com1l
.DE
.PP
If the \fBTX\fR light on the modem blinks,
then you know the modem is plugged into
.BR com1 .
If it does not, try the command again for
.BR /dev/com2l ,
and so on through
.B 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.
.\".PP
.\"Some communications programs (e.g., \fBckermit\fR) use device
.\".B /dev/modem
.\"by default.
.\"Therefore, you should link the port into which you have plugged your
.\"modem to
.\".BR /dev/modem .
.\"To do so, use the following command:
.\".DM
.\"	ln -f /dev/com\fI?\fPl /dev/modem
.\".DE
.\".PP
.\"where \fI?\fR gives the number of the port, 1 through 4.
.SH "Edit /etc/ttys"
If you intend to use your modem with \*(UU, you must edit file
.B /etc/ttys
to tell \*(CO 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).
.PP
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.
\*(CO sends a login prompt to every enabled port.
The \*(CO system also restricts permissions on all enabled serial ports,
so that only the superuser
.B 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 \*(UU connection via that disabled port.
To dial out on an enabled port, you must first use the command
.B disable
to disable the port.
When you have finished dialing out, run the command
.B enable
to re-enable the port.
(Note that \*(UU 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
.BR /etc/ttys .
.PP
See the Lexicon article on
.B ttys
for details on how to edit this file.
Note that a modem is a remote device, and must be so described in
.BR /etc/ttys ,
or it will not work correctly.
.PP
After you have made your changes, type the command
.DM
	kill quit 1
.DE
.PP
to make \*(CO re-read
.B /etc/ttys
and implement your changes.
.SH "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.
.PP
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
.BR uucico ;
and another to the users who log in and use the interactive shells
.B ksh
or
.BR sh .
For details on how to do this, see the Lexicon entries for
.B d_passwd
and
.BR dialups .
.SH "Edit /usr/lib/uucp/dial"
Once you have edited file
.B /etc/ttys
and have set the remote-access password, check the file
.B /usr/lib/uucp/dial
and see if it holds a description that matches your modem.
The commands
.B cu
and
.B uucico
read the descriptions in
.B dial
to control how they talk to modems.
.B 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
.B dial
will walk you through this process.
.PP
When you have completed editing this entry, write it down, for you will need
to insert it elsewhere.
.\".SH "Edit /usr/bin/modeminit"
.\"Once you have found or created the \fBdial\fR entry for your modem,
.\"check the file
.\".BR /usr/bin/modeminit .
.\"When \*(CO boots,
.\"it uses this script to reinitialize one or more modems.
.\".PP
.\"You must decide how you want the modem to be re-initialized.
.\"If you wish to have people dial into your system, you turn on
.\"the modem's auto-answer feature; and you must turn off echoing and the
.\"printing of result codes.
.\"The commands to use will vary from modem to modem; see the documentation that
.\"comes with your modem for details.
.\"In most instances, you should use the string defined by the command
.\".B complete-chat
.\"in the
.\".B dial
.\"description for this modem.
.\"The section on \fBModem Configuration\fR, below, gives sample scripts
.\"for a 2400-baud, Hayes-compatible modem and for a 9600-baud Trailblazer modem.
.\".PP
.\"To ensure that your modem is initialized every time you start
.\"\*(CO, you should add a line saying
.\".DM
.\"	/usr/bin/modeminit
.\".DE
.\".PP
.\"to your copy of the file
.\".BR /etc/rc .
.\"Note that if are going to run a modem initialization script from with
.\".BR /etc/rc ,
.\"do
.\".I not
.\"invoke the
.\".B enable
.\"or
.\".B disable
.\"commands from within the initialization script.
.SH "Edit Port"
If you intend to use your modem with \*(UU,
you must insert an entry for it into your the file
.BR /usr/lib/uucp/port .
This file links a modem, as described in file
.BR /usr/lib/uucp/dial ,
with a port on your system.
This arrangement permits
\*(UU to use one description with several modems of the same type, each plugged
into a different port.
.PP
See the Lexicon entry
.B port
for details.
.SH "Walking Through UUCP Configuration"
The following description walks you through the task of
configuring your modem to handle \*(UU.
.II "Schofield, Robert"
It is adapted from a posting to
.B comp.os.coherent
by Rob Schofield (schofld@mebv.mhs.compuserve.com).
.PP
First, decide whether you want outsiders (including outside \*(UU sites)
to log into your \*(CO system.
If you do, then you must add to file
.B /etc/ttys
the name the incoming device \(em 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
.B /etc/ttys
and you can safely omit it.
.PP
As described above, an entry in
.B /etc/ttys
consists of three one-character fields, followed by the name of the device:
.IP \(bu 0.3i
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).
.IP \(bu
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).
.IP \(bu
The third field gives the speed of the port; see the Lexicon entry
.B /etc/ttys
for a list of recognized codes.
.IP \(bu
The device has the name
.BR /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.,
.BR /dev/com?fr ).
.PP
For example, if you have plugged a 14.4-kilobaud modem into serial port 3,
insert the following line into file
.BR /etc/ttys :
.DM
	1lQcom3fr
.DE
.PP
Once you have inserted this line into
.BR /etc/ttys ,
type the command:
.DM
	kill quit 1
.DE
.PP
This forces \*(CO to re-read
.B /etc/ttys
and so recognize your change.
.PP
If you wish to dial out on your modem
via programs
.B cu
or
.BR ckermit ,
or if you wish to have your \*(UU system dial other, remote sites,
those systems must use the
.I local
.B /dev/com?l
on the same port number as your modem.
If it is high speed, again use the `f' version
.BR /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 \*(UN or \*(CO system call
.B open()
on a
.B com?r
port, the function call does not return until it detects a ``true''
value on DCD \(em and that occurs only when someone has dialed in
and the modems have connected.
By using a
.B com?r
device, you are only setting up the system for a
.B 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,
.BR cu ,
\*(UU, and
.B ckermit
should all be used with the
outgoing port device, and not the incoming.
.PP
Do
.I not
add this port to
.BR /etc/ttys ;
rather, add it to the configuration files used by the applications.
In the case of
.BR ckermit ,
use its command
.BR "set speed" .
You can type this command either by hand, when you invoke
.BR ckermit ;
or you can add it to file
.B .kermrc
in your home directory.
For details, see the Lexicon entry for
.BR ckermit .
In the case of
.B cu
and \*(UU, the device must be named in the file
.BR /usr/lib/uucp/port .
For example, to dial out via our 14.4-kilobaud modem plugged into COM 3,
add the following entry to
.BR /usr/lib/uucp/port :
.DM
	port exampleport
	type modem
	device /dev/com3fl
	baud 19200
	dialer exampledialer
.DE
.PP
The device is
.BR /dev/com3fl ,
not the device
.B /dev/com3fr
we added to
.BR /etc/ttys .
The `r' version of a port is used exclusively for dialing in; the `l' version
for dialing out.
.PP
Last little trick is to link the device you are using to a pseudo
device used by a few communication packages:
.DM
	ln -f /dev/com?fl /dev/modem
.DE
.PP
Be sure to substitute the number of the port you're using (from `1' through
`4') for the `?' in the above example.
.SH "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.
.PP
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
.BR /etc/ttys ;
incorrect configuration of the modem;
and setting the port to an incorrect state.
See Lexicon articles
.B terminal
and
.B UUCP
for additional information.
The following paragraphs discuss the above-named items in detail.
.IP "\fIRS-232 Cabling\fR"
When attaching an external modem to your computer,
it is important to use a modem cable that supports ``full modem control''.
\*(CO 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
.B RS-232
and
.B terminal
for further details on cabling.
.IP "\fIEnabled vs. Disabled Ports\fR"
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 \*(CO system.
Disabling a port permits
a user to dial out or use a direct connect \*(UU connection
via that disabled port.
.sp \n(pDu
If a port is enabled for remote logins and you will use it to call out,
you must use the command
.B disable
to disable the port before you access the port.
\*(UU automatically disables and re-enables a port.
.sp \n(pDu
The port name supplied to an \fBenable\fP or \fBdisable\fP command must
\fIexactly\fR match the last part of a line in the
.B /etc/ttys
file (see below).
For example, for the command
.B "enable com2pr"
to work, there must be an entry in the file
.B /etc/ttys
which ends with
.BR com2pr .
.sp \n(pDu
When a port is enabled,
the first character for the port in file
.B /etc/ttys
is set to a `1' (one),
the permissions for the port are changed so that only the superuser
.B 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.
.IP "\fBttys\fI Problems\fR"
This file should have permissions of 644 (-rw-r--r--) and belong to owner
and group
.BR root .
Review the Lexicon entry for
.B ttys
to ensure that the format of your version of
.B /etc/ttys
is correct.
.sp \n(pDu
Leaving blanks at the end of a line in
.B /etc/ttys
usually results in error messages stating that a device could not be found.
.sp \n(pDu
You do not need to edit the initial `0' or `1' in entries in
.BR /etc/ttys ;
this digit is updated by the commands
.B enable
and
.BR disable .
See the Lexicon entries for
.B enable
and
.B disable
for more information.
.IP "\fIConstant Flickering\fR"
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:
\*(CO sends the login prompt to the modem, the modem echoes it back
to \*(CO, \*(CO then thinks the modem is trying to talk to it and
sends the password prompt, and so on \fIad infinitum\fR.
.sp \n(pDu
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.
.SH "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.
.PP
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.
.IP \(bu 0.3i
Echo should be OFF (usually by setting ``E0'').
.IP \(bu
Result codes should be OFF (usually by setting ``Q1'').
.IP \(bu
Modem status ``DCD'' should follow true carrier detect status, rather than
being always on (usually by setting ``&C1'').
.IP \(bu
Auto answer should be ON (usually obtained by setting register S0 to a
nonzero value equal to the number of rings before answer).
.IP \(bu
The delay value for ``Wait for Carrier/Dial Tone'' (usually register S7)
should not be too short.
.PP
The scripts below show typical initialization for a ``Hayes-compatible''
modem that runs at 2400 baud and is plugged into port
.BR /dev/com3r .
It is only an example; your modem may need something different.
Please note that the commands
.B sleep
and
.B 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.
.DM
.II "Hayes modem"
.II "modem^Hayes"
	# 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
.DE
.PP
The following gives a similar script for a Trailblazer modem that
runs at 9600 baud and is plugged into port
.BR /dev/com2r :
.DM
.II "Trailblazer modem"
.II "modem^Trailblazer"
	# 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
.DE
.SH "Modem Control"
This section describes the modem-control protocol used by the driver
.BR asy ,
which \*(CO uses to control serial ports.
.I "Modem control"
describes how \*(CO handles RS-232 signals other than
``Receive Data'' and ``Transmit Data''.
.PP
Many processes can open a device at the same time.
.I "First open"
occurs if a process opens a device when no process has opened the device.
.I "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),
.B open()
does not complete until CD is true.
Once an
.B al[01]
device has been opened with modem control,
loss of CD to that port causes
.B SIGHUP
to be sent to all processes in the group keeping the port open.
.\".SH "Using Trailblazer Modems With UUCP"
.\".II "modem^Trailblazer, with UUCP"
.\"The Trailblazer modem has been designed to be used with \*(UU.
.\"It is extremely fast and extremely accurate; however,
.\"some users reported problems in using \*(CO \*(UU with a Trailblazer modem.
.\"The following describes how
.\"Mark Williams Company has configured the
.\"Trailblazer modem that it uses under \*(CO at 9600 baud.
.\".PP
.\"To begin, the following gives the permissions in
.\".B /usr/lib/uucp
.\"for selected files:
.\".DM
.\"-rw-r--r--  1 uucp     uucp       196 Wed May 23 10:16 L-devices
.\"-rw-r--r--  1 uucp     uucp       740 Tue May 22 15:40 L.sys
.\"-rw-r--r--  1 uucp     uucp      2151 Wed Jul 11 10:44 Permissions
.\".DE
.\".PP
.\"The following gives partial contents of file
.\".BR /usr/lib/uucp/L-devices :
.\".DM
.\"#type    line   remote  baud    brand
.\"#-----  ------  ------  ----    -----
.\"ACU     com3l   com3r   2400    tb2400
.\"ACU     com3l   com3r   9600    tbfast
.\".DE
.\".PP
.\"The following gives partial contents of file
.\".B /usr/lib/uucp/L.sys
.\"(note that \fB#\fP should be replaced by the actual phone number):
.\".DM
.\"uunet Any ACU 9600 # FAST \ed\er\ec in:-\er-in: \edmwc\er\ec rd: PASSWORD\er
.\".DE
.\".PP
.\"The following gives partial contents of
.\".BR /usr/lib/uucp/Permissions :
.\".DM
.\"MACHINE=uunet LOGNAME=uuunet \e
.\"	COMMANDS=rmail:rnews: \e
.\"	READ=/usr/spool/uucppublic:/tmp \e
.\"	WRITE=/usr/spool/uucppublic:/tmp \e
.\"	SENDFILES=yes REQUEST=no
.\".DE
.\".PP
.\"The following gives permissions and partial contents of file
.\".BR /etc/ttys :
.\".DM
.\"-rw-r--r--  1 root   root   163 Wed Jul 11 11:36 /etc/ttys
.\".sp \n(pDu
.\"1lPconsole
.\"1rPcom3r
.\".DE
.\".PP
.\"Finally, the following gives
.\"permissions on
.\".B /dev/com3r
.\"(while enabled):
.\".DM
.\"c--s------  1 root   root   21  38 Wed Jul 11 11:50 /dev/com3r
.\".DE
.\".PP
.\"To use the Trailblazer, log in as
.\".BR root ,
.\"and type the following commands
.\".DM
.\"	disable com3r
.\"	kermit cbl 9600 /dev/com\fI3\fPl > /tmp/modem_dump
.\".DE
.\".PP
.\"where
.\".I ?
.\"is the number of the \fBcom\fR port into which you have plugged your modem.
.\"Note that we disabled the ``remote'' device but used the ``local''
.\"modem device when using
.\".BR kermit .
.\"This allows us to access the modem registers without having to wait
.\"for the modem to assert the carrier detect signal.
.\".PP
.\"While talking to the Trailblazer, we sent it
.\".B ATN?
.\"followed by the
.\".B <Enter>
.\"key. We then entered
.\".B "^"
.\"(the circumflex) followed by the letter
.\".B C
.\"in order to exit from
.\".BR kermit .
.\"The following gives the results contained in file
.\".BR /tmp/modem_dump :
.\".DM
.\"kermit: connected...
.\".sp \n(pDu
.\"E0 F1 M1 Q9 T V0 W0 X3 Y0 &P0 &T4     Version BA5.01
.\"S00=001 S01=000 S02=043 S03=013 S04=010 S05=008 S06=002 S07:060 \e
.\"	S08=002 S09=006
.\"S10=007 S11=070 S12=050 S18=000 S25=005 S38=000 
.\"S41=000 S45=000 S47=004 S48:001 S49=000
.\"S50=000 S51:252 S52=000         S54:003 S55=000 S56=017 S57=019 \e
.\"	S58:000 S59=000
.\"S60=000 S61:230 S62=003 S63=001 S64=000 S65=000 S66=000 S67=000 \e
.\"	S68=255 S69=000
.\"S90=000 S91=000 S92=000 S94=001 S95=000 S96=001 
.\"S100=000 S101=000 S102=000 S104=000 S105=001 
.\"S110=255 S111=255 S112=001 
.\"S121=000 S130=002 S131:001 S255=000 
.\"N0:
.\"N1:
.\"N2:
.\"N3:
.\"N4:
.\"N5:
.\"N6:
.\"N7:
.\"N8:
.\"N9:
.\"0
.\"kermit: disconnected.
.\".DE
.\".PP
.\"For your Trailblazer to work correctly with the \*(CO implementation of
.\"\*(UU, the register settings on your Trailblazer should match what appears
.\"in this register dump
.SH "See Also"
.Xr "Administering COHERENT," administe
.Xr "dial," dial
.Xr "RS-232," rs-232
.Xr "terminal," terminal
.Xr "UUCP" uucp
.SH 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.
