On Mon, 10 Jul 2000, Horacio MG wrote: > Hi, > > (please, Cc: the answer to me as I'm not on the list) > > just got this new brand printer, and I'm trying to get something printed > with it, but never configured a printer before now. >
Hello Horacio, printing under linux is achieved by the cooperation of different pieces of software. The general picture is as follows: kernel: the only thing it knows about printing is how to squeeze bytes through a parallel port in a way ("protocol") a printer can receive them. The kernel doesn't know what those bytes mean or how to tell the printer what to do with them. A user or program can take advantage of this kernel feature by writing data to one of the /dev/lp* devices. Most (not all) printers interpret the bytes they receive as plain text and print them in a fixed width font unless special control bytes are sent. Try a "ls > /dev/lp0" command and see what happens. lpr/lpd: * writes data to devices in the right order for printing (so two users/programs trying to print at the same time will get their two documents intead of one big mess). * can optionally transform your data into something meaningful for your printing hardware by invoking so-called "printing filters" (see below) before it gets printed. These are not part of the lpr package, you have to supply them. * Is usually sufficient to print plain text in the default font, but by itself doesn't know how to address the better features (graphics, nice fonts, etc.) of any given printer. A printcap entry associates a collection of configuration data (/dev/lp* device, filters to use, spool directory and other nifty stuff) with one or more friendly names. This is what lpr calls a "printer". The printer names can be chosen totally arbitrary. The only exception is that if you don't specify a printer to lpr, it assumes you mean printer "lp". Thus, one of the names of the most frequently used printer should be lp. printing filters: look at the data they're given, determine the data format (PostScript, jpeg image, man page, etc.) and try to translate it into the language (e.g. PCL for HP LaserJet or ESC/P for Epson dot matrix printers) some specific printing hardware understands. Most filters will in turn use other programs like ghostscript for substantial parts of the work they have to do. The Debian distro contains at least two printing filter packages, magicfilter and apsfilter, both containing filters for a collection of different printer models. Their respective configuration scripts will ask you some questions and then create a suitable printcap entry for you. Personally, I prefer magicfilter, but the important question is not taste but whether one of the packages contains a filter that will translate into a language your Xerox DocuPrint knows. Have a look at both. > The printer is recognized, as advertised by the relevant parts of dmesg: > > parport0: PC-style at 0x378 [SPP,ECP,ECPEPP,ECPPS2] > parport0: detected irq 7; use procfs to enable interrupt-driven > operation. > parport0: Printer, Xerox DocuPrint C15 Recognized is a bit too much. The message just means the thing wired to the first parallel port has identified itself as a printer called "Xerox DocuPrint C15". > > lp0: using parport0 (polling). > So the right device to send bytes to the printer is /dev/lp0 > > I had lpr installed, and have just installed several other programs > (Aladdin Ghostscript). Then went to read the relevant howtos, but I > can't see it clear enough. > > I've tried to print a postscript file from 'gv', and also tried a > simpler 'man man | col -b | lpr', but all I get is those jobs in the > spool: > > $ lpq > waiting for lp to become ready (offline ?) > Rank Owner Job Files Total Size > 1st horacio 2 /home/horacio/tmp/phakic.ps 496596 bytes > 2nd horacio 5 (standard input) 23645 bytes > > and the status is: > > $ lpc status > lp: > queuing is enabled > printing is enabled > 2 entries in spool area > waiting for lp to become ready (offline ?) > > Ok, so there must be something I haven't done... sure, I haven't set the Yes, your /etc/printcap is wrong. See below. > environment variable in .profile. According to the howtos this should > be set as: > > PRINTER="printer_name"; export PRINTER Shouldn't be necessary if you have only one printer. Just call the printcap entry "lp". > > Ah, but what's printer_name? Is it perhaps that I have to make a > symlink in /dev/ to /dev/lp0 (say, /dev/xerox -> /dev/lp0), and then: > > PRINTER="xerox"; export PRINTER > > or? No. > > Also, I didn't apply any changes to /etc/printcap, so the only > uncommented lines are: > > lp|Generic dot-matrix printer entry:\ > :lp=/dev/lp1:\ ^^^ If you change this to lp0, you may at least be able to print plain text. There is nothing connected to lp1 (most likely you don't have a lp1 at all) so lpd cannot get the data sent out. > :sd=/var/spool/lpd/lp:\ > :df=/etc/filter.ps:\ > :tf=/etc/filter.pcl:\ > :af=/var/log/lp-acct:\ > :lf=/var/log/lp-errs:\ > :pl#66:\ > :pw#80:\ > :pc#150:\ > :mx#0:\ > :sh: > > should I then change "Generic" by "xerox"? And how about the > "dot-matrix" stuff? My printer is a deskjet! Does that mean your Xerox is HP DeskJet compatible? If so, both magicfilter and apsfilter will work. > > In case it's of any importance, my /var/spool/lpd/lp/ dir looks: > > > total 520 > 1 drwxrwxr-x 2 root lp 1024 jul 10 17:47 ./ > 1 drwxrwxr-x 5 root lp 1024 jul 10 16:08 ../ > 1 -rw-r----x 1 root lp 4 jul 10 17:47 .seq > 1 -rw-rw---- 1 daemon lp 102 jul 10 17:15 cfA002AL6s9Ty > 1 -rw-rw---- 1 daemon lp 72 jul 10 17:47 cfA005An49Sei > 488 -rw-rw---- 1 horacio lp 496596 jul 10 17:15 dfA002AL6s9Ty > 25 -rw-rw---- 1 horacio lp 23645 jul 10 17:47 dfA005An49Sei > 1 -rw-r--r-- 1 root root 4 jul 10 17:15 lock > 1 -rw-rw-r-- 1 root root 43 jul 10 17:15 status > Looks fairly normal. > > where the file lock is a number... meaning? The process ID of the lpd process trying to print to "printer" lp at the moment. This is to ensure concurrent print jobs won't mess up each other. Completely allright. HTH, Björn -- Bj"orn Brill <[EMAIL PROTECTED]> Frankfurt am Main, Germany