Add a section about Images Scanners.

This section covers configuration of both SCSI and USB scanners.  Tests
have been done on 4 different scanners.  A great thanks to Ken Tom
<subd@mui.net> for his scanner and his time!
This commit is contained in:
Marc Fonvieille 2004-08-05 10:55:12 +00:00
parent 6f4b8dd68f
commit 65a2018fee
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=21829

View file

@ -1630,6 +1630,308 @@ bktr0: Pinnacle/Miro TV, Philips SECAM tuner.</programlisting>
archives of the &a.multimedia.name; mailing list.</para>
</sect2>
</sect1>
<sect1 id="scanners">
<sect1info>
<authorgroup>
<author>
<firstname>Marc</firstname>
<surname>Fonvieille</surname>
<contrib>Written by </contrib>
<!-- 04 August 2004 -->
</author>
</authorgroup>
</sect1info>
<title>Image Scanners</title>
<indexterm>
<primary>image scanners</primary>
</indexterm>
<sect2>
<title>Introduction</title>
<para>&os;, like any modern operating system, allows the use of
image scanners. Standardized access to scanners is provided
by the <application>SANE</application> (Scanner Access Now
Easy) <acronym role="Application Programming
Interface">API</acronym> available through the &os; Ports
Collection. <application>SANE</application> will also use
some &os; devices drivers to access to the scanner
hardware.</para>
<para>&os; supports both SCSI and USB scanners. Be sure your
scanner is supported by <application>SANE</application> prior
to performing any configuration.
<application>SANE</application> has a <ulink
url="http://sane-project.org/sane-supported-devices.html">supported
devices</ulink> list that can provide you with information
about the support for a scanner and its status. The
&man.uscanner.4; manual page also provides a list of supported
USB scanners.</para>
</sect2>
<sect2>
<title>Kernel Configuration</title>
<para>As mentionned above both SCSI and USB interfaces are
supported. According to your scanner interface, different
device drivers are required.</para>
<sect3 id="scanners-kernel-usb">
<title>USB Interface</title>
<para>The <filename>GENERIC</filename> kernel by default
includes the device drivers needed to support USB scanners.
Should you decide to use a custom kernel, be sure that the
following lines are present in your kernel configuration
file:</para>
<programlisting>device usb
device uhci
device ohci
device uscanner</programlisting>
<para>Depending upon the USB chipset on your motherboard, you
only need one of both <literal>device uhci</literal> and
<literal>device ohci</literal>, however having both in the
kernel configuration file is harmless.</para>
<para>If you do not want to rebuild your kernel and your
kernel is not the <filename>GENERIC</filename> one, you can
directly load the &man.uscanner.4; device driver module with
the &man.kldload.8; command:</para>
<screen>&prompt.root; <userinput>kldload uscanner</userinput></screen>
<para>To load this module at each system startup, add the
following line to
<filename>/boot/loader.conf</filename>:</para>
<programlisting>uscanner_load="YES"</programlisting>
<para>After rebooting with the correct kernel, or after
loading the required module, plug in your USB scanner. The
scanner should appear in your system message buffer
(&man.dmesg.8;) as something like:</para>
<screen>uscanner0: EPSON EPSON Scanner, rev 1.10/3.02, addr 2</screen>
<para>This shows that our scanner is using the
<devicename>/dev/uscanner0</devicename> device node.</para>
<note>
<para>On &os;&nbsp;4.X, the USB daemon (&man.usbd.8;) must
be running to be able to see some USB devices. To enable
this, add <literal>usbd_enable="YES"</literal> to your
<filename>/etc/rc.conf</filename> file and reboot the
machine.</para>
</note>
</sect3>
<sect3>
<title>SCSI Interface</title>
<para>If your scanner comes with a SCSI interface, it is
important to know which SCSI controller board you will use.
According to the SCSI chipset used, you will have to tune
your kernel configuration file. The
<filename>GENERIC</filename> kernel supports the most common
SCSI controllers. Be sure to read the
<filename>NOTES</filename> file (<filename>LINT</filename>
under &os;&nbsp;4.X) and add the correct line to your kernel
configuration file. In addition to the SCSI adapter driver,
you need to have the following lines in your kernel
configuration file:</para>
<programlisting>device scbus
device pass</programlisting>
<para>Once your kernel has been properly compiled, you should
be able to see the devices in your system message buffer,
when booting:</para>
<screen>pass2 at aic0 bus 0 target 2 lun 0
pass2: &lt;AGFA SNAPSCAN 600 1.10&gt; Fixed Scanner SCSI-2 device
pass2: 3.300MB/s transfers</screen>
<para>If your scanner was not powered-on at system boot, it is
still possible to manually force the detection by performing
a SCSI bus scan with the &man.camcontrol.8; command:</para>
<screen>&prompt.root; <userinput>camcontrol rescan all</userinput>
Re-scan of bus 0 was successful
Re-scan of bus 1 was successful
Re-scan of bus 2 was successful
Re-scan of bus 3 was successful</screen>
<para>Then the scanner will appear in the SCSI devices
list:</para>
<screen>&prompt.root; <userinput>camcontrol devlist</userinput>
&lt;IBM DDRS-34560 S97B&gt; at scbus0 target 5 lun 0 (pass0,da0)
&lt;IBM DDRS-34560 S97B&gt; at scbus0 target 6 lun 0 (pass1,da1)
&lt;AGFA SNAPSCAN 600 1.10&gt; at scbus1 target 2 lun 0 (pass3)
&lt;PHILIPS CDD3610 CD-R/RW 1.00&gt; at scbus2 target 0 lun 0 (pass2,cd0)</screen>
<para>More details about SCSI devices, are available in the
&man.scsi.4; and &man.camcontrol.8; manual pages.</para>
</sect3>
</sect2>
<sect2>
<title>SANE Configuration</title>
<para>The <application>SANE</application> system has been
splitted in two parts: the backends (<filename
role="package">graphics/sane-backends</filename>) and the
frontends (<filename
role="package">graphics/sane-frontends</filename>). The
backends part provides access to the scanner itself. The
<application>SANE</application>'s <ulink
url="http://sane-project.org/sane-supported-devices.html">supported
devices</ulink> list specifies which backend will support your
image scanner. It is mandatory to determine the correct
backend for your scanner if you want to be able to use your
device. The frontends part provides a graphical scanning
interface (<application>xscanimage</application>).</para>
<para>The first thing to do is installing the <filename
role="package">graphics/sane-backends</filename> port or
package. Then, use the <command>sane-find-scanner</command>
command to check the scanner detection by the
<application>SANE</application> system:</para>
<screen>&prompt.root; <userinput>sane-find-scanner -q</userinput>
found SCSI scanner "AGFA SNAPSCAN 600 1.10" at /dev/pass3</screen>
<para>The output will show the interface type of the scanner and
the device node used to attach the scanner to the system. The
vendor and the product model may not appear, it is not
important.</para>
<note>
<para>Some USB scanners require you to load a firmware, this
is explained in the backend manual page. You should also read
&man.sane-find-scanner.1; and &man.sane.7; manual
pages.</para>
</note>
<para>Now we have to check if the scanner will be identified by
a scanning frontend. By default, the
<application>SANE</application> backends come with a command
line tool called &man.scanimage.1;. This command allows you
to list the devices and to perform an image acquisition from
the command line. The <option>-L</option> option is used to
list the scanner device:</para>
<screen>&prompt.root; <userinput>scanimage -L</userinput>
device `snapscan:/dev/pass3' is a AGFA SNAPSCAN 600 flatbed scanner</screen>
<para>No output or a message saying that no scanners were
identified indicates that &man.scanimage.1; is unable to
identify the scanner. If this happens, you will need to edit
the backend configuration file and define the scanner device
used. The <filename
role="directory">/usr/local/etc/sane.d/</filename> directory
contains all backends configuration files. This
identification problem does appear with some USB
scanners.</para>
<para>For example, with the USB scanner used in the <xref
linkend="scanners-kernel-usb">,
<command>sane-find-scanner</command> gives us the following
information:<para>
<screen>&prompt.root; <userinput>sane-find-scanner -q</userinput>
found USB scanner (UNKNOWN vendor and product) at device /dev/uscanner0</screen>
<para>The scanner is correctly detected, it uses the USB
interface and is attached to the
<devicename>/dev/uscanner0</devicename> device node. We can now
check if the scanner is correctly identified:</para>
<screen>&prompt.root; <userinput>scanimage -L</userinput>
No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).</screen>
<para>Since the scanner is not identified, we will need to edit
the <filename>/usr/local/etc/sane.d/epson.conf</filename>
file. The scanner model used was the EPSON Perfection 1650,
so we know the scanner will use the <literal>epson</literal>
backend. Be sure to read the help comments in the backends
configuration files. Line changes are quite simple: comment
out all lines that have the wrong interface for your scanner
(in our case, we will comment out all lines starting with the
word <literal>scsi</literal> as our scanner uses the USB
interface), then add at the end of the file a line specifying
the interface and the device node used. In this case, we add
the following line:</para>
<programlisting>usb /dev/uscanner0</programlisting>
<para>Please be sure to read the comments provided in the
backend configuration file as well as the backend manual page
for more details and correct syntax to use. We can now verify
if the scanner is identified:</para>
<screen>&prompt.root; <userinput>scanimage -L</userinput>
device `epson:/dev/uscanner0' is a Epson GT-8200 flatbed scanner</screen>
<para>Our USB scanner has been identified. It is not important
if the brand and the model do not match. The key item to be
concerned with is the
<literal>`epson:/dev/uscanner0'</literal> field, which give us
the right backend name and the right device node.</para>
<para>Once the <command>scanimage -L</command> command is able
to see the scanner, the configuration is complete. The device
is now ready to scan.</para>
<para>While &man.scanimage.1; does does allow us to perform an
image acquisition from the command line, it is preferable to
use a graphical user interface to perform image scanning.
<application>SANE</application> offers a simple but efficient
graphical interface: <application>xscanimage</application>
(<filename
role="package">graphics/sane-frontends</filename>).</para>
<para><application>Xsane</application> (<filename
role="package">graphics/xsane</filename>) is another popular
graphical scanning frontend. This frontend offers advanced
features like various scanning mode (photocopy, fax, etc.),
color correction, batch scans, etc. Both of these applications
are useable as a <application>GIMP</application>
plugin.</para>
</sect2>
<sect2>
<title>Allowing Scanner Access to Other Users</title>
<para>All previous operations have been done with the
<username>root</username> privileges, however a user should be
able to use the scanner. The user will need read and write
permissions to the device node used by the scanner. As an
example, our USB scanner uses the device node
<devicename>/dev/uscanner0</devicename> which is owned by the
<groupname>operator</groupname> group. Adding the user
<username>joe</username> to the
<groupname>operator</groupname> group will allow him to use
the scanner:</para>
<screen>&prompt.root; <userinput>pw groupmod operator -m <replaceable>joe</replaceable></userinput></screen>
<para>For more details read the &man.pw.8; manual page.</para>
<note>
<para>Of course, for security reasons, you should think twice
before adding a user to any group, especially the
<groupname>operator</groupname> group.</para>
</note>
</sect2>
</sect1>
</chapter>
<!--