![]() |
This page will probably fit your needs, but it is still a work-in-progress. The only risks you will have on following its instructions are to have to reinstall the hplip, hpijs and python packages, but if you aren't adventurous enough to try it, check the comments in the end of the page (for user reports) or come back in the future.If you try it and it works for you (or not), please, leave your note on this comments section in the end of the page so I can improve these instructions accordingly.You must install CUPS before continuing http://www.nslu2-linux.org/wiki/HowTo/AddPrinterNOTE: Although this page describer how to fix hplip-2.8.7, it seems the package was not compiled with scanning support. Currently this fix only works with hplip-2.7.12. DO NOT UPGRADE TO 2.8.7Motivation and purpose:This howto intends to teach how to fix the HPLIP-2.7.12 and HPLIP-2.8.7 packages for the Unslung distribution in order to make "scanimage" and "saned" to work with your HP scanner so you can use your slug as a scanner server for both Windows and Linux clients. Since I spent an entire Sunday afternoon figuring out why hplip didn't work until I find a not-so-simple cause and not-so-trivial solution, because every hp-* utilities failed stating "CUPSEXT" extension could not be loaded although it was there, and consequently making sane not to be able to detect your scanner, I decided to share this with the slug community in the hope it could be of some help to anyone else. Requirements / prerequisitesIMPORTANT NOTE: This howto doesn't intend (yet) to guide you to use hplip to replace hpijs for printing purposes, so if you depend upon hpijs for printing STOP HERE! or proceed at your own risk. Possibly this page will in the future contain hints on how to configure hplip for printing purposes as well, come back in the future and check it.1 - First make sure you DON'T have hpijs installed: # ipkg remove hpijs 2 - Then make sure you have installed: 2.1 - sane-backends (this page is based on 1.0.19+cvs20080315-3 version):
# ipkg install sane-backends 2.2 - hplip (this page is based on 2.7.12-2 and 2.8.7-1 versions)
# ipkg install hplip 2.3 - net-snmp
# ipkg install net-snmp 2.4 - python, python24 and python25 packages (this page is based on 2.5-1, 2.4.5-1 and 2.5.2-2 respectively)
# ipkg install python
# ipkg install python24
# ipkg install python25
# ipkg install coreutils
On Unslung 6.10 Beta I believe Python2.5 is installed as python, and if you are using hplip-2.8.7-2 I think python24 is unnecessary. Python25 in any case is redundant.
2.5 - make sure /opt/bin/python symlink points to the "correct" python executable (depending on hplip version):
If you are using hplip-2.7.12-2:
# cd /opt/bin
# rm python
# ln -s /opt/bin/python24 python
If you are using hplip-2.8.7-1:
# cd /opt/bin
# rm python
# ln -s /opt/bin/python25 python
If you are using Unslung 6.10 Beta and hplip-2.8.7-2, do nothing. The symlinks exist and are correct. Further there is no /opt/bin/python25, it is /opt/bin/python2.5
This is necessary because the hplip-2.7.12 package was assembled upon python 2.4 while hplip-2.8.7-1 was assembled upon python 2.5, so an important extension (cupsext) is linked accordingly.
Fixing the hplip package1 - Fix the hplip "cupsext" extension included in the hplip package: The "cupsext.so" file included in the hplip package was linked under a 2-BYTE Unicode environment, while the python24 and python25 packages were linked under a 4-BYTE Unicode environment.
This leads it to an Unresolved Symbol situation when hplip utilities try to import it under this version of python. In order to fix this, you will have to edit a binary file. I did this using vi:
if you are using hplip-2.7.12:
# vi /opt/lib/python2.4/site-packages/cupsext.so
if you are using hplip-2.8.7:
# vi /opt/lib/python2.5/site-packages/cupsext.so
If you are using Unslung 6.10 Beta and hplip-2.8.7-2
Do nothing, cupsext.so has the correct unicode statement
You will have to look for the "PyUnicodeUCS2_DecodeUTF8" string (if using vi, type "/UCS2" without the quotes and type enter).
Then you must replace it to "PyUnicodeUCS4_DecodeUTF8" (if using vi, just put the cursor over the "2", press "r" followed by "4").
Finally save the file making sure you don't touch anything else and quit (again, if using vi, type ":wq", always without the quotes, and type enter)
2 - Fix some "missing" files (actually existing ones but expected to be somewhere else): # mkdir /opt/bin/data
# mkdir /opt/bin/data/models
# ln -s /opt/share/hplip/data/models/models.dat /opt/bin/data/models
# ln -s /opt/share/hplip/hpssd.py /opt/bin
3 - If when you try to run a script like # /opt/bin/hp-probe You get an error like
-sh:hp-probe:not found. You either didn't install coreutils as above, or it is mis-configured. If you can't figure out how to fix coreutils, one solution is to change the shebang line in each of the scripts that fails. The header of the script you are trying to run will say
#! /usr/bin/env python
Change it to
#! /usr/bin/python
Testing and setting it upYou've finally fixed hplip and now shall be able to configure it. 1 - Detect your scanner: Make sure your device is turned on and correctly connected to the USB port on your Slug, then run:
# cd /opt/bin
# ./hp-probe -busb
NOTE: Make sure to be on /opt/bin when running hp-probe
You shall see something like this (will vary according to you scanner model):
--------------------
| DEVICE DISCOVERY |
--------------------
Device URI Model
------------------------------------------- ------------------
hp:/usb/psc_2400_series?serial=xxxxxxxxxxxx HP psc 2400 series
Found 1 printer(s) on the 'usb' bus.
2 - Check if scanimage can see your device: If you get so far, hplip is correctly configured then you can try sane's scanimage command:
# cd /opt/bin
# ./scanimage -L
You shall see something like this:
device `hpaio:/usb/psc_2400_series?serial=xxxxxxxxxxxx' is a Hewlett-Packard psc_2400_series all-in-one CONGRATULATIONS!!!!If you get so far, you are ready to go! Now, if not familiar to it, read sane's documentation on how to use "scanimage". This will allow you to use your scanner from the Slug's command prompt. Now, if you want to turn your Slug into a scanner server, refer to the Setup a Scanner Server with Sane. Although it was written to instruct you on how to set saned for Openslug, it will also work for Unslung. IMPORTANT: Please notice I didn't have to do the fstab part of this page, but configuring saned.conf is a necessary step. Other good references on Sane and saned configuration: And the reference for setting up Windows scanner client: CommentsPlease, add your comment here if you have success or fail on making this guide to work for you (the first two are just examples):
view ·
edit ·
print ·
history ·
Last edited by Brian Zhou.
Based on work by BrianZhou, colin gebhart, Marcelo Vianna, and Timo Krumscheid. Originally by Marcelo Vianna. Page last modified on May 17, 2009, at 04:18 PM
|