Previous Next Contents

3. Kernel printer devices

3.1 The lp device

The Linux kernel, assuming you have compiled in or loaded the lp device (the output of cat /proc/devices should include the device lp), provides one or more of /dev/lp0, /dev/lp1, and /dev/lp2. These are NOT assigned dynamically, rather, each corresponds to a specific hardware I/O address. This means that your first printer may be lp0 or lp1 depending on your hardware. Try both ;)

One cannot run the plip and lp drivers at the same time on any given port. You can, however, have one or the other driver loaded at any given time either manually, or by kerneld with v2 (and later 1.3.x) kernels. By carefully setting the interrupts and such, you can supposedly run plip on one port and lp on the other. One person did so by editing the drivers; I eagerly await a success report of someone doing so with only a clever command line.

There is a little utility called tunelp floating about with which you, as root, can tune the Linux lp device's interrupt usage, polling rate, and other options.

When built in to some 1.3.x and v2 kernels, the kernel will accept an lp= option to set interrupts and io addresses:

When the lp driver is built in to the kernel, you may use the
LILO/LOADLIN command line to set the port addresses and interrupts
that the driver will use.

Syntax:      lp=port0[,irq0[,port1[,irq1[,port2[,irq2]]]]]

For example:   lp=0x378,0   or   lp=0x278,5,0x378,7 **

Note that if this feature is used, you must specify *all* the ports
you want considered, there are no defaults.  You can disable a
built-in driver with lp=0.

When loaded as a module in version 2 and late-model 1.3.x kernels, it is possible to specify io addresses and interrupt lines on the insmod command line (or in /etc/conf.modules so as to affect kerneld) using the usual syntax. The parameters are io=port0,port1,port2 and irq=irq0,irq1,irq2. Read ye the man page for insmod for more information on this.

**For those of you who (like me) can never find the standard port numbers when you need them, they are as in the second example above. The other port (lp0) is at 0x3bc. I've no idea what interrupt it usually uses.

3.2 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.


Previous Next Contents