SANE-1.2.1

Introduction to SANE

SANE is short for Scanner Access Now Easy. Scanner access, however, is far from easy, since every vendor has their own protocols. The only known protocol that should bring some unity into this chaos is the TWAIN interface, but this is too imprecise to allow a stable scanning framework. Therefore, SANE comes with its own protocol, and the vendor drivers can't be used.

SANE is split into back ends and front ends. The back ends are drivers for the supported scanners and cameras. The front ends are user interfaces to access the backends.

[注記]

注記

LFS や依存パッケージが本ブックに示す最新安定バージョンでなかった場合には、BLFS 開発版においては、パッケージのビルドや処理実行が適切に行われないことがあります。

Back Ends Package Information

[注記]

注記

The upstream location for this file is at https://gitlab.com/sane-project but the file URL uses an embedded md5sum. For convenience, the package has been copied to the location above.

SANE Dependencies

Optional (Back Ends)

Avahi-0.8, Cups-2.4.7, libjpeg-turbo-3.0.1, libtiff-4.6.0, libusb-1.0.26, v4l-utils-1.26.1, Net-SNMP, libieee1284, libgphoto2, and texlive-20230313 (or install-tl-unx)

Kernel Configuration, Drivers and Additional Packages

To access your scanner, you will probably need the related kernel drivers and/or additional support packages. A SCSI scanner will need SCSI drivers, a parallel port scanner needs parallel port support (you should use enhanced EPP modes) and perhaps libieee1284, and a USB scanner will need the libusb-1.0.26 package. For HP devices, you may need hplip. Ensure you have the necessary drivers properly configured to access the devices.

Installation of SANE

Installation of SANE Back Ends

The SANE daemon should run with its own group. Create this group by issuing the following command as the root user:

groupadd -g 70 scanner
[注記]

注記

configure assumes that the user building SANE-backends is a member of the scanner group for testing the existence of this group. As a result, the user building the package needs to be added to the scanner group. Add the user to the scanner group by issuing the following command as the root user:

usermod -G scanner -a username

After adding the scanner group as above, you will need to log out and back in to activate it.

For a USB scanner, if you are linking to libusb-1.0.26, include the configure switch --enable-libusb_1_0. Install SANE-backends by running the following commands:

sg scanner -c "                                 \
PYTHON=python3 ./configure --prefix=/usr        \
                           --sysconfdir=/etc    \
                           --localstatedir=/var \
                           --with-lockdir=/run/lock \
                           --docdir=/usr/share/doc/sane-backends-1.2.1" &&
make

To test the results, issue: make check.

Now, as the root user:

make install                                         &&
install -m 644 -v tools/udev/libsane.rules           \
                  /etc/udev/rules.d/65-scanner.rules &&
mkdir -p          /run/lock/sane &&
chgrp -v scanner  /run/lock/sane

With the scanner on, run scanimage -L and the name and location of the device should appear. Of course, you need the device drivers configured, in order to run this test.

Command Explanations

sg scanner -c "...": runs the command between double quotes with principal group scanner. This may be needed if the user has been newly added to group scanner, and has not logged out and in.

PYTHON=python3: This switch forces the build system to use Python 3 instead of Python 2.

--sysconfdir=/etc: This switch installs the configuration files in /etc/sane.d instead of /usr/etc/sane.d.

Configuring SANE

Config Files

/etc/sane.d/*.conf

Configuration Information

Backend Configuration

The backend configuration files are located in /etc/sane.d. Information for configuring the various backends can be found by using the man(5) page for the desired backend. Run man sane-<backend>, substituting the desired backend.

Add any users that will use a scanner to the scanner group.

If you want to access a network scanner, include two lines in net.conf, as the root user (make sure to replace <server_ip> by the actual value):

cat >> /etc/sane.d/net.conf << "EOF"
connect_timeout = 60
<server_ip>
EOF

On the server side, include the client ip in the access list of /etc/sane.d/saned.conf, restart the saned daemon, and make sure the firewall, if any, is open to the client.

General Information

For general information about configuring and using SANE, see man sane. For information about USB scanning devices, run man sane-usb. For information about SCSI devices, run man sane-scsi.

Configuration and setup of the 'saned' daemon

The saned daemon is not meant to be used for untrusted clients. You should provide ファイアウォール設定 protection to ensure only trusted clients access the daemon. Due to the complex security requirements to ensure only trusted clients access the daemon, BLFS does not provide instructions to configure the saned daemon. Some good (but outdated) information for setting up and securing the saned daemon can be found at https://penguin-breeder.org/sane/saned/.

Contents

Installed Programs: gamma4scanimage, sane-config, saned, sane-find-scanner, scanimage, and umax_pp
Installed Libraries: libsane.so and numerous scanner backend modules
Installed Directories: /etc/sane.d, /usr/{include,lib,share}/sane, and /usr/share/doc/sane-1.2.1

Short Descriptions

gamma4scanimage

creates a gamma table in the format expected by scanimage

sane-config

is a tool used to determine the compiler and linker flags that should be used to compile and link SANE

saned

is the SANE daemon that allows remote clients to access image acquisition devices available on the local host

sane-find-scanner

is a command-line tool to find SCSI and USB scanners and determine their device files. Its primary purpose is to make sure that scanners can be detected by SANE backends

scanimage

is a command line interface for scanning from image acquisition devices such as flatbed scanners or cameras. It is also used to list the available backend devices

umax_pp

is a tool used to read information from UMAX parallel port scanners. It can also be used for performing diagnostics on these scanners

libsane.so

is the application programming interface that is used to communicate between frontends and backends

libsane-*.so

modules are backend scanning library plugins used to interface with scanning devices. See http://www.sane-project.org/sane-supported-devices.html for a list of supported backends