Reference

hpscanpbm(1)

User-level SCSI HP ScanJet driver

NAME

hpscanpbm - User-level SCSI HP ScanJet driver

SYNOPSIS

hpscanpbm [ -dpi dpi ] [ -xdpi dpi ] [ -ydpi dpi ] [ -xres pixels ] [ -yres pixels ] [ -in | -cm | -mm ] [ -x pos ] [ -y pos ] [ -width size ] [ -height size ] [ -bright adj ] [ -cont adj ] [ -dev dev ] [ -o, -out file ] [ -quiet ] [ -load file ] [ -save file ] [ -format format ] [ -help ]

DESCRIPTION

hpscanpbm captures an image from a Hewlett-Packard ScanJet series scanner attached to a SCSI card, and produces a portable pixmap file as output. It can easily be used as part of a pipeline or with a "real" scanning application.

OPTIONS

-dpi DPI

sets both X and Y scan resolution in dots per inch

-xdpi DPI

sets X scan resolution only (default is 100 dpi)

-ydpi DPI

sets y scan resolution only (default is 100 dpi)

-xres PIXELS

adjusts xdpi to produce desired number of pixels per row in output image

-yres PIXELS

adjusts ydpi to produce desired number of pixels per column in output image

-in

scan region is being specified in inches (the default)

-cm

scan region is being specified in centimeters

-mm

scan region is being specified in millimeters

-x POS

position of left edge of scan region (default is 0)

-y POS

position of top edge of scan region (default is 0)

-width SIZE

width of scan region (default is 8.5 inches)

-height SIZE

height of scan region (default is 11.0 inches)

-bright ADJUSTMENT

brightness adjustment (-1.0 to 1.0, default is 0.0)

-cont ADJUSTMENT

contrast adjustment (-1.0 to 1.0, default is 0.0)

-dev DEVICE

SCSI generic device of scanner (default is a non-intrusive autoprobe)

-o, -out FILE

output file (default is print to stdout)

-quiet

turn off informational messages

-format FORMAT

select pixel format: thresholded, dithered, greyscale, or color

-load FILE

read parameter settings from file, then continue processing options

-save FILE

save current parameter settings to file (this should probably be the last option, if used)

-help

print a usage message and exit, successfully

EXAMPLES

The save-options feature allows you to do things like this:

hpscanpbm -xres 1280 -yres 1280 -cm -width 12 -height 12 -format color -s cdcover.hps > sample.LPm

Which will scan an image and save the parameters to cdcover.hps, which can be used later as:

hpscanpbm -l cdcover.hps > sample2.LPm

This is suitable for scanning audio CD covers.

This program can also be called from within another application. To do this, fork, redirect stdout and stderr, then exec hpscanpbm with the -quiet switch. On termination, if you got anything from stderr, issue it as a diagnostic; otherwise, interpret stdout as a PBM file.

LINUX NOTES

This is NOT a device driver. Your ScanJet must be connected to a SCSI adapter that is supported by Linux.

While the chipsets used on the boards supplied with the IIc and IIcx (NCR 53C400 and 53C800) do seem to have some support under Linux, these exact board configurations are not supported yet. I've had good luck with a Future Domain TMC-850. Performance of this 8-bit card isn't amazing but it definitely works.

This program uses the generic SCSI interface. Therefore, you must have generic SCSI enabled in your kernel, and you should have a series of generic SCSI devices set up:

/dev/sga -- major 21, minor 0 (mknod /dev/sga c 21 0)
/dev/sgb -- major 21, minor 1 (mknod /dev/sgb c 21 1)

SCSI generic devices should be character devices, not block devices. Furthermore, even devices that are already assigned to other names (like /dev/sda, /dev/scd0) also get a generic entry point. This means that you need at least as many SCSI generic device entries as you have SCSI devices.

If you're paranoid, clear all permissions on all generic devices except the scanner. Figuring out in advance which generic device ends up being your scanner can get a little tricky. If you only have one SCSI bus, they're allocated in order of SCSI ID. In my case, I've got two SCSI controllers, one for my internal stuff and one for my scanner; I've got three devices on the first bus so my scanner ends up being on /dev/sgd. (I've got the wrong kind of cable to hook everything onto a single bus). Unless the program is given the -quiet or -dev options, it will tell you where it found the scanner. The scanner's device must have both read and write permission.

If you're running anthing older than about 1.1.74, you'll probably also need to patch /usr/src/linux/drivers/scsi/scsi.c near line 370. In a switch statement containing the lines: (the first line is a bit different as of kernel 1.1.73)

switch (type = scsi_result[0])
{
      case TYPE_TAPE :
      case TYPE_DISK :
      case TYPE_MOD :
        ** add this: **
      case 3 :
        SDpnt->writeable = 1;
        break;

You'll need to add "case 3:" as indicated above; you'll also need to add the HP scanner to the SCSI blacklist near the top of the file:

static struct blist blacklist[] =
{
        :       :         :
        : lots of entries :
        {"HP", "C1750A", "3226"},
        {"HP", "C2500A", "????"},
        {"HP", "C2570A", "3406"},
        {NULL, NULL, NULL}};
}

The program is smart enough to autoprobe for your Scanjet and won't try, for example, to read your disk drive.

Generic SCSI got broken in the late 1.1.70's and didn't get fixed again until the late .80's. All of the patches listed above are in the current kernel (as of 1.1.94) *except* for the "C2570A" blacklist entry which is for the ScanJet 3p.

HPUX NOTES

On the 700 series, use the following command:

mknod /dev/scanner c 105 0x201<N>00
(where N is the SCSI #)

You might also want to do a 'chmod 666 /dev/scanner' to allow everyone to access the scanner.

Compile with this command:

cc +O3 -Aa -D_HPUX_SOURCE hpscanpbm.c

(Please direct HPUX questions to John Fehr.)

CREDITS

HPUX Port by John Fehr ([email protected])

Little hacks by Steve Enns ([email protected]), including the -xres, -yres, -s, and -l options.

Thanks to Les Johnson ([email protected]) for suggesting some Linux documentation clarifications.

Manual page written by Johnie Ingram ([email protected]).

COPYRIGHT

Copyright 1995, 1996 David Etherton ([email protected]).

hpscanpbm is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

hpscanpbm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with hpscanpbm; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

AVAILABILITY

The most recent released version of hpscanpbm is available for anonymous FTP from ftp.debian.org in the directory /debian/unstable/source/graphics. Binaries compiled for a number of Linux architectures are also available from this site.

LEGAL NOTE

HP, HPUX and ScanJet are registered trademarks of Hewlett-Packard.

SEE ALSO

pbm(5), ppm(5), netpbm(1)

History