*BSD News Article 41992


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msunews!agate!agate!usenet
From: kstailey@leidecker.gsfc.nasa.gov (Kenneth Stailey)
Newsgroups: comp.os.386bsd.announce
Subject: scanner support for NetBSD
Followup-To: poster
Date: 3 Feb 1995 10:48:00 -0800
Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA
Lines: 152
Sender: cgd@agate.berkeley.edu
Approved: 386bsd-announce-request@agate.berkeley.edu
Message-ID: <KSTAILEY.95Feb1121200@leidecker.gsfc.nasa.gov>
NNTP-Posting-Host: agate.berkeley.edu

Beta testers are wanted for testing the PINT scanner system on NetBSD 1.0

System requirements are:

NetBSD 1.0/i386
  (if you can hack it into 1.0A or non i386 then more power to you)

HP ScanJet IIc or IIcx

Please send mail to kstailey@leidecker.gsfc.nasa.gov for the NetBSD code

[standard PINT README follows]

		       PINT: PINT Is Not TWAIN


	       common scanner driver interface for UN*X



Copyright (C) 1994,1995 Kenneth Stailey kstailey@leidecker.gsfc.nasa.gov

currenly this disclaimer applies to AIX & SunOS only:

This program 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 of the License, or
(at your option) any later version.

This program 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 this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.


PINT (PINT Is Not TWAIN) is a first stab at a scanner interface with
enough flexibility to work with fairly divergent scanners (although
currently only SCSI scanners are supported, they are disappointingly
divergent especially compared to SCSI disks & tapes).  In addition
PINT is portable across two pretty divergent versions of UNIX, AIX 3.2
and SunOS 4.1, neither of which comes with scanner support.

PINT uses the traditional UNIX character special file interface and
supports open/close/read/ioctl operations.

Basic workflow for scanning
1. open driver
2. ioctl to get parameters
3. modify parameters
4. ioctl to set parameters
5. ioctl to get "active area" size in pixels
6. read data based on size from scanner
7. close driver

Steps 2-4 will alleviate you from having to set every parameter by hand.

Steps 5-6 deal with scanners that do not support as much resolution
	  as was specified via the ioctl, and with scanners that
	  do funny things to the size of the image data like
	  pad or truncate it to a byte or word boundary.

The PINT ioctl interface as of version 0.3

ioctl(fd, cmd, &arg) where command is:

 SCAN_GET
	Get scanner parameters.

 SCAN_SET
	Set scanner parameters.

	these ioctls use the following struct as their argument

struct scan_io {
  ulong   scan_window_width;	/* width in 1/1200ths of an inch */
  ulong   scan_window_length;	/* length in 1/1200ths of an inch */
  ushort  scan_x_resolution;	/* horizontal resolution in dots-per-inch */
  ushort  scan_y_resolution;	/* vertical resolution in dots-per-inch */
  ulong   scan_x_origin;	/* horizontal coordinate of upper left corner */
  ulong   scan_y_origin;	/* vertical coordinate of upper left corner */
  uchar   scan_image_mode;	/* type of image data sent by scanner: */

 SIM_BINARY_MONOCHROME   	- good old black-and-white

 SIM_DITHERED_MONOCHROME 	- half-toned monochrome

 SIM_GRAYSCALE  		- multibit monochrome

 SIM_COLOR			- "one pass color"

 SIM_RED
 SIM_GREEN			- red, green or blue filter is applied
 SIM_BLUE

  uchar   scan_brightness;	/* brightness control for those to can do it */
  uchar   scan_contrast;	/* contrast control for those to can do it */
  uchar   scan_scanner_type;	/* type of scanner (read only variable) */

 RICOH_IS410		- Ricoh IS410
 IBM_2456		- IBM 2456
 FUJITSU_M3096G 	- Fujitsu M3096G
 HP_SCANJET_IIC 	- HP Scanjet IIc
 RICOH_IS50		- Ricoh IS50
 UMAX_UC630		- UMAX UC630
 UMAX_UG630		- UMAX UG630
 RICOH_FS1		- Ricoh FS1
 SHARP_JX600		- Sharp JX600

  uchar   scan_use_adf;		/* whether to use Automatic Document Feeder */
};


 SCAN_GET_PIXEL_SIZE
	Retrieve the scanner's opinion of the size of the activer area in
	pixels into a structure like this:

struct scan_pixel_sizes {
  uint pix_width;
  uint pix_height;
};

 SCAN_PAPER_PUSH
	First make a blind effort at unloading the ADF with no error return
	then load the ADF.

	this ioctl has no arguments


I'm sure that many people will take offense to the fixed unit size of
1/1200" of an inch, but I haven't given the issue of multiple/variable
units.  I don't want to bloat the kernal code for this feature.
Probably a library routine for converting from a fixed interal size
will be used.  Suggestions are welcome.


******************            Using PINT           **********************

With the driver and utilities installed and the scanner hooked up you
can view the scanner's parameters with "get_scanner".  The
"set_scanner" utility changes the parameters.  The grabscan utility
will tranfer image data from the scanner to standard output in PNM
format.  Try "set_scanner -i m; grabscan > test.pbm"

If you have/get all of PBMPLUS installed you can generate images in
many graphics formats.  A viewer like loadimage, or xv can be used to
view the images on screen.