Setting up USB printer in Suse 11
When my Lexmark E323n printer got struck by lightning, it lost the ability to print over the network. Luckily, only the network card was destroyed and USB printing still worked. This page documents how to set up USB printing in Linux.
Plug the printer in to a USB port and monitor the system logs to make sure
Linux can see it. As shown below, the computer assigned it to
(which is a link to
/dev/usb/lp0). On my computer, only the USB
ports on the back of the computer worked in Linux. Ports on the front and top
crw-rw---- 1 root lp 180, 0 2012-08-12 08:01 /dev/usb/lp0
The logs should look something like this:
Aug 12 08:01:58 nitrogen kernel: usb 2-4: new full speed USB device using ohci_hcd and address 9 Aug 12 08:01:58 nitrogen kernel: usb 2-4: configuration #1 chosen from 1 choice Aug 12 08:01:58 nitrogen kernel: usblp0: USB Bidirectional printer dev 9 if 0 alt 0 proto 2 vid 0x043D pid 0x0070 Aug 12 08:01:58 nitrogen kernel: usb 2-4: New USB device found, idVendor=043d, idProduct=0070 Aug 12 08:01:58 nitrogen kernel: usb 2-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 Aug 12 08:01:58 nitrogen kernel: usb 2-4: Product: Lexmark E323 Aug 12 08:01:58 nitrogen kernel: usb 2-4: Manufacturer: Lexmark International, Inc. Aug 12 08:01:58 nitrogen kernel: usb 2-4: SerialNumber: 8909GRX
Lprng works with a USB printer, provided the OS can see the printer. Below is a printcap that works on my system:
lp:\ :cm=lpdfilter drv=upp method=auto dpi=600\ :lp=/dev/usb/lp0:\ :sd=/var/spool/lpd/lp:\ :lf=/var/spool/lpd/lp/log:\ :af=/var/spool/lpd/lp/acct:\ :if=/usr/lib/lpf:\ :la@:\ :tr=:cl:sh:
Lpf is a little script that gets rid of the staircase effect (yes, Linux still has this
after all these years). This must be executable, or nothing will be printed.
-rwxr-xr-x 1 root root 105 2012-07-31 10:20 /usr/lib/lpf
#!/bin/sh if [ "$1" = c ]; then cat else sed -e s/$/<cr> fi # The echo -ne assumes bash echo -ne \\f
This file contains binary characters, so typing the above won't work unless you change the <cr> to a real CR (Nedit is useful for this). The file is available here.
Suse's Yast2 administration tool found the printer, but insisted on replacing
Lprng with Cups. So, just for fun, I set up the printer in Cups. Yast2 installed
quite a lot of stuff, then hung while trying to configure it. It also deletes your
The preferred way to set up a USB printer in Cups is with a web browser.
Unlike Lprng, Cups requires a printer-specific "driver," which is Linux's way of
making sure we always stay five years behind Windows. But once the proper driver is
selected, it works. Cups overwrites your
/etc/printcap file to look like this:
and automatically starts up the print daemon,
Once you set your printer as the "default" by clicking the "Set as Default" button,
you can print by typing commands like
lp mydocument or
lp -d Lexmark mydocument.
Cups was also able to print Postscript files, but on my E323 the document was always chopped off at the bottom and the "Error" LED on the printer was always set. This may be because the closest driver available was for the Lexmark E321, or because of an error in the driver. This highlights the weakness of the CUPS system. If a driver for your printer is not available, or has bugs, you're screwed even if your printer natively handles PostScript (as the E323 does). This is why operating systems and programs that require the user to install drivers are an abomination upon the Earth. Other than that, Cups is great. But we curmudgeons prefer lprng, which adheres to the Unix philosophy of doing a single thing well, without requiring X Windows and a Web browser to set it up, and can send a PostScript file to a printer without mangling it.
Cups Documentation can be found at http://www.cups.org/doc-1.1/sam.html.