SANE EPSON Backend - Perfection 1640 Instructions


Navigation

The following instructions have been contributed by Adrian Lawrence:

Epson 1640SU scanner
~~~~~~~~~~~~~~~~~~~~

This is a flatbed scanner with options for a transparency adapter (TPU) and a
document feeder. The 1640SU Photo is just the standard scanner bundled with
the TPU. The 1640SU Office bundles the document feeder.

I had a few problems getting the 1640SU working under linux, so I am posting
this to help others.

The 1640SU has both SCSI and USB interfaces, and comes supplied with a USB
cable. I only deal with the USB option here.

You need a kernel which has USB support. These notes refer to 2.2.18.

Compile a kernel with usb and scanner modules: if you don't know how to do
that, you will need to read the Kernel-HOWTO and the README file in the
kernel sources. You will need to select the right module for your USB host
which is usually integrated into recent motherboards. Read the documentation
in the kernel sources: linux/Documentation/usb/, especially ohci.txt,
uhci.txt, usb-help.txt and scanner.txt.

Examine linux/drivers/usb/scanner.h and insert the 1640SU entry if it is
not already there:-

	/* Seiko/Epson Corp. */
                { 0x04b8, 0x0101 },     /* Perfection 636U and 636Photo */
                { 0x04b8, 0x0103 },     /* Perfection 610 */
                { 0x04b8, 0x0104 },     /* Perfection 1200U and 1200Photo */
                { 0x04b8, 0x010a },     /* Perfection 1640SU and 1640SUPhoto */

Alternatively, you can pass these values as module parameters by a line in
/etc/modules.conf:-

options scanner product=0x10a vendor=0x4b8

Look for RD_NAK_TIMEOUT and make sure that it is at least 20. I use 40:-

#define RD_NAK_TIMEOUT (40*HZ)  /* Number of X seconds to wait */
  
When you configure the kernel, perhaps using "make xconfig", select
CONFIG_USB=m            -- compile USB as a module
CONFIG_USB_DEBUG=y      -- probably a good idea until everything is workng
CONFIG_USB_DEVICEFS=y  
CONFIG_HOTPLUG=y	-- you will only want to turn the scanner on
			-- occasionally, if only to save the lamp life

CONFIG_USB_UHCI=m	-- if this is what your mbrd needs
CONFIG_USB_SCANNER=m
CONFIG_PROC_FS=y	-- useful for checking.


After the compilation of the kernel, you will need to install it and reboot,
but don't forget to run lilo if that is what you use for booting. And make 
sure that you have at least one known working alternative kernel in case of
problems. 

That said, in some cases, you might be able to get away with only compiling
and installing the modules: don't forget "depmod" in that case.

You expect to see something like

$ls -l /lib/modules/2.2.18/usb
total 104
-rw-rw-r--    1 root     root         7452 Jan  9 23:30 scanner.o
-rw-rw-r--    1 root     root        24536 Jan  9 23:30 usb-uhci.o
-rw-rw-r--    1 root     root        71587 Jan  9 23:30 usbcore.o
  

The corresponding entries in /etc/modules.conf will be something along
these lines:-

alias char-major-180 usb-uhci
pre-install usb-uhci modprobe scanner

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Once you have a kernel with usb modules, you ought to be able to see
your scanner.

Make sure that you have connected the scanner to the computer with the USB 
cable, and turn on the scanner.

As root, insert the scanner module:-
 
	modprobe scanner

To confirm that all is well, type
	lsmod
and you should see something like 

  usb-uhci               18752   0  (autoclean) (unused)
  scanner                 4672   0 
  usbcore                47120   0  (autoclean) [usb-uhci scanner]

among the entries.

Next mount the usbdevfs:

	mount -t usbdevfs none /proc/bus/usb/

Now you should be able to see your hardware:
	ls -l /proc/bus/usb
This should show something like:-
dr-xr-xr-x    1 root     root            0 Jan 11 21:46 001
-r--r--r--    1 root     root            0 Jan 11 21:46 devices
-r--r--r--    1 root     root            0 Jan 11 21:46 drivers

less /proc/bus/usb/devices will show various items including something like
...
P:  Vendor=04b8 ProdID=010a Rev= 1.04
S:  Manufacturer=EPSON
S:  Product=Perfection1640
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=  2mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=usbscanner
...
 
