Parallel Ports

Parallel Ports

Parallel ports are a common way printers are attached to an Linux system. Although many different problems arise with printers attached to parallel ports, not many issues arise with parallel ports themselves.

First, lets take a look at how parallel ports work.

One key difference between a parallel and serial port is the way data is sent. From our discussion of serial ports, you know that data goes across a serial line one bit at a time across a single data line. Parallel ports send data across a byte (eight bits) at a time across eight data lines.

Another key difference is the cable. Looking at the computer end, you can easily confuse the cable with a serial connector. Both have 25 pins in the same layout. On the printer end, though, things are different. There is a special kind of 36-pin connector called a Centronics connector, named after the printer manufacturer Centronics. A cable that has a 25-pin D-shell connector on one end and a 36-pin on the other is called a Centronics or parallel cable. (see Figure 0-14) Unlike serial cables, there are not different kinds of cables (like straight-through or crossed). Because of this, all you usually need to do is to plug in the cable at both ends and go.

Comparison of Centronic and DB25 Connectors

Although some devices allow communication in both directions along a parallel port, Linux does not support this communication. In fact, the only thing that Linux directly supports on parallel ports are printers.

Because there is no guarantee that all the data bits arrive at the port at the same time, there must be some way of signaling the printer that the data is ready. This is done with the strobe line. Once a character (or any byte of data) is ready, the system sends a signal along the strobe line. Using the strobe line also prevents characters from being read more than once.

Often, the printer cannot keep up with the data flow from the parallel port. Just like RTS-CTS flow control on a serial port, parallel ports also need a way to be told to stop. This is done with the busy line. Actually, the busy line is set after each character in case the printer cannot process the character fast enough. Once the character is processed, the printer can turn off the busy signal.

However, this is not enough to get the parallel port to send the next character. The printer must first tell the parallel port it has received the character by sending a signal along the acknowledge line. Note that this acknowledge occurs after every character.

The printer also uses other control lines. One is the select, which indicates that the printer has been selected or is on-line. There is also a special line that indicates when the paper source is empty. This is the paper empty line. If the problem is unknown, the printer can send a signal along the fault line that says that “something” is wrong.

One thing that comes up regularly is the confusion about which physical parallel port is related to which lp device. For your parallel ports to work correctly, you must configure them according to Table 0-5.

Table -5 Default Parallel Port Devices

Device name AddressIRQ
/dev/lp0 0x3787
/dev/lp1 0x3BC7
/dev/lp2 0x2785