4. SANE

The final prerequisite for scanner access is the SANE backend(s) and optionally, a suitable SANE-frontend. The former are the drivers and low-level access tools that interface with your scanner, and the latter are graphical applications for access and use of your scanner within X. Only the former are required for scanner access, though a frontend is highly recommended in order to manipulate images and to actually be able to see your images in a windowed environment without having to print them.

4.1. Getting SANE

You can acquire the suite of SANE backends at http://www.sane-project.org/source.html, where you can obtain binaries for nearly all Linux distributions as well as source code. If you are planning on compiling from source, you probably already know what to do, but the following link is available for those that want a refresher, that of the Software Building HOWTO. In addition, be sure that if you have a previous sane installation that it is removed prior to installing your freshly-compiled version, and that you should acquire the most recently released stable version of the source code for compiling.

Those who wish to install binaries should download the corresponding file and then install as usual, i.e. for rpm-based distributions:

# rpm -iVh sane-backends-VERSION.rpm

For Debian users there is a SANE package in stable (Woody), testing (Sarge) and unstable (Sid) package repositories, so a simple apt-get install sane is all that is required, whatever version you are using.

Those who prefer compiling the latest version of SANE from source can acquire it from ftp.mostang.com/pub/sane. There is a more in-depth (though rather pessimistic) write-up of how to compile SANE from source and get a SCSI scanner working from scratch, at Laurent-jan's HOWTO page originally written by Steve Sheriff (the graphics are interesting, too).

4.2. Configuring SANE

4.2.1. SANE Backends

Whether you obtained your distribution's official SANE package, obtained a binary from the SANE homepage or compiled your own SANE binary from source, SANE should identify the appropriate backend to use for your hardware when you call scanimage or any other frontend. If no device is found when you run scanimage -L or your chosen frontend, see Section 7 for more info.

4.2.2. Across a Network

If you are interested in making scanner services available across a network from or to a remote machine, you will need to edit the saned.conf file in the configuration directory of the server (the computer with the scanner), whether /etc/sane.d or /usr/local/etc/sane.d. It usually consists of an entry 'scan-client.somedomain.firm' that will need to be replaced with the hostname of the client you want to be able to use the server's scanner. If you prefer an IP address this can be used instead.

The saned daemon will need to be run as well as inetd or xined on the server. See man saned for the exact changes required to inetd.conf or xined.conf. In addition port 6566 will need to be added to the /etc/services file:

sane 6566/tcp 

The client computer (without the scanner) will need net.conf edited to include the server machine name, i.e., 'scan-server.somedomain.firm.'

Also for the client(s), be sure the entry "net" isn't commented out in the dll.conf file.

4.2.3. Using SANE with a Video4linux Device

Video4linux devices include webcams, still cameras and video capture devices. SANE is capable of accessing these. To do this, locate the file in the configuration directory (/etc/sane.d or /usr/local/etc/sane.d) named v4l.conf. Opening this file yields something similar to the following content:

# In order to use the v4linux backend you have to give the device
# You can enable multiple lines if
# you really have multible [sic] v4l devices.
#
/dev/bttv0
/dev/video0
/dev/video1
/dev/video2
/dev/video3

The initial line of this file really tells you all you need to know, so remember this when we get to the sections on testing the scanner hardware. Just be sure that whatever device your kernel identifies your camera or other v4l device as is uncommented (i.e., has the # removed from in front of it as above). You will obviously need to do this as root. In addition, be sure the line 'v4l' isn't commented out in the dll.conf file.