HP-UX Reference (11i v2 04/09) - 7 Device (Special) Files, 9 General Information, Index (vol 10)
m
modem(7) modem(7)
When a port is in simple mode, the driver will normally control the modem lines. However, the user is
allowed to change the setting of the CONTROL (see Modem ioctls below).
Terminal port access interlock
An interlock mechanism is provided between the three access types of terminal files. It prevents more
than one file from being successfully opened at a time, but allows certain opens to succeed while others
are PENDING so that a port can be opened through a call-out connection while getty has a pending open
at a call-in connection. The three access types are given a priority that determines which open will
succeed if more than one file has an open issued against it. The three access types are ordered from
lowest priority to highest as follows: call-in, call-out, and direct.
If an open is issued to a port which already has a SUCCESSFUL open on it of a lower priority type, the
new open will be returned with an [EBUSY] error. ([EBUSY] will also be returned by an attempted open
on a CCITT call-out file if an incoming call indication is currently being received. In this case, if there is
a PENDING open on the corresponding CCITT call-in file, this PENDING open will complete.) If the
lower priority open is PENDING, the new open will succeed if possible, or will be left PENDING if wait-
ing for the STATUS and the lower priority open will become BLOCKED. If a higher priority open has suc-
ceeded or is PENDING, the new open will be BLOCKED, unless the new open has the
O_NDELAY flag bit
set, in which case the open will be returned with an [EBUSY] error. Once an open on one type of file is
SUCCESSFUL, any PENDING opens on lower priority files will become BLOCKED.
When a file of one priority is closed, a BLOCKED open on the next lower priority type file will become
active. If all of the STATUS are raised, the open will be SUCCESSFUL, otherwise the open will become
PENDING waiting for the STATUS. If the lower priority open is SUCCESSFUL (because the connection
was maintained when the higher priority file was closed), the port characteristics (speed, parity, etc.) that
were set by the higher priority file will be inherited by the lower priority file. If the connection is not
maintained through the close , the port characteristics will be set to default values.
Modem timers
There are four timers currently defined for use with modem connections. The first three of the timers are
applicable only to CCITT mode connections. In general, the effect of changing a timer value while the
timer is running is system dependent. However, setting the timer value to zero is guaranteed to disable
the timer even if it is running.
The connect timer is used to limit the amount of time to wait for a connection to be established once it has
been begun. This timer is started when an incoming call has been received on a call-in file, or when an
open has been issued on a call-out file for which no opens are already pending. If the connection is com-
pleted in time, the timer is aborted. If the time period expires, the connection is aborted. For a call-in
file, the driver will again wait for an incoming call and the open will remain pending. For a call-out file,
the open will be returned with an [EIO] error.
The carrier detect timer is used to limit the amount of time to wait before causing a disconnect if DCD
drops. If carrier is not re-established in this time, a disconnect will occur. If carrier is re-established
before the timeout, the timer will be aborted and the connection maintained. During the period when
carrier is not raised, no data will be transferred across the line.
The no activity timer is used to limit the amount of time a connection will remain open with no data
transfer across the line. When the data line becomes quiescent with no data transfer, this timer will be
started. If data is again transferred over the line in either direction before the time limit, the timer will
be aborted. If no activity occurs before the timeout has occurred, the driver will disconnect the line. This
can be used to avoid long and costly telephone connections when data transfer has been stopped either
normally or abnormally.
The last timer defined, the hangup timer, is used for both CCITT and simple modes. This timer controls
the amount of time to wait after disconnecting a modem line before allowing another open . This time
period should be made long enough to guarantee that the connection has been terminated by the tele-
phone switching equipment. If this period is not long enough, the telephone connection may not be bro-
ken and a succeeding open may complete with the old connection.
HP-UX Modem ioctls
Several ioctl system calls apply to manipulation of modem lines. They use the following information
defined in
<sys/modem.h>:
#define NMTIMER 6
typedef unsigned long mflag;
struct mtimer {
HP-UX 11i Version 2: September 2004 − 3 − Hewlett-Packard Company Section 7−−75