Scanning and Scanner Serving for GNU/Linux and Windows
This document explains how to setup a scanner for use in Debian GNU/Linux. It goes on to describe how to enable that scanner for remote use from workstations running Debian GNU/Linux, other unices or Microsoft Windows.
Introduction to the SANE Project
The SANE (Scanner Access Now Easy) project (http://www.sane-project.org/) produces the following groups of software:sane-backends
Debian unstable package page: http://packages.debian.org/unstable/libs/libsane
This package includes:
- scanimage - flexible command-line-frontend including support for pnm and tiff output
- saned - SANE network daemon for remote scanning
- sane-net - (config file: net.conf)
sane-frontends
Debian unstable package page: http://packages.debian.org/unstable/graphics/sane
This package includes:
- xscanimage - a scanner graphical frontend with GIMP 2.0 support
- scanadf - a command-line frontend for scanners with Automatic Document Feeder
- xcam - for acquiring images continuously from cameras
XSane
XSane is available for Unix and Windows. The XSane project web site is at http://www.xsane.org/, the Debian unstable package page at http://packages.debian.org/unstable/graphics/xsane.
Setting it up using Debian GNU/Linux
Install Scanner Software (Debian-specific)
Install 'sane', which includes all the software from the SANE project mentioned above.
Setup the Machine for Local Scanning
How the scanners attached and what your system uses to access it
There are a number of different interfaces your scanner can be attached to
- USB
- SCSI
- parallel
There are a number of different methods used by the system to access the scanner, depending on interface and possibly Linux kernel version
- with a USB attached scanner
- with a 2.4 series Linux kernel - devfs
- with a 2.6 series Linux kernel - libusb (http://libusb.sourceforge.net/)
- SCSI - devfs
There are a number of different locations for the scanner, depending on interface and means of accessing the scanner
- USB
- devfs - one of the following
/dev/usb/scanner0/dev/usbscanner0(don't think Debian uses this format)
- libusb (the numbers may be different for your scanner)
- if the backend knows your scanner, then it is referenced by the method used and its location:
libusb:002:003 - if the backend doesn't know your scanner then the actual vendor and product IDs of your actual scanner are used:
usb 0x04b8 0x0103
- if the backend knows your scanner, then it is referenced by the method used and its location:
- devfs - one of the following
- SCSI - one of the following generic SCSI devices
/dev/sg4/dev/sge- It is customary to create and use a symlink for the above at
/dev/scanner
We need to identify the means being used to access your scanner and its location. You can use either of the following, whilst root
sane-find-scanner -v
Example outputs:found USB scanner (vendor=0x04b8 [EPSON], product=0x0103 [Perfection610 ]) at libusb:002:003
It says 'libusb' is being used to access the scanner at address 002:003. We can see the backend already knows this scanner because its able to translate the vendor ID '0x04b8' into the vendor name 'EPSON' and the product ID '0x0103' into the product name 'Perfection610'
scanimage -L
Example outputs:device `epson:libusb:002:003' is a Epson Perfection610 flatbed scanner
Test the scanner
scanimage -d backend-name:location --format tiff > image.tif.
For example:
scanimage -d hp:/dev/sg3 --format tiff > image.tifscanimage -d epson:libusb:002:003 --format tiff > image.tif
Backend
The backend is specific to the scanner manufacturer and sometimes the model..
The means of accessing the scanner must be defined in the backed configuration file.
The backend configuration file is /etc/sane.d/backend-name.conf.
The backend for most Hewlett Packard scanners is called 'hp'
(the project page is at:
http://www.kirchgessner.net/sanehpfaq.html).
The backend for most Epson scanners is called 'epson' (the project page is at
http://www.freecolormanagement.com/sane/).
For USB scanners, where the system uses libusb and where the backend knows the scanner, using just 'usb' in the backend configuration file should be enough to use the scanner; this instructs the backed to scan for all Epson scanners it knows.
For USB scanners, where the system uses libusb, if the backend doesn't know your scanner, for example if its
a newer model, you'll have to put the
vendor and product IDs, as reported by sane-find-scanner -v, into the backend configuration file.
The output from sane-find-scanner -v should have given you a vendor ID and product ID.
(The documentation in the configuration file says to use the syntax
'usb <product ID> <device ID>', which is different wording to that given by sane-find-scanner.
sane-find-scanner uses the term 'vendor' to mean the same as the configuration file's 'product'
and 'product' to mean the same as the configuration file's 'device'.
The configuration file also leaves out the leading zeros (i.e. usb 0x04b8 0x0103)
displayed by sane-find-scanner, but you can either use them or leave them out.
For USB scanners, where the system uses devfs, you use one of the locations listed earlier.
For SCSI scanners, use the name of the generic SCSI device that the scanner is connected to, for example
/dev/sg3 or /dev/scanner, or just scsi BACKEND-NAME.
References
For a detailed description of each backend's configuration file, see the relevant backend manual page, called 'sane-<backend-name>' (e.g., sane-epson and sane-hp).
Permissions
If the system uses libusb and the backend knows your scanner, permissions should be setup correctly for you automatically. (see http://www.khk.net/sane/libusb.html and possibly http://jmccoy.sdf-us.org/linux/config/scanner.php for background on this.
Note: need to add here how to setup permissions if the system uses libusb and the backend doesn't know the scanner. See (see http://www.khk.net/sane/libusb.html.
If the system uses devfs, set permissions in the configuration file
/etc/devfs/conf.d/scanner (/etc/devfs/perms on some non-Debian systems),
in the following manner (your specific location may differ to these examples):
- for SCSI scanners
REGISTER ^scsi/host0/bus0/target4/lun0/generic PERMISSIONS root.scanner 0660REGISTER ^sg3 PERMISSIONS root.scanner 0660
- for USB scanners
REGISTER ^usb/scanner([0-9]+)$ PERMISSIONS root.scanner 0660
Changes to the permissions of the device itself are lost when disconnecting and re-connecting the device or restarting the system.
Note: it may be necessary to set devfs permissions using chgrp scanner /dev/sg3 and either
chmod g+rw /dev/sg3 or chmod o+rw /dev/sg3.
Setup the Machine as a Remote Scanner Server - saned
saned is the SANE (Scanner Access Now Easy) daemon that allows remote clients to access image acquisition devices available on the local host.
- configuration file:
saned.conf- contains a list of accepted clients - add this to
/etc/inetd.conf:
sane stream tcp nowait saned.saned /usr/sbin/saned saned - The Debian package automatically adds this for you to
/etc/services:
sane 6566/tcp # SANE network scanner daemon
(Note: Debian uses 'sane' where as the SANE project's documentation uses 'sane-port'. It looks as though 'sane-port' will be replaced in the IANA ports specification with 'sane')
Scanning from a Remote Location
scanimage
We don't think scanimage can be used remotely.
XSane (Unix)
Package(s): xscan
- make sure
/etc/sane.d/dll.conf(Unix) contains the line 'net' and that the scanner backend you require is listed. Its safer to remove or comment out all other references from this file. - set the IP address of the server where the scanner is connected, using either:
- a config file:
/etc/sane.d/net.conf - Or at the command-line each time you run xsane:
xsane net:192.168.0.1(orxsane net:ip-of-scan-server:device?)
net:10.0.0.10:hp:/dev/sg3but this didn't work) - a config file:
XSane (Windows)
Package(s): xscan
To install in Windows: extract the zip archive to C:\sane. Do not place it in any other place,
XSane will only work when placed in C:\sane.
- make sure
C:\sane\etc\sane.d\dll.confcontains the line 'net' and that the scanner backend you require is listed. Its safer to remove or comment out all other references from this file. - set the IP address of the server where the scanner is connected, using either:
- a config file:
C:\sane\etc\sane.d\net.conf - Or at the command-line:
xsane net:192.168.0.1(orxsane net:ip-of-scan-server:device?)
net:10.0.0.10:hp:/dev/sg3but this didn't work) - a config file:
"XSane future plans: free installation path; autodetect language; may be xsane-win32 without cygwin.dll on native win32 mode; may be later we make a sane-WIN32 version so that the backends do work too." - http://www.xsane.org/xsane-future.html
"Viewer-Mode: is completly usable (does gocr run on windows?)" - http://www.xsane.org/xsane-win32.html[Note: elaborate on copy, fax, email and OCR]
Other Software
Kooka
Project web site: http://www.kde.org/apps/kooka/
A raster image scan program for KDE.
Quiteinsane
Project web site: http://packages.debian.org/unstable/graphics/quiteinsane
"QuiteInsane is a graphical frontend for SANE (Scanner Access Now Easy). It can save an image to a file in a variety of image formats, send an image to a printer or do OCR (Optical Character Recognition) using gocr."
SaneTwain (Windows only)
Project web site: http://sanetwain.ozuzo.net/
Requires SaneTwain.ds be copied to %WINDIR%\twain_32. This is then picked up by programs looking for a Twain driver.
The program ScanImage.exe can be used to run the scanning software directly, however you'll want to weigh up the different interfaces of xscan
and SaneTwain (which has a native Windows GUI; also, in a rough test of memory comsumption on startup, SaneTwain used 5MB RAM, xsane 13MB; xsane is cross
platform).
(when the server isn't available its difficult to use - first time it loaded it asked for the address, then on subsequent loads it looked without asking then hung when it didn't find the device.)
Tame/2
Project web site: http://www.os2world.com/goran/tame.htm
Scanner Software Integration into Other Software
OpenOffice
"OpenOffice.org includes a simple scan interface that uses SANE" (is this just on GNU/Linux?) Insert -> Picture -> Scan -> Request... - for us this loaded SaneTwain, presumably bcos it looks for a Twain source. If it only supports Twain on Windows then its probably worth having SaneTwain installed as well as XSane.
GIMP
...
Further Info
SANE Frequently Asked Questions: http://www.xs4all.nl/~ljm/SANE-faq.html
/usr/share/doc/sane-utils/README.debian - information on permissions
various documents in file:////usr/share/doc/xsane/html/ or file:////usr/share/doc/xsane-common/html/
sane-usb(5) man page
sane-scsi(5) man page
http://penguin-breeder.org/sane/saned/
SANE Search Engine Server: http://sane.informatik.uni-freiburg.de/
troubleshooting: http://www.fifi.org/doc/libsane/README.Debian
XSane newsletter and mailing list: http://www.xsane.org/xsane-mailinglist.html
Related
open-source character recognition: http://jocr.sourceforge.net/
A few scanning tips by Wayne Fulton: http://www.scantips.com/
Scanning Negatives with GIMP: http://www.khk.net/color/gimp_negative_scanning.html
Error!
permissions? read readme.linux
The home of the Epson SANE backend is at http://www.khk.net/sane/index.html.
Their documentation says it supports Epson GT-8500 but the SANE projefct's doesn't list it.
http://www.khk.net/sane latest advertised epson backend is version 0.2.34 from 2003-02-15
from the sane-backends source code, 1.0.15 includes "SANE Epson Backend v0.2.43 - 2004-10-16"
Optical Character Recognition (OCR)
gocr
Project web site: http://jocr.sourceforge.net/
can't get gocr to work with xsane
To Do
Checkout scsiadd: http://llg.cubic.org/tools/
Checkout scsiaddgui (not available in Debian): http://www.8ung.at/klappnase/scsiaddgui/scsiaddgui.html
Troubleshooting:
SANE_DEBUG_
SANE_DEBUG_DLL=255 gimp
SANE_DEBUG_NET=255 gimp