Thursday, November 06, 2014

HP LaserJet Pro M1132 MFP printer installed on Raspberry Pi

Most of the Linux distributions include the Hewlett-Packard’s Linux Imaging and Printing (HPLIP) software that works perfectly in the Raspberry Pi. HPLIP provides tools for managing the printers available in the system. For instance, the tool hp-setup adds new printers to the system configuring their parameters, among others, automatically installing required packages depending on the distribution running in the system. So far, everything is perfect.


The tool hp-setup installs the HP driver of CUPS, but it also requires a binary plugin to order to operate. The driver and the plugin both are usually installed without problems in your favorite distro. However, after the installation, when you try to print you may be warned that it is not possible, whereas the print server issues error messages (e.g., missing permissions, plugin errors, CUPS errors). These messages depend on the system and they may vary in, e.g., CUPS version, printer model or whatever is wrong. However, the real problem is based on the fact that the plugin downloaded/used by HPLIP is ONLY compiled for 32-/64-bit x86-based systems and, as you probably know, Raspberry PI is ARM-based architecture. Consequently, the plugin downloaded by hp-setup will not properly work in our Raspberry Pi systems, while HPLIP does not recompile such a plugin for ARM-based architecture.


While we are waiting for HPLIP to include the plugins compiled for ARM processors, we can compile an open-source driver that supports our HP printer. I am talking about the driver foo2zjs which supports the protocol foo2xqx that our printer supports too. This driver is free software and was developed originally for the HP Laserjet M1005 MFP and similar printers. In particular, the HP M1132 MFP is also supported, so it can be used for our Raspberry Pi to print.


The steps to compile the driver foo2xqx are below:


  1. Login to your Raspberry Pi using ssh.
  2. wget -O foo2zjs.tar.gz http://foo2zjs.rkkda.com/foo2zjs.tar.gz
  3. tar zxvf  foo2zjs.tar.gz
  4. cd foo2zjs
  5. make
  6. sudo make install
  7. sudo make cups


Once the source code compiles without errors, we must use the CUPS web-based GUI to configure the driver foo2xqx. The steps to configure the driver foo2xqx are the following:


  1. Open the web browser and go to the “http://localhost:631”.
  2. Assuming you are logged to your Raspberry PI, go to Administration -> Add printer
  3. Select local printers “HP LaserJet Professional M1132 MFP (HP LaserJet Professional M1132 MFP)”, and click on “Continue”. Assuming your M1132 is switched on and its USB cable is connected to the Raspberry Pi. Otherwise, CUPS will not appropriately  detect your printer and show such message.
  4. In the Connection field, you must indicate the USB protocol (i.e., usb://HP/…). If you were using the HPLIP driver, you would specify the HP protocol (i.e., hp://HP//…). Since you are using the open source driver, you must specify the first one. For your particular case (you may have another serial number so use yours):
    usb://HP/LaserJet%20Professional%20M1132%20MFP?serial=00000000…...R1a
    Remember to tick “Share this printer” and click on Continue.
  5. Fill in the field Name (e.g., RASPI-PRINTER) that is compulsory. Description and Location are optional.
  6. Now search for the appropriate PPD file clicking on “Provide a PPD file” and select the file /home/pi/foo2zjs/PPD/HP-LaserJet_Pro_P1102.ppd deployed with the file foo2zjs.tar.gz (*). Click on “Add printer” and “Set default for printer”
  7. Go to “Printers”, select your printer and send to print a test page thru “Maintenance” -> “Print test page” -> Go

If everything goes well, after 20 seconds approximately, you must hear the amazing noise that your printer makes when it start to print.


-----------x-----------


(*) Note the foo2zjs driver does not provide a PPD file for the model M1132 specifically. To be succeed, we must select the PPD file for the model P1102 because the model P1102 corresponds to one of the plugins distributed inside the HPLIP plugins container.


In order to check this, you must download and decompress the HPLIP plugins container so that its embedded files can be analysed using the following steps:


  1. mkdir tmp
  2. wget http://prdownloads.sourceforge.net/hplip/hplip-3.14.10.run
  3. ./hplip-3.14.10-plugin.run --noexec --nox11 --target tmp
  4. ls --list tmp
total 4448
bb_marvell-x86_32.so hp_laserjet_p1006.fw.gz
bb_marvell-x86_64.so hp_laserjet_p1007.fw.gz
bb_soap-x86_32.so hp_laserjet_p1008.fw.gz
bb_soap-x86_64.so hp_laserjet_p1009.fw.gz
bb_soapht-x86_32.so hp_laserjet_p1505.fw.gz
bb_soapht-x86_64.so hp_laserjet_professional_p1102.fw.gz
fax_marvell-x86_32.so hp_laserjet_professional_p1102w.fw.gz
fax_marvell-x86_64.so hp_laserjet_professional_p1566.fw.gz
hbpl1-x86_32.so hplip-plugin-install
hbpl1-x86_64.so license.txt
hp_laserjet_1000.fw.gz lj-x86_32.so
hp_laserjet_1005_series.fw.gz lj-x86_64.so
hp_laserjet_1018.fw.gz plugin.spec
hp_laserjet_1020.fw.gz plugin_install.py
hp_laserjet_p1005.fw.gz version.txt


Taking a look to the contents of the plugins file you can see two things:
  • all the libraries *.so are compiled for 32-/64-bit x86-based architectures (as indicated by their names) and
  • none of the files include the identifier of our printer (i.e., M1132) what indicates our printer has the same chipset than other printers.


The latter is good because it means we can search for an open source driver for one of the chipsets identified by the identifiers of the files *.fw.gz and reuse it now in our Raspberry Pi. I did such a search on Internet and I figured out the driver foo2zjs supports the HP P1102 printer. This is exactly what we need, so for this reason we must use the PPD file for the printer P1102 instead of the PPD file for the printer M1132.