Hackviking He killed Chuck Norris, he ruled dancing so he took up a new hobby…

1Mar/172

RaspberryPI: Print server

The goal for this build was to create a print server for my Brother HL-110 and Dymo LabelWriter 450 that could be used by both Mac and Windows. It turned out to be more tricky then I expected! After some research, testing and re-installs I came up with a solution that worked. It involves compiling drivers, setting up CUPS and samba to get all the parts to work properly.

Basic install

As usually I used Win32DiskImager to get Raspbian onto an SD-card. After that I added a blank file named ssh on the boot volume. That will enable ssh right away and eliminate the need for hooking up a monitor and keyboard just to enable it. Then boot up the raspberry pi and check your DHCP server/router for what IP-address it was assigned and SSH into it. First we want to make sure everything is up to date...

sudo apt-get update
sudo apt-get upgrade

Install CUPS

CUPS is an open source printing system developed by Apple for MacOS and other Linux based systems. It has full ARM support but the availability of the printer drivers may wary from manufacturer to manufacturer. If source code is provided you can compile the the drivers your self but if none is available you might end up using the same trick I did. Let's install and configure CUPS.

sudo apt-get install cups cups-pdf

Add the account pi to the lpadmin group.

sudo usermod -a -G lpadmin pi

Then we need to edit the CUPS config file /etc/cups/cupsd.conf and remove the limitation that the admin interface is only accessible from localhost. Open up the config file:

sudo nano /etc/cups/cupsd.conf

Replace the line:

Listen localhost:631

With:

Port 631

This instructs CUPS to listen for any contact on any networking interface as long as it is directed at port 631.

Scroll further down in the config file until you see the “location” sections. Set it up to allow connections from the local network.

< Location / >
# Restrict access to the server...
Order allow,deny
Allow @local
< /Location >

< Location /admin >
# Restrict access to the admin pages...
Order allow,deny
Allow @local
< /Location >

< Location /admin/conf >
AuthType Default
Require user @SYSTEM

# Restrict access to the configuration files...
Order allow,deny
Allow @local
< /Location >

Now you can restart the cups service and browse to <pi_ip_address>:631 and you should see the CUPS interface. Next step is to add our printers. When writing this there is no pre-compiled Linux drivers available for my Dymo LabelWriter 450 or my Brother HL-1110 and I don't expect it to be either.

Compile the Dymo LabelWriter 450 drivers

In the cups interface you can add the Dymo right away with a built in generic driver. This will not work for anything else then windows machines. Since windows installs it's own drivers locally it doesn't really matter what driver is installed or not on the CUPS server. It's only a communication mechanism to the printer it self. Since I want to use the printers from both my windows and Mac computers I need the proper drivers where available. First we need to install dependencies for the compilation of the driver:

sudo apt-get install libcups2-dev libcupsimage2-dev g++

Then we can download the Dymo CUPS drivers source code, unpack it and compile it:

wget 'download.dymo.com/dymo/Software/Download Drivers/Linux/Download/dymo-cups-drivers-1.4.0.tar.gz'
tar xvf dymo-cups-drivers-1.4.0.tar.gz
cd dymo-cups-drivers-1.4.0.5/
sudo ./configure
sudo make
sudo make install

Now when we go to add the driver via the CUPS web interface the proper driver should show up. This will allow you to use the printer both from Mac, who will discover it over Bonjour, and windows. To add it in windows just navigate to the printer in the web interface and copy the url. The Add Printer wizard in windows will take that straight of and all you need to do is supply the proper windows drivers for the printer that you downloaded.

Workaround for the Brother HL-1110

As stated before the Brother HL-1110 works fine shared from CUPS on a windows machine since it installs it's own drivers. I tested around for a bit with different drivers supplied with CUPS for different Brother printers with similar specs without success. I did find a deeply hidden file to download from brother with the source but it couldn't be compiled straight of and gave me a lot of issues even when I thought I built it correctly.

Drivers for this printer is available for Linux but not for the ARM architecture. So it shouldn't be a problem connecting to this printer from another Linux machine using local drivers, when I write this I haven't tried it yet.

The Mac doesn't allow you to add any other drivers when connecting to the printer over the Bonjour announced print share. So I installed samba on the pi and added the printer that way. Simple install:

sudo apt-get install samba

I left all the settings as is and then browsed for a windows printer on my Mac. Found the workgroup and then printerpi (thought it was a proper name for this) and then added the printer. This way I got to specify the Mac drivers I wanted to use.

Conclusion

Not the perfect solution that I wanted. Just wanted a cheap printer for a project that required A4 and label printing so I just ordered the cheapest printers they had in stock. After this I would recommend you to check for a printer with proper drivers or proper source code available for Linux and the ARM architecture. It is a bit ironic that the open source solution developed by Apple works fine under any circumstance for my windows machines while samba or SMB who is much more common in the windows world sorts out my Mac issue.

Posted by Kristofer Källsbo

Comments (2) Trackbacks (0)
  1. Hi there,

    I have the same printer (Brother HL-1110), but I can’t get it to work with my raspberry pi. As far as I understood the problem, the rpi is equipped with an ARM Cpu but the brother packages are are made for 32/64 bits CPUS.

    I installed Samba, but it dosent seems to work either.

    Help please ?

  2. Correct the brother printer has no arm drivers. What I managed to do in my workaround mentioned in the post is to bypass the drivers on the Pi and use local drivers on the printing machines. Printing from the Pi it self will not work just from another machine over the network. The samba is used to force the Mac computers to use local drivers instead of spooling to the CUPS driver on the Pi, which in this case doesn’t exist.


Leave a Reply

No trackbacks yet.