technology free software achievement
Using the Brother printer drivers with FreeBSD
A while ago I acquired a Brother laser printer, model HL-2030. This is a cheap printer with excellent printing quality (up to 1200dpi) and power saving features. Moreover, it supports the standard printer language PCL-5 which makes it “polite” to free and open operating systems — such as, GNU/Linux and FreeBSD.
On Linux, the Brother printers are fairly well supported. There is a lot of information on what drivers to use on LinuxPrinting.org and several good hints for the printer HL-2030 are hinted there as well. Brother also provides official Linux drivers that give access to all the printer features.
Using the generic driver
Unfortunately, Brother “officially” indicates that they do not have specific drivers for FreeBSD, and that FreeBSD users should use the generic drivers. Of course, using this printer (as well as many others from Brother) with FreeBSD is possible using CUPS and the generic printer drivers provided in the packages Gutenprint and/or Foomatic. For example, with my HL-2030 printer I proceeded as follows to use the generic driver:
- install and setup CUPS (not covered here, there is a section for it in the FreeBSD documentation)
- setup appropriate permissions on /dev/unlpt0 (USB device for the printer) — I used root:cups 0664
- generate and download the PPD file for HL-2060, (HL-2060 is a compatible printer)
- setup CUPS to use this PPD file and the USB device (use device “no-reset”) to reach the printer.
That works very well, but I wasn’t satisfied because it supports only resolutions up to 600dpi, and the paper margins are not well defined.
Using the Brother driver
Hopefully, I found possible to use the official Linux drivers provided by Brother on FreeBSD. This is made possible by the Linux emulation layer on FreeBSD.
Note the following:
- CUPS should already be installed and running, and the printer should have been tested first using the generic driver as described above. Rationale: if the printer or the USB device somehow don’t work, the official driver can’t do anything about it.
- This has been tested on FreeBSD 7.0 for i386 (32bit). See notes below for some hints for the x86_64 architecture (64bit) and other versions of FreeBSD.
Here are the steps:
- install the Linux compatibility libraries through port emulators/linux_base-fc7. Likely you need to set the Linux kernel version high enough prior to installing the port, using for example sysctl -w compat.linux.osrelease=2.6.9 (save to /etc/sysctl.conf to make the setting persistent).
- install print/psutils which contains pstops required by the Brother drivers.
- download the LPR driver and CUPS driver for your printer from Brother. Download specifically the Debian .deb files.
- extract manually the contents from the .deb files. They are .tar.bz2 files in disguise: use the command tar -xjf
- place manually the files in the appropriate FreeBSD directories:
- .so in /compat/linux/usr/lib
- bins in /usr/local/bin
- Brother-specific files in /usr/local/Brother
- CUPS data+filter in /usr/local/share/cups and /usr/local/libexec/cups
- edit all the script files included in the .deb and change the
following:
- all references to files included in the .deb should be modified to point to their new FreeBSD location
- references to other tools (gs, pstops…) should be modified to point to /usr/local/bin instead of /usr/bin
- use path to USB device /dev/unlpt0 instead of /dev/usb/…
- the LPR installation script may contain commands to change the owner/group of files in /var/spool/lpd. Replace with user “root” and group “daemon” instead of the default “lp”.
- open the “postinst” scripts from both .debs and read what commands they use to setup the printer, and execute them manually (LPR driver first, then CUPS driver). This should register the Brother PPD file into CUPS and create the printer configuration.
Et voilà!
If anyone volunteers to create a FreeBSD port, that would be great.
Special Notes
Users of FreeBSD x86_64: the binaries and libraries provided by Brother are compiled for Linux 32-bit. You need to ensure that your linux_compat package supports running 32-bit binaries.
Previous versions of FreeBSD: you are on your own. The steps above are untested. It may be that the USB stack in previous versions of FreeBSD (than 7.0) cannot send data to Brother printers.
USB device: the standard USB printer device file on FreeBSD (/dev/ulpt0) fails with (some) Brother printers. Use the non-reset /dev/unlpt0 instead. This works. The drawback is that the printer needs to be switched off and on when an error occurs (the driver cannot reset the printer using this device).