4.3. Serial devices
4.3. Serial devices
Serial devices are usually called something like/dev/ttyS1 under Linux. The utility
stty
will allow you to interactively view or
set the settings for a serial port;
setserial
will allow you to control a few
extended attributes and configure IRQs and I/O addresses for
non-standard ports. Further discussion of serial ports under
Linux may be found in the Serial-HOWTO.
When using a slow serial printer with flow control, you may find
that some of your print jobs get truncated. This may be due to
the serial port, whose default behavior is to purge any
untransmitted characters from its buffer 30 seconds after the port
device is closed. The buffer can hold up to 4096 characters, and
if your printer uses flow control and is slow enough that it can't
accept all the data from the buffer within 30 seconds after
printing software has closed the serial port, the tail end of the
buffer's contents will be lost. If the command cat file > /dev/ttyS2 produces complete
printouts for short files but truncated ones for longer files, you
may have this condition.
The 30 second interval can be adjusted through the
"closing_wait" command-line option of setserial (version
2.12 and later). A machine's serial ports are usually initialized
by a call to setserial in the rc.serial boot file. The call for
the printing serial port can be modified to set the
closing_wait at the same time as it sets that port's other
parameters.