Setting up scanning
This file documents the procedure to set up scanning with the HP OfficeJet
Linux driver (hpoj) package.
First check your model
Important: There are currently two different scanning solutions
available, but only one of them will work, depending on what HP
all-in-one model you have. In general:
- The flatbed OfficeJets, and the newer scrollfed (sheetfed) OfficeJets
(K and V series), are supported by
SANE (Scanner Access Now Easy).
The next section of this document explains how to set up SANE for use with
such devices.
(This class of devices uses the SCL protocol, HP's "Scanner Control Language".)
- The LaserJets, and the older scrollfed OfficeJets (500, 600, PSC300,
700, T series), are supported by the ptal-hp
command-line utility provided with the hpoj software. Please see the
separate document on scanning with ptal-hp
for more information, and do not follow the instructions for SANE below.
(This class of devices uses the PML protocol, HP's "Peripheral Management
Language", for scanner control.)
See the Supported
devices page for the most up-to-date list of models and which of the
above methods (if any) may be used for scanning.
Note: Some models have "Scan" or "Scan To" buttons on their front
panel to initiate scans from the device, possibly to a choice of
destinations. This functionality is not currently supported. For now,
you must initiate all scans from the computer using the appropriate
software, either SANE (described below) or
"ptal-hp scan".
Setting up scanning with SANE
SANE version 1.0.4 and later do not need to be patched for OfficeJet
support, because the necessary changes have been incorporated into the
SANE codebase starting with 1.0.4.
Important: If you already have SANE installed (particularly if from
an RPM, as is the case with RedHat, Linux-Mandrake and probably other
distributions as well), then you should uninstall it and follow the
procedure below, since it probably was not compiled for OfficeJet support.
Preparation:
-
Follow the instructions to compile and install the
hpoj software and set up basic device
connectivity if you haven't already.
-
Download from
ftp://ftp.mostang.com/pub/sane/ the
sane-backends-x.y.z.tar.gz and sane-frontends-x.y.z.tar.gz
packages.
It is recommended that you download the latest version available.
Substitute the version you selected for x.y.z in the rest of this
document.
(Optional) Download the enhanced
xsane frontend from the same place.
(Optional) As an alternative to downloading released SANE packages,
you may access the latest development code from the SANE CVS repository.
See
http://www.student.uit.no/~pere/linux/sane/cvs-server.html for
more information. The "cvs checkout" command produces a top-level
sane directory with sane-backends and sane-frontends
subdirectories. When using "cvs update" with SANE CVS, you may need
to append the -d switch to pick up new subdirectories that may have
been added.
-
Unpack the SANE source code packages.
If necessary, cd into the directory containing
sane-*-x.y.z.tar.gz.
Issue the following two commands:
tar xvfz sane-backends-x.y.z.tar.gz
tar xvfz sane-frontends-x.y.z.tar.gz
sane-backends:
-
cd into the sane-backends-x.y.z directory.
Read the README file.
-
Run the ./configure script. If necessary, use the following
parameters:
- --with-ptal=DIR -- Specify the same --prefix
path you used when
configuring the hpoj package, if it's not in /usr or
/usr/local.
Even if it is under one of these paths, you could try using this switch
anyway if it's having trouble finding the hpoj installed files.
If you installed hpoj into a directory under your home directory
(for example, ~/hpoj.install), make sure you provide the full path
instead of using the tilde ("~") shorthand notation.
- --prefix=DIR -- If you want to install SANE somewhere
other than under /usr/local.
If you re-run the configure script, then you might need to delete the
config.cache file if the cache contains stale information.
-
Examine the sane-backends ./configure output and check for the
following lines:
checking for ptal.h... yes
checking for ptalInit in -lptal... yes
If neither line appears, then verify you're using the most recent version of SANE.
If either line says no, then verify you've properly
compiled and installed the hpoj software,
and try re-running the SANE ./configure script with the
--with-ptal=DIR switch (see above).
-
(Optional) If you'd like to speed up the compilation and installation of
SANE, then edit the file backend/Makefile. Around line 55, change
the definition of PRELOADABLE_BACKENDS (which continues over several
lines using the backslash character) to just:
PRELOADABLE_BACKENDS = hp net
plus any other backends you will need. If you choose to do this, then
you will also need to edit tools/Makefile to remove umax_pp
from the line where DESTINATIONS is defined to prevent a compilation
error.
-
Compile sane-backends.
Issue the command make. Ensure it completed successfully.
-
Install sane-backends.
Log in as root if necessary, and issue the command "make install".
sane-frontends:
-
cd into the sane-frontends-x.y.z directory. Read the README
and INSTALL files.
-
Run the ./configure script.
-
Compile sane-frontends. Issue the command make.
Ensure it completed successfully.
-
Install sane-frontends. Log in as root if necessary, and issue the
command "make install".
Configure hp backend:
-
Read the sane-hp manual page.
By default this is installed as /usr/local/man/man5/sane-hp.5. An
online version
is also available.
-
Edit /usr/local/etc/sane.d/dll.conf.
You may comment out all lines except hp and any other backends you
specifically wish to keep, such as net.
-
Edit /usr/local/etc/sane.d/hp.conf according to the sane-hp
manual page:
For the case of an OfficeJet connected to a parallel port, add something
like the following two lines, depending on how you named the device
when you started ptal-mlcd:
mlc:par:0
option connect-ptal
If you're using USB, then add something like the following two lines,
again taking into account how you named the device for
ptal-mlcd:
mlc:usb:OfficeJet_G85
option connect-ptal
If your peripheral is connected to an HP JetDirect print server, then
add something like the following two lines:
hpjd:my-jdex.my-domain.com
option connect-ptal
Note: The sane-hp manual page prior to SANE version 1.0.5
refers to the old PTAL device naming convention for hpoj-0.7 and earlier,
which was of the form mlc:mlcpp0. Follow the instructions above
instead.
Try it out:
-
Ensure the device is connected and powered on and that the hpoj low-level
drivers are loaded appropriately.
-
Perform a "test" scan.
If you have a single HP device, issue the command
scanimage --test
If you have multiple HP devices, try them all. To specify a particular
device, such as mlc:par:0, use a command such as:
scanimage -d hp:mlc:par:0 --test
Note: Scrollfed models, such as the OfficeJet K and V series, may or
may not handle this test properly, but it doesn't hurt to try.
-
Run xscanimage or xsane and scan to your heart's content!
:-)
Important: Scrollfed models, such as the OfficeJet K and V series,
require extra steps to scan or preview-scan successfully, which are explained
in the sane-hp manual page. Note that you may have to configure the
frontend application to show "advanced options" in order to get to the
"Change document" and "Unload" buttons.
-
(Optional) If you'd like to set up xscanimage or xsane
to run as a Gimp plugin, then invoke something like one of the following
commands, adjusting as necessary for the directory in which the application is
installed and the version of Gimp you're using:
ln -s /usr/local/bin/xscanimage ~/.gimp/plug-ins
ln -s /usr/local/bin/xsane ~/.gimp-1.2/plug-ins
See
http://www.xsane.org/doc/sane-xsane-gimp-doc.html for more
information.
If you have problems, in some cases it may be helpful to enable debug
output, which is fully enabled with the following commands:
export SANE_DEBUG_HP=128
export PTAL_DEBUG=2
The debug output is sent to standard error. To capture this to a file
named log.txt, add 2>log.txt to the command line.
Put it before the ampersand if running xscanimage or xsane
in the background.
Next steps
You may now set up printing if you haven't
already, or return to the index.