old-www/HOWTO/Scanner-HOWTO/interfaces.html

836 lines
20 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>General Support and Interface Type</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="The Scanner HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Introduction"
HREF="intro.html"><LINK
REL="NEXT"
TITLE="Making and Accessing the Scanner Devices"
HREF="dev-intro.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>The Scanner HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="intro.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="dev-intro.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="INTERFACES"
></A
>2. General Support and Interface Type</H1
><P
>There are four predominant types of scanner interfaces available and discussed in this document: SCSI, USB, parallel port, IEEE 1394.
Linux support exists for most scanners as pioneered by the <A
HREF="http://www.sane-project.org/"
TARGET="_top"
>SANE</A
> project.
This is not the same thing as <A
HREF="http://www.twain.org/index.html"
TARGET="_top"
>TWAIN</A
>, which you may be familiar with if you have used a scanner device under another operating system such as <SPAN
CLASS="TRADEMARK"
>Microsoft Windows</SPAN
>&#8482;.
The latter protocol weds driver and user interface in a way that does not allow its use outside of that proprietary graphical environment.
Thus SANE, or Scanner Access Now Easy, was conceived for use under (but is by no means limited to) the Un*x environment.
The SANE standard allows for modularity where driver meets application and allows for much greater flexibility and portability.
With SANE you can scan with your device using only the command line, you can design your own front-end application to use the SANE backend(s), access your scanner(s) over a network or even access your cameras and other <A
HREF="http://www.thedirks.org/v4l2/"
TARGET="_top"
>video4linux</A
> devices to acquire photographs.
As such SANE is SANE where TWAIN is not.</P
><P
><EM
>NOTE: Before reading any further you should check the SANE homepage at <A
HREF="http://www.sane-project.org/sane-mfgs.html"
TARGET="_top"
>http://www.sane-project.org/sane-mfgs.html</A
> to see if your scanner device is supported.
Alternatively you can use the <A
HREF="http://www.sane-project.org/cgi-bin/driver.pl"
TARGET="_top"
>sane supported scanners search engine</A
>.</EM
></P
><P
>If you have an integrated device, i.e., one that functions as a scanner, printer and/or fax, you can follow the steps below for the scanner functions using the appropriate interface just like a standard scanner.
Those who own an HP officejet should consult <A
HREF="http://hpoj.sourceforge.net/"
TARGET="_top"
> the HP Officejet Linux Driver project site,</A
> which goes into excellent detail on how to get the various functions of this integrated device to work within Linux.</P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="SCSI-TYPE"
></A
>2.1. SCSI Scanners</H2
><P
>These scanners are managed by an SCSI controller.
In general, just about any scanner using an SCSI interface should work assuming the SCSI hardware is supported.
You should check the <A
HREF="http://tldp.org/HOWTO/Hardware-HOWTO/scsi.html"
TARGET="_top"
>SCSI controller list of the Hardware HOWTO</A
> if you are unsure if the SCSI controller is supported.
If your SCSI controller came bundled with your scanner there is a chance your hardware may not be supported or is only partly supported, as the accompanying SCSI card may not function as a complete SCSI controller.</P
><P
>You should consult <B
CLASS="COMMAND"
>man sane-scsi</B
>, if you run into difficulty configuring your SCSI scanner at any point.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="USB-TYPE"
></A
>2.2. USB Scanners</H2
><P
>You probably already know what a Universal Serial Bus (USB) connector looks like and where it plugs in.
If you have a USB scanner your hardware is likely to be supported in Linux.
Information on enabling the USB subsystem and USB scanner support is found in <A
HREF="interfaces.html#OSSUPPORT"
>Section 2.5</A
>.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="PARPORT-TYPE"
></A
>2.3. Parallel Port Scanners</H2
><P
>Parallel-port scanners on the whole can be made to work if there is a backend that supports them, however if your device also has a USB port (which the vast majority of new scanners released nowadays do) and a working USB backend you are strongly encouraged to use that instead, as it may be more easily configured. </P
><P
>If your model has only a parallel-port interface and a proprietary or non-standard controller you could be out of luck. If you have found there is a supported backend for the parallel-port interface of your scanner, then you should see <A
HREF="interfaces.html#PARPORT-GENERAL"
>Section 2.8</A
>.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="IEEE1394"
></A
>2.4. IEEE 1394 (<SPAN
CLASS="TRADEMARK"
>Firewire</SPAN
>&#8482;, <SPAN
CLASS="TRADEMARK"
>i.Link</SPAN
>&#8482;)</H2
><P
>Some IEEE 1394 scanners are supported as of the time of this writing, particularly those manufactured by Nikon and Epson.
The IEEE 1394 interface has been supported since the 2.4-series Linux kernel. IEEE 1394 scanners require your system be equipped with a IEEE 1394 PCI card or a mainboard IEEE 1394 port, as well as have IEEE 1394 support enabled in your kernel or as a loaded module.
You should check the SANE supported devices by manufacturer link in <A
HREF="interfaces.html"
>Section 2</A
> and read the manpage next to your hardware (if any) for any issues related to your specific hardware.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="OSSUPPORT"
></A
>2.5. Operating System Support</H2
><P
>If you don't have a USB scanner you should skip to <A
HREF="interfaces.html#KERNEL"
>Section 2.7</A
>, and if your equipment is of the parallel port variety you should go to <A
HREF="interfaces.html#PARPORT-GENERAL"
>Section 2.8</A
>.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="LIBUSB"
></A
>2.6. USB Scanners and Libusb</H2
><P
>This section was at one time entitled <SPAN
CLASS="QUOTE"
>"USB Scanner Kernel Support,"</SPAN
> but the existence of <A
HREF="http://libusb.sourceforge.net/"
TARGET="_top"
>libusb</A
> promises to make the need for a USB-scanner enabled kernel unnecessary. Libusb is a project to create a userspace (i.e., non-kernel) library to access USB devices regardless of operating system.
For more information on the differences between these consult <B
CLASS="COMMAND"
>man sane-usb</B
>. </P
><P
>If you would prefer the more conventional kernel support for your USB Scanner, go on to <A
HREF="interfaces.html#USB-KERNEL"
>Section 2.7.2</A
>, but be advised that kernel support for USB scanner devices is dropped in favor of libusb in kernel version 2.6.0 and higher.
Most distributions at this point are offering libusb in their stable branches (and some install it by default), so if you don't already have kernel support for USB scanner devices then you may only have to install the libusb package in order to access your device.
You must have USB device filesystem support enabled in your kernel, which most distributions do.
To find out for sure, issue the following at the command line:</P
><P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>$ cat /proc/filesystems</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
>You should see (among others):</P
><P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>nodev usbdevfs
nodev usbfs</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
>You may need to mount usbdevfs to enable it and see the device files, which you can do at the command line with <B
CLASS="COMMAND"
>mount -t usbdevfs none /proc/bus/usb</B
>.
Don't try to use libusb while <EM
>kernel</EM
> scanner support is enabled either statically or the module loaded; you can only use one at at time.</P
><P
>You can obtain the libusb package in <TT
CLASS="FILENAME"
>.rpm</TT
>, <TT
CLASS="FILENAME"
>.tgz</TT
> or <TT
CLASS="FILENAME"
>.deb</TT
> format from your Linux distribution.
If you are planning on compiling your own SANE binary from source with libusb support enabled you will require the <TT
CLASS="FILENAME"
>libusb-dev</TT
> package as well.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="KERNEL"
></A
>2.7. Linux Kernel Support of your Scanner Device</H2
><P
>Kernel support is required for SCSI, USB and parallel-port generic interface support and USB scanner support (if not using libusb).
Your stock kernel may already have support for what you need, and the way to tell is to use the <B
CLASS="COMMAND"
>dmesg</B
> command and look for an acknowledgement that the driver in question loaded at bootup.
If you don't see it, the driver may be present (but not necessarily loaded) as a module.
To find out you can type the following at the command line:</P
><P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
> $ ls -R /lib/modules/X.XX/kernel/drivers </PRE
></FONT
></TD
></TR
></TABLE
></P
><P
>Where 'X.XX' is your kernel version number.
The following output is an example of what you would find in a USB scanner-enabled kernel (though all but the relevant lines have been edited for brevity):</P
><P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>./usb:
scanner.o
usbcore.o</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
><EM
>(A hint for newbies: if the info in dmesg or the above module list scrolls by too fast, you might try piping the output into 'less' (or 'more' if you don't have less): <B
CLASS="COMMAND"
>ls -R /lib/modules/X.XX/kernel/drivers | less </B
> or alternatively catching it in a file: <B
CLASS="COMMAND"
>ls -R /lib/modules/X.XX/kernel/drivers &#62; file.txt</B
>, where 'file.txt' will contain the info that can then be accessed with <B
CLASS="COMMAND"
>cat [file] | less</B
>.)</EM
></P
><P
>The following information is arranged on the basis of scanner interface type.
If your kernel doesn't contain the necessary support, you can always recompile your kernel.
If you are unfamiliar with the process of compiling your own kernel, I direct you to the <A
HREF="http://www.tldp.org/HOWTO/Kernel-HOWTO.html"
TARGET="_top"
>Kernel HOWTO</A
> for more information. </P
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="SCSI-KERNEL"
></A
>2.7.1. Kernel SCSI Support</H3
><P
>If you have an SCSI-type interface, when invoking <B
CLASS="COMMAND"
>make config</B
>, <B
CLASS="COMMAND"
>make menuconfig</B
> or <B
CLASS="COMMAND"
>make xconfig</B
> etc., be aware that in addition to the option to support your particular SCSI adapter, generic SCSI device support is also required.
Such generic devices are usually named <B
CLASS="COMMAND"
>/dev/sg0, /dev/sg1</B
>....
Since you probably already know if your card is supported from the <A
HREF="http://tldp.org/HOWTO/Hardware-HOWTO/scsi.html"
TARGET="_top"
>supported SCSI controllers list</A
>, all that is required after confirming that your kernel supports your hardware and generic SCSI devices is to load the appropriate module(s):</P
><P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
># modprobe CARD_MODULE_NAME</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
># modprobe sg</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
>...as root. Note there have been reports of ide-scsi emulation support (used for ATAPI-eide CDRW support) causing problems for scanner access; if you know your hardware is supported and you can't get things to work try unloading the ide-scsi module:</P
><P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>rmmod ide-scsi</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
>...though it has been reported to me that this has been fixed as of recent (2.4.20+) kernels.</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="USB-KERNEL"
></A
>2.7.2. Kernel USB and USB Scanner Support</H3
><P
>For USB scanner support, you will need USB subsystem support in your kernel, whether usb-ohci, usb-ehci, or whatever protocol of USB driver your system prefers.
USB support has been present in the Linux kernel since the late 2.2-series.
For a more in-depth discussion of USB support in general, I direct you to the <A
HREF="http://www.linux-usb.org/"
TARGET="_top"
>linux-usb project site</A
>.
If you have a 2.4-series of kernel or earlier and wish to use the kernel USB-scanner support to access your scanner (instead of libusb outlined in <A
HREF="interfaces.html#LIBUSB"
>Section 2.6</A
>) you will need to have 'USB scanner support' enabled, which, if present, is visible within <B
CLASS="COMMAND"
>dmesg</B
>, or by <B
CLASS="COMMAND"
>lsmod</B
> if a loaded module.
If you want to find out which modules are loaded, at the command line or in an xterm type the following:</P
><P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
># lsmod</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
>As shown by the prompt above you will need to have root privileges to do this.
You should get output including (but not limited to) the following:</P
><P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>cdrom 29312 0 (autoclean) [sr_mod]
usb-ohci 17888 0 (unused)
usbcore 56768 0 [scanner ibmcam usbvideo usb-ohci]
scanner 8704 0 </PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>If you don't have <TT
CLASS="FILENAME"
>scanner</TT
> loaded, and you know you have USB scanner support in your kernel as a module, try loading it directly:</P
><P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
># modprobe -v scanner</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
>...at which point you should see something like the following:</P
><P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>Using /lib/modules/2.4.20/kernel/drivers/usb/scanner.o</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
>By placing the entry <TT
CLASS="FILENAME"
>scanner</TT
> in <TT
CLASS="FILENAME"
>/etc/modules</TT
> (note that this varies by distribution), you can have the module load at boot-time automatically.
You can then confirm the module was loaded by checking the syslog or in the boot-time record with <B
CLASS="COMMAND"
>dmesg | less</B
>), where you should see an entry such as the following:</P
><P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>May 16 23:17:25 K7 kernel: usb.c: registered new driver usbscanner
May 16 23:17:25 K7 kernel: scanner.c: 0.4.6:USB Scanner Driver</PRE
></FONT
></TD
></TR
></TABLE
></P
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="PARPORT-GENERAL"
></A
>2.8. Parallel Port Scanners</H2
><P
>By now you've probably figured out that configuration of parallel port scanners may be problematic.
Again, if your device has both a parallel port interface and a USB interface you should consider selecting USB to make the setup process easier. </P
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="PARPORT-KERNEL"
></A
>2.8.1. Kernel Parport Support</H3
><P
>For 2.2 and 2.4 kernel systems, parallel-port support must be enabled statically or as a module (stock kernels usually have this enabled by default).
You may want to read <A
HREF="http://www.torque.net/linux-pp.html"
TARGET="_top"
>more generic info about parallel-port device support under the Linux kernel</A
> before starting this process.
To find out for sure if the module <TT
CLASS="FILENAME"
>parport</TT
> is loaded you can check the <TT
CLASS="FILENAME"
>dmesg</TT
> file or use <B
CLASS="COMMAND"
> lsmod </B
> as outlined above.
Using <B
CLASS="COMMAND"
>dmesg | less</B
> you should see (among many other lines) the following:</P
><P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>Mar 3 08:00:25 K7 kernel: parport0: PC-style at 0x378 (0x778) [PCSPP,TRISTATE]
Mar 3 08:00:25 K7 kernel: parport0: irq 7 detected</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
>If you are compiling your own kernel, enable 'Parallel Port support.'
You should enable 'IEEE 1284 transfer modes,' and if you have x86 type architecture you should also enable 'PC-style hardware.' </P
><P
>If modprobe returns an error when you attempt to load the module note that you may need to determine and supply the hardware address when invoking <B
CLASS="COMMAND"
>modprobe</B
>.
The most common address is 0x378 for an x86 system; 0x278 and 0x3BC are other possibilities for integrated or ISA parallel ports.
Add-in PCI parallel ports may have unusual base addresses.
One can also arrange multiple devices with either the parport_pc or parport_arc modules, though that topic is beyond the scope of this document.
WARNING: Be sure you have the correct address before entering this information at the command line or else your machine may become unstable, crash or otherwise implode.</P
><P
>Your parallel port should be set to preferably <SPAN
CLASS="QUOTE"
>"EPP"</SPAN
> mode, or alternatively ECP/EPP.
<SPAN
CLASS="QUOTE"
>"Bidirectional"</SPAN
> (also known as <SPAN
CLASS="QUOTE"
>"BPP"</SPAN
> or <SPAN
CLASS="QUOTE"
>"PS/2"</SPAN
>) may work, albeit much more slowly.
<SPAN
CLASS="QUOTE"
>"Unidirectional"</SPAN
> mode is unsuitable for scanning.
The above setting can usually be accessed through your BIOS menu, at least on x86 systems.</P
><P
>Depending on whether your parallel port scanner requires SCSI support, you may need to patch your kernel for parport-SCSI support.
You can find that suite of tools at <A
HREF="http://www.torque.net/parport/ppscsi.html"
TARGET="_top"
>www.torque.net/parport/ppscsi.html</A
>. If this is required you will also need to enable the following:</P
><P
><P
></P
><UL
><LI
><P
> SCSI support
</P
></LI
><LI
><P
> SCSI generic support
</P
></LI
><LI
><P
> Support for the core module of your ppSCSI controller (t348 for the APA-348 and T348, t358 for the APA-358 and T358, epsa2 for the older Shuttle EPSA-2, epst for the Shuttle EPST and APA-1350, onscsi for the OnSpec 90c26, and sparcsi for the SparCSI and ParaSCSI)
</P
></LI
></UL
>
</P
><P
>Once these are compiled in, it's simply a matter of loading the appropriate modules. </P
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="intro.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="dev-intro.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Introduction</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Making and Accessing the Scanner Devices</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>