Setting up USB printer

  1. Make sure USB 2.0 and USB printer support are enabled in the kernel. Many printers (even new ones) still use the old USB 1.1 standard, so be sure that is enabled as well.
       CONFIG_USB=y
       CONFIG_USB_DEVICEFS=y
       CONFIG_USB_BANDWIDTH=y
       CONFIG_USB_EHCI_HCD=y
       CONFIG_USB_OHCI_HCD=y
       CONFIG_USB_UHCI_HCD=y
       CONFIG_USB_PRINTER=y
       CONFIG_USB_STORAGE=y
  2. Reboot into the new kernel. The printer setup program in your distribution (e.g., yast2 for SuSE Linux) should now work. Redhat has a different one. If this works, that is all that is needed. If not, you will need to set up the printer manually.
  3. The steps below assume that you're using lprng and that lprng has already been set up correctly. The first step is to create the spool directories in /var/spool/lpd.
    drwx------  2 lp lp  328 Jul 11 20:11 printer1
       cd /var/spool/lpd/printer1
       touch acct control.lp control.printer1 lock\
       log lp  lpq.0 printer1  status status.lp \ 
       status.printer1  unspooler.lp  unspooler.printer1   
       chown lp.lp *
       chmod 600 *
  4. Type lsusb (as root) and make sure your printer shows up.
  5. Find out your printer's device name:
    $ dmesg | grep print
    drivers/usb/class/usblp.c: usblp0: USB 
    Bidirectional printer dev 2 if 0 alt 0 
    proto 2 vid 0x043D pid 0x0070
    In this case, the printer was /dev/usblp0, and there was a corresponding character device in /dev. Set its permissions to 777 so everyone can print.
    crwxrwxrwx 1 root lp 180, 0 Mar 23  2002 /dev/usblp0
    You could also find it by typing cat /etc/hosts > /dev/usb/lp0 and testing each device until you get some message other than "No such device".
  6. Add an entry to /etc/printcap
       printer1:\
            :cm=lpdfilter drv=upp method=auto dpi=600 color=yes:\
            :lp=/dev/usb/lp0:\
            :sd=/var/spool/lpd/printer1:\
            :lf=/var/spool/lpd/printer1/log:\
            :af=/var/spool/lpd/printer1/acct:\
            :if=/usr/lib/lpdfilter/bin/if:\
            :la@:\
            :tr=:cl:sh:
  7. Alternatively, if the printer has a network interface, add this to /etc/printcap:
       lp:\
            :cm=lpdfilter drv=upp method=auto color=yes:\
            :rm=192.168.100.6:\
            :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:
    and create an executable file named 'lpf' in /usr/lib, that is:
    -rwxr-xr-x  1 root root 105 Sep 16 23:20 /usr/lib/lpf
    This file should contain something like:
       #!/bin/sh
       if [ "$1" = c ]; then
          cat
       else
       /  sed -e s/$/^M/
       fi
       # The echo -ne assumes bash
       echo -ne \\f
       
    (where '^M' is the control-M character).
  8. Restart lpd
       /etc/rc.d/lpd restart 
  9. It should be working now.

Back