3.4. The PLIP Driver

Parallel Line IP (PLIP) is a cheap way to network when you want to connect only two machines. It uses a parallel port and a special cable, achieving speeds of 10 kilobytes per second to 20 kilobytes per second.

PLIP was originally developed by Crynwr, Inc. Its design at the time was rather ingenious (or, if you prefer, a hack), because the original parallel ports on IBM PCs were designed to spend their time being unidirectional printer ports; the eight data lines could be used only to send data from the PC to the peripheral device, but not the other way around.[1] The Cyrnwr PLIP design worked around this limitation by using the port's five status lines for input, which limited it to transferring all data as nibbles (half bytes) only, but allowed for bidirectional transfer. This mode of operation was called PLIP “mode 0.” Today, the parallel ports supplied on PC hardware cater to full bidirectional 8-bit data transfer, and PLIP has been extended to accomodate this with the addition of PLIP “mode 1.”

Linux kernels up to and including Version 2.0 support PLIP mode 0 only, and an enhanced parallel port driver exists as a patch against the 2.0 kernel and as a standard part of the 2.2 kernel code to provide PLIP mode 1 operation, too. [2] Unlike earlier versions of the PLIP code, the driver now attempts to be compatible with the PLIP implementations from Crynwr, as well as the PLIP driver in NCSA telnet.[3] To connect two machines using PLIP, you need a special cable sold at some shops as a Null Printer or Turbo Laplink cable. You can, however, make one yourself fairly easily; Appendix B shows you how.

The PLIP driver for Linux is the work of almost countless persons. It is currently maintained by Niibe Yutaka.[4] If compiled into the kernel, it sets up a network interface for each of the possible printer ports, with plip0 corresponding to parallel port lp0, plip1 corresponding to lp1, etc. The mapping of interfaces to ports differs in the 2.0 kernels and the 2.2 kernels. In the 2.0 kernels, the mapping was hardwired in the drivers/net/Spacd.c file in the kernel source. The default mappings in this file are:

InterfaceI/O PortIRQ
plip00x3BC7
plip10x3787
plip20x2785

If you configured your printer port in a different way, you must change these values in drivers/net/Space.c in the Linux kernel source and build a new kernel.

In the 2.2 kernels, the PLIP driver uses the “parport” parallel port sharing driver developed by Philip Blundell.[5] The new driver allocates the PLIP network device names serially, just as for the Ethernet or PPP drivers, so the first PLIP device created is plip0, the second is plip1, and so on. The physical parallel port hardware is also allocated serially. By default, the parallel port driver will attempt to detect your parallel port hardware with an autoprobe routine, recording the physical device information in the order found. It is better practice to explicitly tell the kernel the physical I/O parameters. You can do this by supplying arguments to the parport_pc.o module as you load it, or if you have compiled the driver into your kernel, using lilo to supply arguments to the kernel at boot time. The IRQ setting of any device may be changed later by writing the new IRQ value to the related /proc/parport/*/irq file.

Configuring the physical I/O parameters in a 2.2 kernel when loading the module is straightforward. For instance, to tell the driver that you have two PC-style parallel ports at I/O addresses 0x278 and 0c378 and IRQs 5 and 7, respectively, you would load the module with the following arguments:
modprobe parport_ pc io=0x278,0x378 irq=5,7
The corresponding arguments to pass to the kernel for a compiled-in driver are:
parport=0x278,5 parport=0x378,7
You would use the lilo append keyword to have these arguments passed to the kernel automatically at boot time.

When the PLIP driver is initialized, either at boot time if it is built-in, or when the plip.o module is loaded, each of the parallel ports will have a plip network device associated with it. plip0 will be assigned to the first parallel port device, plip1 the second, and so on. You can manually override this automatic assignment using another set of kernel arguments. For instance, to assign parport0 to network device plip0, and parport1 to network device plip1, you would use kernel arguments of:
plip=parport1 plip=parport0

This mapping does not mean, however, that you cannot use these parallel ports for printing or other purposes. The physical parallel port devices are used by the PLIP driver only when the corresponding interface is configured up.

Notes

[1]

Fight to clear the hacking name! Always use “cracker” when you are referring to people who are consciously trying to defeat the security of a system, and “hacker” when you are referring to people who have found a clever way of solving a problem. Hackers can be crackers, but the two should never be confused. Consult the New Hackers Dictionary (popularly found as the Jargon file) for a more complete understanding of the terms.

[2]

The enhanced parallel port adaptor patch for 2.0 kernel is available from http://www.cyberelk.demon.co.uk/parport.html.

[3]

NCSA telnet is a popular program for DOS that runs TCP/IP over Ethernet or PLIP, and supports telnet and FTP.

[4]

Niibe can be reached at gniibe@mri.co.jp.

[5]

You can reach Philip at Philip.Blundell@pobox.com.

mirror server hosted at Truenetwork, Russian Federation.