UNIX System Administration Handbook - Evi Nemeth [68]
Different versions of UNIX deal with soft carrier in different ways. Early versions required a patch to the terminal driver, but that was cumbersome and silly. Most modern systems have solved this problem by setting a default carrier mode for serial ports in the system configuration files. In addition, stty -CLOCAL can be used to force a terminal to assume soft carrier on a running system. For example,
# stty -CLOCAL < /dev/tty03
would enable soft carrier for the port tty03.
Some systems will need a “>” instead of a “<” in this command; see the section on stty starting on page 111 for more information.
7.4 HARDWARE FLOW CONTROL
The CTS and RTS signals are used to make sure that a device does not send data faster than the receiver can process it. For example, if a modem is in danger of running out of buffer space (perhaps because the connection to the remote site is slower than the serial link between the local machine and the modem), it can tell the computer to shut up until more room has become available in the buffer.
Flow control is essential for high-speed modems and is also very useful for printers. On systems that do not support hardware flow control (either because the serial ports do not understand it or because the serial cable leaves CTS and RTS disconnected), flow control can sometimes be simulated in software using the ASCII characters XON and XOFF. However, software flow control must be explicitly supported by high-level software, and even then it does not work very well.4
On Sun hardware, flow control must be set up with the eeprom command.
Most terminals ignore the CTS and RTS signals. By jumpering pins 4 and 5 together at the terminal end of the cable, you can fool the few terminals that require a handshake across these pins before they will communicate. When the terminal sends out a signal on pin 4 saying “I’m ready,” it gets the same signal back on pin 5 saying “Go ahead.” You can also jumper the DTR/DSR/DCD handshake in this way.
7.5 CABLE LENGTH
The RS-232 standard specifies a maximum cable length of 75 feet at 9,600 bps. Standards are usually conservative, and RS-232 is no exception. We have routinely run RS-232 cables much greater distances, up to about 1,000 feet. We have hit the limit somewhere between 800 and 1,000 feet but have found that the particular brand of devices on each end makes quite a difference.
7.6 SERIAL DEVICE FILES
Serial ports are represented by device files in or under /dev. Most computers have two serial ports built in. In the past they were usually known as /dev/ttya and /dev/ttyb, but naming conventions have diverged over time.
Sometimes, more than one device file refers to the same serial port. For example, /dev/cua/a on a Solaris system refers to the same port as /dev/term/a. However, the minor device number for /dev/cua/a is different:
% ls -lL /dev/term/a /dev/cua/a
crw-rw-rw- 1 root sys 29, 0 Jan 15 1998 /dev/term/a
crw------- 1 uucp uucp 29, 131072 Jan 15 1998 /dev/cua/a
Multiple device files are primarily used to support modems that handle both incoming and outgoing calls. In the Solaris scheme, the driver allows /dev/term/a to be opened only when DCD has been asserted by the modem, indicating the presence of an active (inbound) connection (assuming that soft carrier is not enabled on the port). /dev/cua/a can be opened regardless of the state of DCD; it’s used when connecting to the modem to instruct it to place a call. Access to each device file is blocked while the other is in use.
FreeBSD lets you specify initial and locked states for ports in /etc/rc.serial. This feature is handy when you want to override the behavior of poorly written programs that don’t configure the ports correctly. If you set the port parameters