Printer Setup

Applicable to: FreeBSD 3.x, 4.x
Updated: March 5, 2000

This Sheet describes the procedure I used to set-up my HP LaserJet 2100 on my FreeBSD machine. Once this setup is completed, FreeBSD can act as a print server (via Samba) for other computers on the local network.

  1. Ensure support for the parallel ports is included in the kernel. If not, edit /usr/src/sys/i386/conf/PANDORA and compile a new kernel:
    # Parallel port LPT0 and LPT1 (on add-in card)
    controller      ppbus0
    controller      ppbus1
    device          ppc0    at isa? port? tty irq 7
    device          ppc1    at isa? port? tty irq 9
    device          lpt0    at ppbus0
    device          lpt1    at ppbus1

    See the Cheat Sheet Building a Custom Kernel for the steps needed to recompile your kernel.

  2. Make sure that the device nodes /dev/lpt0 and /dev/lpt1 are created; otherwise, create them:

    # cd /dev
    # ./MAKEDEV lpt0
    # ./MAKEDEV lpt1

  3. Ensure that the printer is connected to the computer.

  4. Test the connection between the computer and the printer. The traditional way is to use lptest:

    # lptest > /dev/lpt0

  5. Unfortunately, HP LaserJets will not respond to this plain-ascii output. Therefore, to test the devices, use a Windows machine to print from Word, and print the results to the file test.prn. Copy (or FTP) this file to the FreeBSD machine, and then send it to the printer:

    # cat test.prn > /dev/lpt0

    With this test file, the printer should respond.

  6. Edit /etc/printcap:

    Pandora:

    # HP LaserJet 2100 Series PCL 6
    lp|lj|HP LaserJet 2100 Series PCL 6:\
        :lp=/dev/lpt0:sd=/var/spool/output/hplj:\
        :lf=/var/log/lpd-errs:sh:mx#0:\
        :if=/usr/local/libexec/lpfilter:

    Renata:

    # HP DesignJet 600 on lpt0
    plotter|HP DesignJet 1050C:\
        :lp=/dev/lpt0:sd=/var/spool/output/plot:\
        :lf=/var/log/lpd-errs:sh:mx#0:
    	
    # HP LaserJet 5 on lpt1
    lp|lj|HP LaserJet 5:\
        :lp=/dev/lpt1:sd=/var/spool/output/hplj:\
        :lf=/var/log/lpd-errs:sh:mx#0:\
        :if=/usr/local/libexec/lpfilter:

  7. Create the LaserJet filter /usr/local/libexec/lpfilter:

    #!/bin/sh
    printf "\033&k2G" && cat && printf "\033&l0H" && exit 0
    exit 2

    Be sure to make this file executable.

  8. Edit /etc/rc.conf:
    lpd_enable="YES"              # Run the line printer daemon.
    lpd_program="/usr/sbin/lpd"   # path to lpd, if you want a different one.
    lpd_flags=""                  # Flags to lpd (if enabled).

  9. Start the spooler:

    # /usr/sbin/lpd

  10. Test the spooler:

    # cat test.prn | lpr (Defaults to lp, may also use -Plp)

  11. Test the LaserJet filter:

    # lptest 40 20 | lpr




http://www.mostgraveconcern.com/freebsd/
Questions or Comments? Contact Us...