The `parport' code provides parallel-port support under Linux. This includes the ability to share one port between multiple device drivers. You can pass parameters to the parport code to override its automatic detection of your hardware. This is particularly useful if you want to use IRQs, since in general these can't be autoprobed successfully. The parport code is split into two parts: generic (which deals with port-sharing) and architecture-dependent (which deals with actually using the port). Parport as modules ================== If you load the parport code as a module, say # insmod parport.o to load the generic parport code. You then must load the architecture-dependent code with (for example): # insmod parport_pc.o io=0x378,0x278 irq=7,5 to tell the parport code that you want two PC-style ports, one at 0x378 using IRQ 7, and one at 0x278 using IRQ 5. Currently, PC-style (parport_pc) and ARC onboard (parport_arc) parallel ports are supported. Kerneld ------- If you use kerneld, you will find it useful to edit /etc/conf.modules. Here is an example of the lines that need to be added: alias parport_lowlevel parport_pc options parport_pc io=0x378,0x278 irq=7,5 Kerneld, in conjunction with parport, will automatically load parport_pc whenever a parallel port device driver (such as lp) is loaded. Parport probe [optional] ------------- Once the architecture-dependent part of the parport code is loaded into the kernel, you insert the parport_probe module with: # insmod parport_probe.o This will perform an IEEE1284 probe of any attached devices and log a message similar to: parport0: Printer, BJC-210 (Canon) (If you are using kerneld and have configured parport_probe as a module, this will just happen.) Parport, but not as modules =========================== If you compile the parport code into the kernel, then you can use kernel boot parameters to get the same effect. Add something like the following to your LILO command line: parport=0x378,7 parport=0x278,5 You can have many `parport=...' statements, one for each port you want to add. Adding `parport=0' to the kernel command-line will disable parport support entirely. Files in /proc ============== If you have configured the /proc filesystem into your kernel, you will see a new directory entry: /proc/parport. In there will be a directory entry for each parallel port for which parport is configured. In each of those directories are three files describing that parallel port. For example: File: Contents: /proc/parport/0/devices A list of the device drivers using that port. A "+" will appear by the name of the device currently using the port (it might not appear against any). /proc/parport/0/hardware Parallel port's base address, IRQ line and DMA channel. /proc/parport/0/irq The IRQ that parport is using for that port (as above). This is in a separate file to allow you to alter it by writing a new value in (IRQ number or "none"). Device drivers ============== Once the parport code is initialised, you can attach device drivers to specific ports. Normally this happens automatically; if the lp driver is loaded it will create one lp device for each port found. You can override this, though, by using parameters either when you load the lp driver: # insmod lp.o parport=0,2 or on the LILO command line: lp=parport0 lp=parport2 Both the above examples would inform lp that you want /dev/lp0 to be the first parallel port, and /dev/lp1 to be the _third_ parallel port, with no lp device associated with the second port (parport1). Note that this is different to the way older kernels worked; there used to be a static association between the I/O port address and the device name, so /dev/lp0 was always the port at 0x3bc. This is no longer the case - if you only have one port, it will always be /dev/lp0, regardless of base address. Also: * If you selected the device autoprobe at compile time, you can say `lp=auto' on the kernel command line, and lp will create devices only for those ports that seem to have printers attached. * If you give PLIP the `timid' parameter, either with `plip=timid' on the command line, or with `insmod plip timid=1' when using modules, it will avoid any ports that seem to be in use by other devices. * If your BIOS allows you to engage "ECP mode", you may find that your port's IRQ can be autoprobed, without having to specify any parameters. -- Philip.Blundell@pobox.com tim@cyberelk.demon.co.uk