The first section involves setting up access to printers on FreeBSD 6.2.
The second section involves setting up access to printers on FreeBSD 4.9.
My computer running 6.2 has an AMD 64-bit processor, and the built-in line printer daemon would not work, so I switched to using CUPS.
I'm still polishing these instructions since I configured printing on CUPS without logging my actions as I went along, so I'm reproducing from memory and from the various command shells and web browser tabs holding the information I'm reporting here.
My printer (Canon BJ200 - an old one) has a parallel interface, so I'll only talk about parallel interface setup.
Ensure the kernel recognizes the parallel port device (/dev/ppc0) and the printer port device (/dev/lpt0). Do this by grep ppc /var/run/dmesg.boot and grep lpt /var/run/dmesg.boot - if these aren't there, read the FreeBSD handbook about this.
Ensure the kernel supports the port. You already did the first part by ensuring the device entries exist. By default, interrupt-driven communications mode is set up for the port, using an IRQ.
Test the port by:
# lptest > /dev/lpt0
and seeing if you get output from the printer.
Modify the permissions and ownership of the parallel printer port device by changing its ownership as follows:
chown root:cups /dev/lpt0
and its permissions as follows
chmod g+rw /dev/lpt0
Make these changes permanent by adding the following lines to /etc/devfs.conf:
own lpt0 root:cups
perm lpt0 0660
Add the following line to /etc/rc.conf so that you can run the cupsd control script while you are setting up the system and so that cupsd will be started upon boot. The cupsd control script will invoke cupsd only if this control value is set in /etc/rc.conf, whether run from the command line or while booting.
cupsd_enable="YES"
If you run lpd, remove the lines for lpd in /etc/rc.conf
The lpd client utility programs lpr, lpq, and lprm are part of the operating system and are located in /usr/bin, while the CUPS client programs that are named are part of a third-party port and are located in /usr/local/bin. By default, /usr/bin is placed before /usr/local/bin in the default PATH environment variable, so if you use those programs, you will end up using the lpd versions of the programs instead of the CUPS versions unless you make one of the following changes:
Build the following ports:
Obtain a printer configuration file for your printer and install it so CUPS can use it to configure your printer.
The PPD file goes in /usr/share/cups/model/.
I had the problem of the printer printing too slowly (one printer head pass, wait a long time, then another printer head pass) where a clue is an entry in /var/log/messages mentioning interrupt throttling and interrupt storm.
Try out the following to change the parallel port into polling mode from the default interrupt mode:
lptcontrol -p -d /dev/lpt0.ctl
To set the parallel port permanently in polling mode upon subsequent boots, add the following to /boot/device.hints:
hint.ppc.0.flags="0x28"
The bit mask is as follows:
Start cups with /usr/local/etc/rc.d/cupsd start. Access the CUPS administration page at http://localhost:631. Create the printer; you should see the parallel port in the list of devices and the entry for your printer matching the PPD file you installed. Generate a test page using the admin interface.
Check out Roland's FreeBSD Page, Foomatic - Installing a Printer, Printer Compatibility, CUPS User Documentation
This is obviously older stuff, and CUPS has changed since then.
Read the FreeBSD Handbook section on printing - this page follows that closely.
My printer (BJ200 - it's an old one) has a parallel interface, so I'll only talk about parallel interface setup.
Ensure the kernel recognizes the parallel port device (/dev/ppc0) and the printer port device (/dev/lpt0). Do this by grep ppc /var/run/dmesg.boot and grep lpt /var/run/dmesg.boot - if these aren't there, read the FreeBSD handbook about this.
Ensure the kernel supports the port. You already did the first part by ensuring the device entries exist. By default, interrupt-driven communications mode is set up for the port, using an IRQ.
Test the port by:
# lptest > /dev/lpt0
and seeing if you get output from the printer.
I'm just using plain old lpd for now.
Do just like the handbook section 11.3.1.4 says, and create an entry in /etc/printcap for your printer
Prepare for building the print/cups meta-port by adding the following entries to /etc/make.conf:
CUPS_OVERWRITE_BASE=yes allows you to build the CUPS binaries that replace the FreeBSD-supplied lp/lq/lpr/lprm binaries in /usr/bin. NO_LPR=yes prevents future operating system rebuilds/upgrades from overwriting the CUPS binaries. See /usr/ports/print/cups-lpr/Makefile for the note on the make flag CUPS_OVERWRITE_BASE.
Then, build the print/cups meta-port. As part of the build of print/cups-lpr, the FreeBSD- supplied lpr binaries will be renamed with a .bak extension, so you can still have access to them.
Kill your existing lpd, and remove the parameters in /etc/rc.conf that starts it on system startup.
Run the CUPS daemon by entering cupsd at the command line (as root).
You can use the lpadmin command line program to administer the CUPS daemon. Try the web interface at http://localhost:631/ for a GUI experience.
Choose Create printer, define a name, indicate the device. If the device is a network printer that provides an IPP interface, choose ipp, then set the URI as ipp://ip-address:631. Choose the driver for your printer, or choose Generic.
For PDF viewers (on KDE), specify that they should use CUPS for printing.
For OpenOffice, run the spadmin program in the (installpath)/program directory - see the help topic on "Setting up Printer, Fax, and Fonts Under UNIX Based Programs".
The CUPS startup script is located at /usr/local/etc/rc.d/cups.sh.sample - you will probably have to rename this.
Software development | Tutoring | Computer Security | Video | Contact |