LP(4)
πΈ LP(4) β the printer port Internet Protocol driver, bestie π
okay so this is the man page for lp from the Kernel Interfaces Manual, and it's literally about turning your crusty old printer port into a whole network interface. iconic behavior honestly. let's get into it π«Ά
β¨ NAME β¨
lp β printer port Internet Protocol driver π
β¨ SYNOPSIS β¨
ifconfig plip0 myaddress hisaddress [-link0]
device ppbus
device plip
device ppc
like that's the whole vibe check right there. two ifconfig addresses and three kernel config lines, periodt. π
β¨ DESCRIPTION β¨
so the lp driver lets you take a PC parallel printer port and use it as a point-to-point network interface between two systems that are set up basically the same way. no cap. π
here's the cute part: data moves 4 bits at a time, and it uses the printer status lines for input. which means you do not need any special bidirectional hardware β any standard AT-compatible printer port with working interrupts will do. slay. β¨
during the boot process, for every plip device that gets probed and has an interrupt assigned, a corresponding network device gets created. no interrupt, no interface, sorry bestie. π
when you configure an lp device with ifconfig(8), that reserves the corresponding parallel port bus for PLIP β and it stays reserved until the network interface is configured 'down'. so don't be surprised when the port is unavailable, it's busy being a network card. π
the communication protocol gets picked by the link0 flag:
-link0β (this is the default, btw) use FreeBSD mode (LPIP). it's the simpler of the two modes, so it's slightly more efficient. lowkey the good one. πlink0β use Crynwr/Linux compatible mode (CLPIP). this mode has a simulated Ethernet packet header, so it's easier to interface with other types of equipment. πΈ
the interface MTU defaults to 1500, but it can be set to any value you want. β οΈ both ends of the link must be configured with the same MTU though β no mixing, that's the rule.
π Cable Connections π
the cable connecting the two parallel ports should be wired like this, exactly:
Pin Pin Description
2 15 Data0 -> ERROR*
3 13 Data1 -> SLCT
4 12 Data2 -> PE
5 10 Data3 -> ACK*
6 11 Data4 -> BUSY
15 2 ERROR* -> Data0
13 3 SLCT -> Data1
12 4 PE -> Data2
10 5 ACK* -> Data3
11 6 BUSY -> Data4
18-25 18-25 Ground
cables with this wiring are widely available as 'Laplink' cables, and they're often coloured yellow. π‘ (yes, the yellow ones. that's the vibe.)
the connections are symmetric, and they give you 5 lines in each direction β four data plus one handshake. π¦ both modes use the same wiring, they just make a different choice about which line is the handshake. iykyk.
π§ FreeBSD LPIP mode π§
the signal lines are used like this:
Data0(Pin 2) β data out, bit 0.Data1(Pin 3) β data out, bit 1.Data2(Pin 4) β data out, bit 2.Data3(Pin 5) β handshake out.Data4(Pin 6) β data out, bit 3.ERROR*(pin 15) β data in, bit 0.SLCT(pin 13) β data in, bit 1.PE(pin 12) β data in, bit 2.BUSY(pin 11) β data in, bit 3.ACK*(pin 10) β handshake in.
when idle, all data lines are at zero. π
each byte gets signalled in four steps, and the choreography is:
- sender writes the 4 most significant bits and raises the handshake line
- receiver reads the 4 bits and raises its handshake to acknowledge
- sender places the 4 least significant bits on the data lines and lowers the handshake
- receiver reads the data and lowers its handshake
the packet format has a two-byte header, comprising the fixed values 0x08, 0x00, immediately followed by the IP header and data. β¨
the start of a packet is indicated by simply signalling the first byte of the header. the end of the packet is indicated by inverting the data lines (i.e., writing the ones-complement of the previous nibble to be transmitted) without changing the state of the handshake. cute, right?
β οΈ heads up: the end-of-packet marker assumes that the handshake signal and the data-out bits can be written in a single instruction β otherwise certain byte values in the packet data would falsely be interpreted as end-of-packet. this is not a problem for the PC printer port, but it requires care when implementing this protocol on other equipment. π«Ά
π Crynwr/Linux CLPIP mode π
the signal lines are used like this:
Data0(Pin 2) β data out, bit 0.Data1(Pin 3) β data out, bit 1.Data2(Pin 4) β data out, bit 2.Data3(Pin 5) β data out, bit 3.Data4(Pin 6) β handshake out.ERROR*(pin 15) β data in, bit 0.SLCT(pin 13) β data in, bit 1.PE(pin 12) β data in, bit 2.ACK*(pin 10) β data in, bit 3.BUSY(pin 11) β handshake in.
when idle, all data lines are at zero. π
each byte is signalled in four steps:
- sender writes the 4 least significant bits and raises the handshake line
- receiver reads the 4 bits and raises its handshake to acknowledge
- sender places the 4 most significant bits on the data lines and lowers the handshake
- receiver reads the data and lowers its handshake
π« [Note that this is the opposite nibble order to LPIP mode] β yeah, they flip it. don't ask, it's just the lore.
the packet format is:
Length (least significant byte)
Length (most significant byte)
12 bytes of supposed MAC addresses (ignored by FreeBSD).
Fixed byte 0x08
Fixed byte 0x00
<IP datagram>
Checksum byte.
the length includes the 14 header bytes, but not the length bytes themselves nor the checksum byte. π
the checksum is a simple arithmetic sum of all the bytes (again, including the header but not checksum or length bytes). FreeBSD calculates outgoing checksums, but does not validate incoming ones. ngl that's just how it is. π€·
the start of packet has to be signalled specially, since the line chosen for handshake-in cannot be used to generate an interrupt. so: the sender writes the value 0x08 to the data lines, and waits for the receiver to respond by writing 0x01 to its data lines. the sender then starts signalling the first byte of the packet β that's the length byte. π
end of packet is deduced from the packet length and is not signalled specially (although the data lines are restored to the zero, idle state to avoid spuriously indicating the start of the next packet). πΈ
β¨ SEE ALSO β¨
go read those too, bestie, they're part of the story π
π BUGS π
okay so, the messy parts, and we're being honest here:
- Busy-waiting loops are used while handshaking bytes β and worse still when waiting for the receiving system to respond to an interrupt for the start of a packet. π so a fast system talking to a slow one will consume excessive amounts of CPU. this is unavoidable in the case of CLPIP mode due to the choice of handshake lines; it could theoretically be improved in the case of LPIP mode.
- Polling timeouts are controlled by counting loop iterations rather than timers, and so they are dependent on CPU speed. π« this is somewhat stabilised by the need to perform (slow) ISA bus cycles to actually read the port.
so likeβ¦ it works, but it's giving "vintage chaos" energy and that's just the truth. π
that's the whole page, fr fr. this one's a Debian joint, dated March 4, 1996, and it's page LP(4) of the manual. 1996 really said "let's network two computers through a printer cable" and honestly? ate. πβ¨π good luck with your Laplink cable, bestie π«Ά
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1996 A.R.Gordon, andrew.gordon@net-tel.co.uk
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms