1*9d85025bSMauro Carvalho ChehabParport 2*9d85025bSMauro Carvalho Chehab+++++++ 3*9d85025bSMauro Carvalho Chehab 4*9d85025bSMauro Carvalho ChehabThe ``parport`` code provides parallel-port support under Linux. This 5*9d85025bSMauro Carvalho Chehabincludes the ability to share one port between multiple device 6*9d85025bSMauro Carvalho Chehabdrivers. 7*9d85025bSMauro Carvalho Chehab 8*9d85025bSMauro Carvalho ChehabYou can pass parameters to the ``parport`` code to override its automatic 9*9d85025bSMauro Carvalho Chehabdetection of your hardware. This is particularly useful if you want 10*9d85025bSMauro Carvalho Chehabto use IRQs, since in general these can't be autoprobed successfully. 11*9d85025bSMauro Carvalho ChehabBy default IRQs are not used even if they **can** be probed. This is 12*9d85025bSMauro Carvalho Chehabbecause there are a lot of people using the same IRQ for their 13*9d85025bSMauro Carvalho Chehabparallel port and a sound card or network card. 14*9d85025bSMauro Carvalho Chehab 15*9d85025bSMauro Carvalho ChehabThe ``parport`` code is split into two parts: generic (which deals with 16*9d85025bSMauro Carvalho Chehabport-sharing) and architecture-dependent (which deals with actually 17*9d85025bSMauro Carvalho Chehabusing the port). 18*9d85025bSMauro Carvalho Chehab 19*9d85025bSMauro Carvalho Chehab 20*9d85025bSMauro Carvalho ChehabParport as modules 21*9d85025bSMauro Carvalho Chehab================== 22*9d85025bSMauro Carvalho Chehab 23*9d85025bSMauro Carvalho ChehabIf you load the `parport`` code as a module, say:: 24*9d85025bSMauro Carvalho Chehab 25*9d85025bSMauro Carvalho Chehab # insmod parport 26*9d85025bSMauro Carvalho Chehab 27*9d85025bSMauro Carvalho Chehabto load the generic ``parport`` code. You then must load the 28*9d85025bSMauro Carvalho Chehabarchitecture-dependent code with (for example):: 29*9d85025bSMauro Carvalho Chehab 30*9d85025bSMauro Carvalho Chehab # insmod parport_pc io=0x3bc,0x378,0x278 irq=none,7,auto 31*9d85025bSMauro Carvalho Chehab 32*9d85025bSMauro Carvalho Chehabto tell the ``parport`` code that you want three PC-style ports, one at 33*9d85025bSMauro Carvalho Chehab0x3bc with no IRQ, one at 0x378 using IRQ 7, and one at 0x278 with an 34*9d85025bSMauro Carvalho Chehabauto-detected IRQ. Currently, PC-style (``parport_pc``), Sun ``bpp``, 35*9d85025bSMauro Carvalho ChehabAmiga, Atari, and MFC3 hardware is supported. 36*9d85025bSMauro Carvalho Chehab 37*9d85025bSMauro Carvalho ChehabPCI parallel I/O card support comes from ``parport_pc``. Base I/O 38*9d85025bSMauro Carvalho Chehabaddresses should not be specified for supported PCI cards since they 39*9d85025bSMauro Carvalho Chehabare automatically detected. 40*9d85025bSMauro Carvalho Chehab 41*9d85025bSMauro Carvalho Chehab 42*9d85025bSMauro Carvalho Chehabmodprobe 43*9d85025bSMauro Carvalho Chehab-------- 44*9d85025bSMauro Carvalho Chehab 45*9d85025bSMauro Carvalho ChehabIf you use modprobe , you will find it useful to add lines as below to a 46*9d85025bSMauro Carvalho Chehabconfiguration file in /etc/modprobe.d/ directory:: 47*9d85025bSMauro Carvalho Chehab 48*9d85025bSMauro Carvalho Chehab alias parport_lowlevel parport_pc 49*9d85025bSMauro Carvalho Chehab options parport_pc io=0x378,0x278 irq=7,auto 50*9d85025bSMauro Carvalho Chehab 51*9d85025bSMauro Carvalho Chehabmodprobe will load ``parport_pc`` (with the options ``io=0x378,0x278 irq=7,auto``) 52*9d85025bSMauro Carvalho Chehabwhenever a parallel port device driver (such as ``lp``) is loaded. 53*9d85025bSMauro Carvalho Chehab 54*9d85025bSMauro Carvalho ChehabNote that these are example lines only! You shouldn't in general need 55*9d85025bSMauro Carvalho Chehabto specify any options to ``parport_pc`` in order to be able to use a 56*9d85025bSMauro Carvalho Chehabparallel port. 57*9d85025bSMauro Carvalho Chehab 58*9d85025bSMauro Carvalho Chehab 59*9d85025bSMauro Carvalho ChehabParport probe [optional] 60*9d85025bSMauro Carvalho Chehab------------------------ 61*9d85025bSMauro Carvalho Chehab 62*9d85025bSMauro Carvalho ChehabIn 2.2 kernels there was a module called ``parport_probe``, which was used 63*9d85025bSMauro Carvalho Chehabfor collecting IEEE 1284 device ID information. This has now been 64*9d85025bSMauro Carvalho Chehabenhanced and now lives with the IEEE 1284 support. When a parallel 65*9d85025bSMauro Carvalho Chehabport is detected, the devices that are connected to it are analysed, 66*9d85025bSMauro Carvalho Chehaband information is logged like this:: 67*9d85025bSMauro Carvalho Chehab 68*9d85025bSMauro Carvalho Chehab parport0: Printer, BJC-210 (Canon) 69*9d85025bSMauro Carvalho Chehab 70*9d85025bSMauro Carvalho ChehabThe probe information is available from files in ``/proc/sys/dev/parport/``. 71*9d85025bSMauro Carvalho Chehab 72*9d85025bSMauro Carvalho Chehab 73*9d85025bSMauro Carvalho ChehabParport linked into the kernel statically 74*9d85025bSMauro Carvalho Chehab========================================= 75*9d85025bSMauro Carvalho Chehab 76*9d85025bSMauro Carvalho ChehabIf you compile the ``parport`` code into the kernel, then you can use 77*9d85025bSMauro Carvalho Chehabkernel boot parameters to get the same effect. Add something like the 78*9d85025bSMauro Carvalho Chehabfollowing to your LILO command line:: 79*9d85025bSMauro Carvalho Chehab 80*9d85025bSMauro Carvalho Chehab parport=0x3bc parport=0x378,7 parport=0x278,auto,nofifo 81*9d85025bSMauro Carvalho Chehab 82*9d85025bSMauro Carvalho ChehabYou can have many ``parport=...`` statements, one for each port you want 83*9d85025bSMauro Carvalho Chehabto add. Adding ``parport=0`` to the kernel command-line will disable 84*9d85025bSMauro Carvalho Chehabparport support entirely. Adding ``parport=auto`` to the kernel 85*9d85025bSMauro Carvalho Chehabcommand-line will make ``parport`` use any IRQ lines or DMA channels that 86*9d85025bSMauro Carvalho Chehabit auto-detects. 87*9d85025bSMauro Carvalho Chehab 88*9d85025bSMauro Carvalho Chehab 89*9d85025bSMauro Carvalho ChehabFiles in /proc 90*9d85025bSMauro Carvalho Chehab============== 91*9d85025bSMauro Carvalho Chehab 92*9d85025bSMauro Carvalho ChehabIf you have configured the ``/proc`` filesystem into your kernel, you will 93*9d85025bSMauro Carvalho Chehabsee a new directory entry: ``/proc/sys/dev/parport``. In there will be a 94*9d85025bSMauro Carvalho Chehabdirectory entry for each parallel port for which parport is 95*9d85025bSMauro Carvalho Chehabconfigured. In each of those directories are a collection of files 96*9d85025bSMauro Carvalho Chehabdescribing that parallel port. 97*9d85025bSMauro Carvalho Chehab 98*9d85025bSMauro Carvalho ChehabThe ``/proc/sys/dev/parport`` directory tree looks like:: 99*9d85025bSMauro Carvalho Chehab 100*9d85025bSMauro Carvalho Chehab parport 101*9d85025bSMauro Carvalho Chehab |-- default 102*9d85025bSMauro Carvalho Chehab | |-- spintime 103*9d85025bSMauro Carvalho Chehab | `-- timeslice 104*9d85025bSMauro Carvalho Chehab |-- parport0 105*9d85025bSMauro Carvalho Chehab | |-- autoprobe 106*9d85025bSMauro Carvalho Chehab | |-- autoprobe0 107*9d85025bSMauro Carvalho Chehab | |-- autoprobe1 108*9d85025bSMauro Carvalho Chehab | |-- autoprobe2 109*9d85025bSMauro Carvalho Chehab | |-- autoprobe3 110*9d85025bSMauro Carvalho Chehab | |-- devices 111*9d85025bSMauro Carvalho Chehab | | |-- active 112*9d85025bSMauro Carvalho Chehab | | `-- lp 113*9d85025bSMauro Carvalho Chehab | | `-- timeslice 114*9d85025bSMauro Carvalho Chehab | |-- base-addr 115*9d85025bSMauro Carvalho Chehab | |-- irq 116*9d85025bSMauro Carvalho Chehab | |-- dma 117*9d85025bSMauro Carvalho Chehab | |-- modes 118*9d85025bSMauro Carvalho Chehab | `-- spintime 119*9d85025bSMauro Carvalho Chehab `-- parport1 120*9d85025bSMauro Carvalho Chehab |-- autoprobe 121*9d85025bSMauro Carvalho Chehab |-- autoprobe0 122*9d85025bSMauro Carvalho Chehab |-- autoprobe1 123*9d85025bSMauro Carvalho Chehab |-- autoprobe2 124*9d85025bSMauro Carvalho Chehab |-- autoprobe3 125*9d85025bSMauro Carvalho Chehab |-- devices 126*9d85025bSMauro Carvalho Chehab | |-- active 127*9d85025bSMauro Carvalho Chehab | `-- ppa 128*9d85025bSMauro Carvalho Chehab | `-- timeslice 129*9d85025bSMauro Carvalho Chehab |-- base-addr 130*9d85025bSMauro Carvalho Chehab |-- irq 131*9d85025bSMauro Carvalho Chehab |-- dma 132*9d85025bSMauro Carvalho Chehab |-- modes 133*9d85025bSMauro Carvalho Chehab `-- spintime 134*9d85025bSMauro Carvalho Chehab 135*9d85025bSMauro Carvalho Chehab.. tabularcolumns:: |p{4.0cm}|p{13.5cm}| 136*9d85025bSMauro Carvalho Chehab 137*9d85025bSMauro Carvalho Chehab======================= ======================================================= 138*9d85025bSMauro Carvalho ChehabFile Contents 139*9d85025bSMauro Carvalho Chehab======================= ======================================================= 140*9d85025bSMauro Carvalho Chehab``devices/active`` A list of the device drivers using that port. A "+" 141*9d85025bSMauro Carvalho Chehab will appear by the name of the device currently using 142*9d85025bSMauro Carvalho Chehab the port (it might not appear against any). The 143*9d85025bSMauro Carvalho Chehab string "none" means that there are no device drivers 144*9d85025bSMauro Carvalho Chehab using that port. 145*9d85025bSMauro Carvalho Chehab 146*9d85025bSMauro Carvalho Chehab``base-addr`` Parallel port's base address, or addresses if the port 147*9d85025bSMauro Carvalho Chehab has more than one in which case they are separated 148*9d85025bSMauro Carvalho Chehab with tabs. These values might not have any sensible 149*9d85025bSMauro Carvalho Chehab meaning for some ports. 150*9d85025bSMauro Carvalho Chehab 151*9d85025bSMauro Carvalho Chehab``irq`` Parallel port's IRQ, or -1 if none is being used. 152*9d85025bSMauro Carvalho Chehab 153*9d85025bSMauro Carvalho Chehab``dma`` Parallel port's DMA channel, or -1 if none is being 154*9d85025bSMauro Carvalho Chehab used. 155*9d85025bSMauro Carvalho Chehab 156*9d85025bSMauro Carvalho Chehab``modes`` Parallel port's hardware modes, comma-separated, 157*9d85025bSMauro Carvalho Chehab meaning: 158*9d85025bSMauro Carvalho Chehab 159*9d85025bSMauro Carvalho Chehab - PCSPP 160*9d85025bSMauro Carvalho Chehab PC-style SPP registers are available. 161*9d85025bSMauro Carvalho Chehab 162*9d85025bSMauro Carvalho Chehab - TRISTATE 163*9d85025bSMauro Carvalho Chehab Port is bidirectional. 164*9d85025bSMauro Carvalho Chehab 165*9d85025bSMauro Carvalho Chehab - COMPAT 166*9d85025bSMauro Carvalho Chehab Hardware acceleration for printers is 167*9d85025bSMauro Carvalho Chehab available and will be used. 168*9d85025bSMauro Carvalho Chehab 169*9d85025bSMauro Carvalho Chehab - EPP 170*9d85025bSMauro Carvalho Chehab Hardware acceleration for EPP protocol 171*9d85025bSMauro Carvalho Chehab is available and will be used. 172*9d85025bSMauro Carvalho Chehab 173*9d85025bSMauro Carvalho Chehab - ECP 174*9d85025bSMauro Carvalho Chehab Hardware acceleration for ECP protocol 175*9d85025bSMauro Carvalho Chehab is available and will be used. 176*9d85025bSMauro Carvalho Chehab 177*9d85025bSMauro Carvalho Chehab - DMA 178*9d85025bSMauro Carvalho Chehab DMA is available and will be used. 179*9d85025bSMauro Carvalho Chehab 180*9d85025bSMauro Carvalho Chehab Note that the current implementation will only take 181*9d85025bSMauro Carvalho Chehab advantage of COMPAT and ECP modes if it has an IRQ 182*9d85025bSMauro Carvalho Chehab line to use. 183*9d85025bSMauro Carvalho Chehab 184*9d85025bSMauro Carvalho Chehab``autoprobe`` Any IEEE-1284 device ID information that has been 185*9d85025bSMauro Carvalho Chehab acquired from the (non-IEEE 1284.3) device. 186*9d85025bSMauro Carvalho Chehab 187*9d85025bSMauro Carvalho Chehab``autoprobe[0-3]`` IEEE 1284 device ID information retrieved from 188*9d85025bSMauro Carvalho Chehab daisy-chain devices that conform to IEEE 1284.3. 189*9d85025bSMauro Carvalho Chehab 190*9d85025bSMauro Carvalho Chehab``spintime`` The number of microseconds to busy-loop while waiting 191*9d85025bSMauro Carvalho Chehab for the peripheral to respond. You might find that 192*9d85025bSMauro Carvalho Chehab adjusting this improves performance, depending on your 193*9d85025bSMauro Carvalho Chehab peripherals. This is a port-wide setting, i.e. it 194*9d85025bSMauro Carvalho Chehab applies to all devices on a particular port. 195*9d85025bSMauro Carvalho Chehab 196*9d85025bSMauro Carvalho Chehab``timeslice`` The number of milliseconds that a device driver is 197*9d85025bSMauro Carvalho Chehab allowed to keep a port claimed for. This is advisory, 198*9d85025bSMauro Carvalho Chehab and driver can ignore it if it must. 199*9d85025bSMauro Carvalho Chehab 200*9d85025bSMauro Carvalho Chehab``default/*`` The defaults for spintime and timeslice. When a new 201*9d85025bSMauro Carvalho Chehab port is registered, it picks up the default spintime. 202*9d85025bSMauro Carvalho Chehab When a new device is registered, it picks up the 203*9d85025bSMauro Carvalho Chehab default timeslice. 204*9d85025bSMauro Carvalho Chehab======================= ======================================================= 205*9d85025bSMauro Carvalho Chehab 206*9d85025bSMauro Carvalho ChehabDevice drivers 207*9d85025bSMauro Carvalho Chehab============== 208*9d85025bSMauro Carvalho Chehab 209*9d85025bSMauro Carvalho ChehabOnce the parport code is initialised, you can attach device drivers to 210*9d85025bSMauro Carvalho Chehabspecific ports. Normally this happens automatically; if the lp driver 211*9d85025bSMauro Carvalho Chehabis loaded it will create one lp device for each port found. You can 212*9d85025bSMauro Carvalho Chehaboverride this, though, by using parameters either when you load the lp 213*9d85025bSMauro Carvalho Chehabdriver:: 214*9d85025bSMauro Carvalho Chehab 215*9d85025bSMauro Carvalho Chehab # insmod lp parport=0,2 216*9d85025bSMauro Carvalho Chehab 217*9d85025bSMauro Carvalho Chehabor on the LILO command line:: 218*9d85025bSMauro Carvalho Chehab 219*9d85025bSMauro Carvalho Chehab lp=parport0 lp=parport2 220*9d85025bSMauro Carvalho Chehab 221*9d85025bSMauro Carvalho ChehabBoth the above examples would inform lp that you want ``/dev/lp0`` to be 222*9d85025bSMauro Carvalho Chehabthe first parallel port, and /dev/lp1 to be the **third** parallel port, 223*9d85025bSMauro Carvalho Chehabwith no lp device associated with the second port (parport1). Note 224*9d85025bSMauro Carvalho Chehabthat this is different to the way older kernels worked; there used to 225*9d85025bSMauro Carvalho Chehabbe a static association between the I/O port address and the device 226*9d85025bSMauro Carvalho Chehabname, so ``/dev/lp0`` was always the port at 0x3bc. This is no longer the 227*9d85025bSMauro Carvalho Chehabcase - if you only have one port, it will default to being ``/dev/lp0``, 228*9d85025bSMauro Carvalho Chehabregardless of base address. 229*9d85025bSMauro Carvalho Chehab 230*9d85025bSMauro Carvalho ChehabAlso: 231*9d85025bSMauro Carvalho Chehab 232*9d85025bSMauro Carvalho Chehab * If you selected the IEEE 1284 support at compile time, you can say 233*9d85025bSMauro Carvalho Chehab ``lp=auto`` on the kernel command line, and lp will create devices 234*9d85025bSMauro Carvalho Chehab only for those ports that seem to have printers attached. 235*9d85025bSMauro Carvalho Chehab 236*9d85025bSMauro Carvalho Chehab * If you give PLIP the ``timid`` parameter, either with ``plip=timid`` on 237*9d85025bSMauro Carvalho Chehab the command line, or with ``insmod plip timid=1`` when using modules, 238*9d85025bSMauro Carvalho Chehab it will avoid any ports that seem to be in use by other devices. 239*9d85025bSMauro Carvalho Chehab 240*9d85025bSMauro Carvalho Chehab * IRQ autoprobing works only for a few port types at the moment. 241*9d85025bSMauro Carvalho Chehab 242*9d85025bSMauro Carvalho ChehabReporting printer problems with parport 243*9d85025bSMauro Carvalho Chehab======================================= 244*9d85025bSMauro Carvalho Chehab 245*9d85025bSMauro Carvalho ChehabIf you are having problems printing, please go through these steps to 246*9d85025bSMauro Carvalho Chehabtry to narrow down where the problem area is. 247*9d85025bSMauro Carvalho Chehab 248*9d85025bSMauro Carvalho ChehabWhen reporting problems with parport, really you need to give all of 249*9d85025bSMauro Carvalho Chehabthe messages that ``parport_pc`` spits out when it initialises. There are 250*9d85025bSMauro Carvalho Chehabseveral code paths: 251*9d85025bSMauro Carvalho Chehab 252*9d85025bSMauro Carvalho Chehab- polling 253*9d85025bSMauro Carvalho Chehab- interrupt-driven, protocol in software 254*9d85025bSMauro Carvalho Chehab- interrupt-driven, protocol in hardware using PIO 255*9d85025bSMauro Carvalho Chehab- interrupt-driven, protocol in hardware using DMA 256*9d85025bSMauro Carvalho Chehab 257*9d85025bSMauro Carvalho ChehabThe kernel messages that ``parport_pc`` logs give an indication of which 258*9d85025bSMauro Carvalho Chehabcode path is being used. (They could be a lot better actually..) 259*9d85025bSMauro Carvalho Chehab 260*9d85025bSMauro Carvalho ChehabFor normal printer protocol, having IEEE 1284 modes enabled or not 261*9d85025bSMauro Carvalho Chehabshould not make a difference. 262*9d85025bSMauro Carvalho Chehab 263*9d85025bSMauro Carvalho ChehabTo turn off the 'protocol in hardware' code paths, disable 264*9d85025bSMauro Carvalho Chehab``CONFIG_PARPORT_PC_FIFO``. Note that when they are enabled they are not 265*9d85025bSMauro Carvalho Chehabnecessarily **used**; it depends on whether the hardware is available, 266*9d85025bSMauro Carvalho Chehabenabled by the BIOS, and detected by the driver. 267*9d85025bSMauro Carvalho Chehab 268*9d85025bSMauro Carvalho ChehabSo, to start with, disable ``CONFIG_PARPORT_PC_FIFO``, and load ``parport_pc`` 269*9d85025bSMauro Carvalho Chehabwith ``irq=none``. See if printing works then. It really should, 270*9d85025bSMauro Carvalho Chehabbecause this is the simplest code path. 271*9d85025bSMauro Carvalho Chehab 272*9d85025bSMauro Carvalho ChehabIf that works fine, try with ``io=0x378 irq=7`` (adjust for your 273*9d85025bSMauro Carvalho Chehabhardware), to make it use interrupt-driven in-software protocol. 274*9d85025bSMauro Carvalho Chehab 275*9d85025bSMauro Carvalho ChehabIf **that** works fine, then one of the hardware modes isn't working 276*9d85025bSMauro Carvalho Chehabright. Enable ``CONFIG_FIFO`` (no, it isn't a module option, 277*9d85025bSMauro Carvalho Chehaband yes, it should be), set the port to ECP mode in the BIOS and note 278*9d85025bSMauro Carvalho Chehabthe DMA channel, and try with:: 279*9d85025bSMauro Carvalho Chehab 280*9d85025bSMauro Carvalho Chehab io=0x378 irq=7 dma=none (for PIO) 281*9d85025bSMauro Carvalho Chehab io=0x378 irq=7 dma=3 (for DMA) 282*9d85025bSMauro Carvalho Chehab 283*9d85025bSMauro Carvalho Chehab---------- 284*9d85025bSMauro Carvalho Chehab 285*9d85025bSMauro Carvalho Chehabphilb@gnu.org 286*9d85025bSMauro Carvalho Chehabtim@cyberelk.net 287