Brother HL-5150D

From Gentoo-en
Jump to: navigation, search

The Brother HL-5150D is a USB black and white laser printer for use in small offices or at home. It works in Linux using CUPS and Brother's lpr driver and cupswrapper.

Before we start...

Brother-provided PPD file

Brother does provide a PPD file for this printer, so in theory installation should be a breeze using Cups' built-in printer installation wizard. However, Brother printers installed that way often don't work correctly, in particular they tend to misalign the printed content on the page, leading to margins being too small or too wide or text being cut off. This is due to the driver being buggy with regards to paper size and who knows what else. The method described below leads to a fully working printer.

64bit Systems

The steps below work for 64bit systems.


Setting up the Kernel

If you use Cups 1.3.x, you need USB Printer Support enabled in your kernel. Cups 1.4.x brings its own kernel module, so if you use that version, remove USB Printer Support from your kernel to avoid conflicts.

Installing required packages

  • You'll need to install net-print/cups on your system if you haven't done that already. For more information on that subject please refer to the article CUPS.
  • You'll need app-arch/rpm2targz to unpack the downloaded .rpm files.
  • On an amd64 non-multilib system, you need app-emulation/emul-linux-x86-compat. (Quick check: if you already have /lib32/ you should be good to go.)

Downloading and extracting the driver

rpm2targz hl5150dlpr-1.1.2-1.i386.rpm
rpm2targz cupswrapperHL5150D-1.0.2-1.i386.rpm
tar xzf hl5150dlpr-1.1.2-1.i386.tar.gz
tar xzf cupswrapperHL5150D-1.0.2-1.i386.tar.gz

Performing necessary changes

You'll need to adapt the scripts surrounding the drivers a litte to make them work. Open usr/local/Brother/cupswrapper/cupswrapperHL5150D-1.0.2 in your favorite editor.

  • Change all occurrences of /etc/init.d/cups to /etc/init.d/cupsd (there should be 6 of them).
  • If you're on a 64bit system, change all occurrences of /usr/lib/ to /usr/lib32/ (I've counted 4).
  • On recent Cups versions (probably 1.4.x, I'm not sure), you'll need to change the connection identifier for your printer. At the bottom of the file, you'll see a line lpadmin -p HL5150D -E -v usb:/dev/usb/lp0 -m brhl5150d_cups.ppd. To find out what to change it to:
    • Start /etc/init.d/cupsd if it's not already running
    • Turn on your printer
    • Open your browser and go to http://localhost:631
    • Begin adding a printer ("Administration" -> "Add Printer"), choose your connected printer
    • On the second screen, look out for the field labeled "Connection:". Copy its contents. Cancel the printer addition process.
    • Put this string into the script, replacing usb:/dev/usb/lp0, so that the line looks like this:
Code: cupswrapperHL5150D-1.0.2
lpadmin -p HL5150D -E -v usb://Brother/HL-5150D%20series?serial=XXXXXXXXX -m brhl5150d_cups.ppd
  • The driver defaults to A4 paper. If you're in North America you'll probably want to change that. Open usr/local/Brother/inf/brHL5150Drc and change PaperType=A4 to:
Code: usr/local/Brother/inf/brHL5150Drc


Installing the drivers

Now it's time to copy the driver to your system.

cp usr/bin/brprintconflsr /usr/bin/
cp usr/lib/ /usr/lib/  # on an amd64 system, choose /usr/lib32/!
cp -r usr/local/Brother /usr/local/

You'll also need to set a few symlinks to make Cups happy:

# amd64 users remember to use /usr/lib32/
ln -s /usr/lib/cups/filter/brlpdwrapperHL5150D /usr/libexec/cups/filter/brlpdwrapperHL5150D
ln -s /usr/local/Brother/inf/brHL5150Drc /usr/local/Brother/inf/brPrintList

Then you can install the printer. Run:



No further setup inside Cups is necessary. Go print yourself a test page.

External links

The instructions above are based on these sources, which unfortunately are both outdated/incomplete: