Although the below directions work on Raspberry Pi, they should also work on any other system. The brother-provided driver does not run on arm processors[1] like the raspberry pi, so we will instead use the open-source brlaser[2].
Edit: This setup should also work on the following Brother monochrome printers, just substitute the name where needed:
- brlaser 4, just install from package manager: DCP-1510, DCP-1600 series, DCP-7030, DCP-7040, DCP-7055, DCP-7055W, DCP-7060D, DCP-7065DN, DCP-7080, DCP-L2500D series, HL-1110 series, HL-1200 series, HL-L2300D series, HL-L2320D series, HL-L2340D series, HL-L2360D series, HL-L2375DW series, HL-L2390DW, MFC-1910W, MFC-7240, MFC-7360N, MFC-7365DN, MFC-7420, MFC-7460DN, MFC-7840W, MFC-L2710DW series
- brlaser 6, follow full steps below: DCP-L2520D series, DCP-L2520DW series, DCP-L2540DW series (unclear, may only need 4), HL-2030 series, HL-2140 series, HL-2220 series, HL-2270DW series, HL-5030 series
Also, all these steps are command-line based, and you can do the whole setup headless (no monitor or keyboard) using SSH.
- Get the latest raspbian image up and running on your pi, with working networking. At the time of writing the latest version is 10 (buster)–once 11+ is released this will be much easier. I have written a convenience tool[3] for this step, but you can also find any number of standard guides. Log into your raspberry pi to run the following steps
- (Option 1, not recommended) Upgrade to Debian 11 bullseye (current testing release). This is because we need brlaser 6, not brlaser 4 from debian 10 buster (current stable release). Then, install the print system and driver[2]:
sudo apt-get update && sudo apt-get install lpr cups ghostscript printer-driver-brlaser
- (Option 2, recommended) Install ‘brlaser’ from source.
- Install print system and build tools
sudo apt-get update && sudo apt-get install lpr cups ghostscript git cmake libcups2-dev libcupsimage2-dev
- Download the source
wget https://github.com/pdewacht/brlaser/archive/v6.tar.gz && tar xf v6.tar.gz
- Build the source and install
cd brlaser-6 && cmake . && make
&&sudo make install
- Install print system and build tools
- Plug in the printer, verify that it shows up using
sudo lsusb
orsudo dmesg
. (author’s shameful note: if you’re not looking, I find it surprisingly easy to plug USB B into the ethernet jack) - Install the printer.
- Run
sudo lpinfo -v | grep usb
to get the device name of your printer. It will be something likeusb://Brother/HL-2270DW%20series?serial=D4N207646
If you’re following this in the hopes that it will work on another printer, runsudo lpinfo -m | grep HL-2270DW
to get the PPD file for your printer. - Install and enable the printer
sudo lpadmin -p HL-2270DW -E -v usb://Brother/HL-2270DW%20series?serial=D4N207646 -m drv:///brlaser.drv/br2270dw.ppd
Note,-p HL-2270DW
is just the name I’m using for the printer, feel free to name the printer whatever you like. - Enable the printer (did not work for me)
sudo lpadmin -p HL-2270DW -E
- (Optional) Set the printer as the default destination
sudo lpoptions -d HL-2270DW
- (Optional) Set any default options you want for the printer
sudo lpoptions -p HL-2270DW -o media=letter
- Run
- Test the printer (I’m in the USA so we use ‘letter’ size paper, you can substitute whichever paper you have such as ‘a4’).
echo "Hello World" | PRINTER=HL-2270DW lp -o media=letter
(Make sure anything prints)cat <test document> | PRINTER=HL-2270DW lp -o media=letter
(Print an actual test page to test alignment, etc)cat <test document> | PRINTER=HL-2270DW lp -o media=letter -o sides=two-sided-short-edge
(Make sure duplex works if you plan to use that)
- (Optional) Set up an scp print server, so any file you copy to a
/printme
directory gets printed. For the 2270DW, I also have a/printme.duplex
directory.
Links
[1] brother driver does not work on arm (also verified myself)
[2] brlaser, the open-source Brother printer driver
[3] rpi-setup, my convenience command-line script for headless raspberry pi setup
[4] stack overflow answer on how to install one package from testing in debian
There appears to be a typo in step 5A. The page currently reads “lpinfo -m” but I believe should be “lpinfo -v”. Per the man page, the m flag lists drivers and the v flag lists devices.
The USB device can be found in the -v output for step 5A but the driver can be found in the -m output for step 5B.
Thank you so very much for this. Worked like a charm.
Any tips on how to print over the network?
Awesome post. Joel is supposedly correct. It should have been “lpinfo -v” in the step 5A.
Corrected ‘lpinfo -v’, thanks.
No clue how to print over the network, sorry. That’s actually why I set up a raspberry pi to connect to the printer instead–it’s my wifi interface.
I have the Brother HL-2270DW, and I had to install from source to get it to work. I’m not using USB, but port forwarding across via NAT to another internal network.
I just used the cups admin pages to complete setting things up. Before using this package, I picked some other closely related printer. It was printing the page, sucking it back in, then finally printing. Not terrible, but I was annoyed. Now it’s perfect!
For printing over the network, I used the socket::9100 setting. No idea the command line knobs or dials, just did it through the cups web page.
Another reason for me to do this is now my little rasperry pi zero w shows my printer as an AirPrint printer, so now I can print from my iDevices. Brother has their own app for this printer, but I was annoyed having to install a special app for this. My HL2270DW was made without AirPrint. It’s a fine little machine and don’t want to throw it out.
How did you install from source? and how did you do the port forwarding across via NAT to another internal network? I’m new to this so any help would be very much appreciated.
Thank you.
Would this work for brother hl-l2395dw scanner?
Thanks so much for posting this. This helped get my HL-L2300D working properly.
>>> (author’s shameful note: if you’re not looking, I find it
>>>surprisingly easy to plug USB B into the ethernet jack)
I smiled when I saw this because you are clearly a ding dong; that sounds like a rookie mistake.
I couldn’t get your instructions to work, so I tried troubleshooting through Google. Couldn’t figure it out. sudo lpinfo -v | grep usb wasn’t showing jack.
It was because I had my USB B plugged into the ethernet jack of my BR-2270DW.
Everything works now. Thank you so much.
Any steps to do this with a wifi connected HL-2270DW? Thanks!
archive
za3k.com
archiving art backup blog book review cooking crafts dead tree debian electronics email game game design games go hack-a-day hacks hardware linux minecraft music november organization physical piskell pixel art programming publishing recipe research review self-improvement software storage system administration throwaway timelog video video game video games website websites wikipedia yearly review zorchpad