and less /proc/bus/usb/drivers :-
 48- 63: usbscanner
         hub
         usbdevfs

Look also in your kernel log, probably /var/log/messages, for messages like:-

Jan 11 21:46:20 anon kernel: usb.c: USB new device connect, assigned device number 2
Jan 11 21:46:20 anon kernel: Manufacturer: EPSON
Jan 11 21:46:20 anon kernel: Product: Perfection1640

All of this has been diagnostic to make sure that the USB communications with
the 1640SU scanner is working. You do not need to do any of this to use the 
scanner normally.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To use the scanner, you almost certainly need the sane packages: at least
sane-backends-1.0.4 and sane-frontends-1.0.4. Go to
http://www.sane-project.org/ and follow the various links.
Here I assume that you will compile and install these packages locally.
And it is a good idea to collect the latest sane-epson component from
http://freecolormanagement.com/sane/ and read the notes there.

You probably want to comment everything out of /usr/local/etc/sane.d/dll.conf
except "epson", and the only active entry in /usr/local/etc/sane.d/epson.conf
should be
	usb /dev/usb/scanner0 
if your scanner is on USB port 0. But you might want to add some options later.


Once you have the sane programs compiled, you will want to use at least one
of  xscanimage, scanimage and xsane.

*WARNING* (x)scanimage 1.0.4 does not support 14/(42) colour scanning yet!

This is mentioned in the TODO file, but if you try and use it, it silently
fails: the image data is correct, but it is written as if it there are
8 bits/colour so viewing programs are confused.

*WARNING* Many viewing programs (display, gimp, gqview) do not handle
42 bit colour image data correctly, at least in some versions.

Apart from the problem with 14bits/colour in the current scanimage, 
it is a useful program for checking that things are working.

Under normal circumstances (usbdevfs not mounted), the usb modules are not
loaded. Invoking xsane, xscanimage or scanimage causes the modules to be loaded
(via the entry in /etc/modules.conf). 

Typing 
	scanimage -d epson:/dev/usb/scanner0 -h 
will fail the first time, but will cause the scanner to be interrogated.
Repeating the command will give something like:-

[...snip ...]

Options specific to device `epson:/dev/usb/scanner0':
  Scan Mode:
    --mode Binary|Gray|Color [Binary]
        Selects the scan mode (e.g., lineart,monochrome, or color).
    --depth 8|14 [inactive]
        Number of bits per sample, typical values are 1 for "line-art" and 8
        for multibit scans.
    --halftoning None|Halftone A (Hard Tone)|Halftone B (Soft Tone)|Halftone C (Net Screen)|Dither A (4x4 Bayer)|Dither B (4x4 Spiral)|Dither C (4x4 Net Screen)|Dither D (8x4 Net Screen)|Text Enhanced Technology|Download pattern A|Download pattern B [Halftone A (Hard Tone)]
[..snip..]
  Optional equipment:
    --source Flatbed|Transparency Unit [Flatbed]
        Selects the scan source (such as a document-feeder).
    --auto-eject[=(yes|no)] [inactive]
        Eject document after scanning
    --film-type Positive Film|Negative Film [inactive]
        
    --focus-position Focus on glass|Focus 2.5mm above glass [Focus on glass]
        Sets the focus position to either the glass or 2.5mm above the glass
    --bay  1 | 2 | 3 | 4 | 5 | 6  [inactive]
        select bay to scan
    --eject [inactive]
        Eject the sheet in the ADF
[..snip..]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If all is well, you should now be able to scan using, say, xsane. However,
xsane will say "No devices available" if the scanner is switched off.

Once xsane has started, please look in the "View" menu. I, for one, did not
realize that the "Show Standard Options" was an extra window over and above 
the main window. That extra window includes things like the bit depth button 
for colour scanning. You will probably want to turn on the "Advanced
Options" window as well.

Click on the preview button and you should find that your scanner
bursts into life: the lamp will be on already. But especially when
the TPU is installed, there is a long delay while the lamp stabilizes. 
That long delay is why you needed to patch scanner.h much earlier. The lamp
is then turned off for a moment, then back on, and the scan starts.

You should now be able to do full scans. If you have got this far without
serious hurdles, then that is the purpose of these notes.

A E Lawrence


Last changed on Sun Oct 5 11:42:14 2003 Validated HTML 4.0
Karl Heinz Kremer
khk@khk.net
http://www.khk.net