The Brother DCP-7030, DCP-7055 and DCP-7065DN are nice and cheap laser printers and, although they claim Windows, Mac and Linux compatibility, the linux compatibility has some fine prints. Brother provides binary drivers for RPM and Debian-based linux but no source code. If you are running linux on ARM, FreeBSD or any non-RPM or non-Debian-based linux, you will be out of luck with these binary drivers.
While there are some instructions out there to run Brother binary linux drivers in Linux compatibility mode under FreeBSD, this can be cumbersome to setup in a FreeNAS jail and will still not work on ARM-based setups.
I spent a day figuring out how to make my DCP-7065DN work with CUPS in a FreeNAS jail so that it could be published as an Airprint printer for my iOS devices. Here is how I got it to work (the same instructions are likely to work on any “nonstandard” linux setup).
Overview of the process
For this setup, we will need to:
- Install CUPS and Avahi (Avahi is what allows Airprint to work)
- Compile and install open source Brother drivers
- Setup CUPS and Avahi/Airprint
Installing CUPS and Avahi
Follow your normal install procedure to install these. Under FreeBSD, the binary packages work fine. I ended up installing the following:
pkg install avahi-app avahi dbus avahi-dnsconfd cups
Note that DBUS is also needed for this setup to work (it wasn’t already installed in my FreeNAS Jail).
Once these are installed, configure your CUPS to your liking. On my setup, given that CUPS is only accessible from my local network, I removed most security using the following settings in /usr/local/etc/cups/cupsd.conf:
# # Configuration file for the CUPS scheduler. See "man cupsd.conf" for a # complete description of this file. # # Log general information in error_log - change "warn" to "debug" # for troubleshooting... LogLevel warn PageLogFormat # Only listen for connections from the local machine. #Listen localhost:631 #Allow remote access Port 631 Listen /var/run/cups/cups.sock # Show shared printers on the local network. Browsing On BrowseLocalProtocols dnssd # Default authentication type, when authentication is required... DefaultAuthType Basic # Web interface setting... WebInterface Yes # Misc FileDevice Yes ServerAlias * DefaultShared yes DefaultEncryption Never # Allow access to the server... Order allow,deny Allow all
Once CUPS is installed, make sure to enable it in /etc/rc.conf by adding the following (we’ll also enable DBUS and Avahi while we are at it):
cupsd_enable="YES" avahi_daemon_enable="YES" avahi_dnsconfd_enable="YES" dbus_enable="YES"
You can then start CUPS like so:
services cupsd start
Once CUPS is started, point your browser to http://<localhost or your IP>:631 and confirm that everything is up and running.
We are now ready to compile the open source Brother print drivers…
Compiling and installing the open source Brother drivers
This is only needed if you cannot run the original Brother drivers (if you are running a RPM or Debian-based system, by all means, go with the official Brother drivers).
I found open source Brother drivers here: https://github.com/pdewacht/brlaser
Unfortunately, these did not compile under FreeBSD so I forked the code and made some tweaks to make them compile. The result is here: https://github.com/colddiver/brlaser
Follow the instructions on GitHub to compile and install the drivers.
Once installed, you will be ready to setup your printer and to configure AirPrint…
Setting up the Brother Printer and Airprint
I followed a guide available here: https://davidandrzejewski.com/2015/12/26/make-any-printer-airprint-compatible-on-freebsd/ and adapted some steps for my setup.
This can be done using the CUPS web interface as follows:
- Navigate to http://<localhost or your IP>:631 and click on the Administration menu
- Click Add Printer
- If your Brother printer is already on the network or connected to your CUPS server through USB, chances are that it will show up under the “Discovered Network Printers”. Select it if that’s the case. If not, use select the “lpd” option and type the IP address of your printer
- Make sure to check the “Share This Printer” box
- In the next screen, navigate to your Brother print drivers. The open source drivers will show up as <Printer Model> using brlaser v3
- Once setup, print a test page (from the printer’s “Maintenance” menu) to confirm that everything works.
If all went well, the test page should print OK.
Next, we need to configure CUPS with the AirPrint MIME types. You can do so by issuing the following commands (this is for FreeBSD – paths will change under a different distro):
echo "image/urf urf string(0,UNIRAST)" > /usr/local/share/cups/mime/airprint.types echo "image/urf application/vnd.cups-postscript 66 pdftops" > /usr/local/share/cups/mime/airprint.convs echo "image/urf application/pdf 100 pdftoraster" > /usr/local/share/cups/mime/airprint.convs
Restart CUPS (service cupsd restart).
We are now ready to setup Airprint… To do so, we will use a Python script to generate the necessary Avahi services. To use this script, I had to install Python PIP manually by issuing the following (this is assuming you already have Python installed – adjust to your version /usr/local/bin/python):
python2.7 -m ensurepip
We also need PyCUPS. This can be installed by issuing:
CPATH=/usr/local/include pip install pycups
Now we can download the airprint-generate Python script like so:
The original guide suggests that we need to modify the script like so:
In the section setting ‘DOCUMENT_TYPES’, add a new line just under “‘application/postscript’: True,” that says “‘application/vnd.cups-postscript’: True”.
Run the script by issuing :
This will create a .service file in the current directory for each of the printers you have set up in CUPS. Put these service files into the Avahi service directory:
mv *.service /usr/local/etc/avahi/services
Finally, restart avahi-daemon and avahi-dnsconfd:
service avahi-daemon restart service avahi-dnsconfd restart
At this point, you should be able to AirPrint from your iOS devices.read more