Epson Perfection 1650 USB Scanner Howto

For Red Hat Linux 7.2

By Phil Jones (pjls16812 at blueyonder.co.uk), July 2002

About this document

This page describes how I successfully got an Epson Perfection 1650 USB scanner working with Red Hat Linux 7.2.

The bad news (and the good)

Red Hat Linux 7.2 doesn't come with all the software needed to use the scanner. You have to download and compile a new version of part of SANE (Scanner Access Is Now Easy). Fortunately, the procedure is quite straightforward and it's fully described here. The good news is once it's set up it's very robust. You don't even need a graphical display to get pictures from the scanner.

How it works

When the scanner is plugged in to the computer, the kernel detects the new USB device. A scanner driver kernel module is included in Red Hat Linux 7.2. This makes the scanner accessible as the device /dev/usb/scanner0.

You use a tool to operate the scanner. This is provided by sane-backends. There is a command line program, 'scanimage', included with sane-backends. When you run scanimage, a configuration file is read to find out the type of scanner and where it is (epson and /dev/usb/scanner0 respectively). In its simplest form, scanimage lets you list the available scanners, do a sanity test, and read from the scanner in monochrome.

For more advanced scanning, use sane-frontends or xsane. This is optional and you don't need sane-frontends or xsane to hear that reassuring scanning noise and see some output from the scanner.

Getting started

I assume you have no USB peripherals other than your new scanner. Plug your Epson Perfection 1650 into one of your computer's USB ports. Then type:

dmesg

Somewhere in the output you should see lines like this:

hub.c: USB new device connect on bus1/2, assigned device number 2
usb.c: USB device 2 (vend/prod 0x4b8/0x110) is not claimed by any active driver.
usb.c: new USB bus registered, assigned bus number 2
hub.c: USB hub found
hub.c: 2 ports detected

These lines mean the scanner was found on a USB socket. The scanner has been assigned the device number 2. The device vendor ID is 0x4b8, and the product ID is 0x110.

Next, enter this command, as root:

insmod scanner vendor=0x4b8 product=0x110

The response from the computer should be a line like this:

Using /lib/modules/2.4.7-10/kernel/drivers/usb/scanner.o

Then enter the dmesg command again and you should see these new lines:

usb.c: registered new driver usbscanner
scanner.c: probe_scanner: User specified USB scanner -- Vendor:Product - 4b8:110
scanner.c: USB Scanner support registered.

If you see this, congratulations! Your scanner is now available as the device /dev/usb/scanner0.

To make this happen every time you start up your computer, add the following line to your /etc/rc.local configuration file:

insmod scanner vendor=0x4b8 product=0x110

Setting up scanner access

Now you know the scanner is available, but you haven't seen its lights flash, heard its noise or seen any output yet. The tool for these tasks is called SANE (Scanner Access Is Now Easy). As explained above, you need a new version of sane-backends for compatibility with the Epson Perfection 1650.

Caution! Source code compilation ahead!

You need a working build environment on your Linux system. Don't worry, this isn't as scary as it sounds. Put simply, you need to have selected the "Software Development" package group when you installed Red Hat Linux 7.2. If you didn't, the simplest answer is to run the Red Hat installer again, select Upgrade, then select Custom, and make sure "Software Development" is selected.

Installing sane-backends

Remove the existing RPM of sane-backends, if you already have it installed. There's no need to remove sane-frontends or xsane, if you have those installed. The command to remove sane-backends, as root, is:

rpm -e --nodeps sane-backends

Download the latest version of sane-backends from http://www.mostang.com/sane/. At the time of writing, the current version of sane-backends is 1.0.8 which includes support for the Epson Perfection 1650. The FTP link for the download is ftp://ftp.mostang.com/pub/sane/sane-1.0.8/sane-backends-1.0.8.tar.gz.

Unpack the archive with this command:

tar xvzf sane-backends-1.0.8.tar.gz

Change into the new directory:

cd sane-backends-1.0.8

Configure and build the software using these commands:

./configure --prefix=/usr --sysconfdir=/etc
make

Note that the '--prefix' and '--sysconfdir' options get the software installed in the same places that the RPM version would have done. Finally, install the software using this command, as root:

make install

To undo the installation, type make uninstall, and to undo the configure and make steps, use make distclean.

Finally, as root, edit /etc/sane.d/epson.conf. Uncomment the last line, so it reads:

# epson.conf
#
# here are some examples for how to configure the EPSON backend
#
# SCSI scanner:
scsi EPSON
#
# Parallel port scanner:
#pio 0x278
#pio 0x378
#pio 0x3BC
#
# USB scanner - only enable this if you have an EPSON scanner. It could
#               otherwise block your non-EPSON scanner from being
#               recognized.
#               Depending on your distribution, you may need either the
#               first or the second entry.
#usb /dev/usbscanner0
usb /dev/usb/scanner0

Does it work?

Run this command as a normal user:

scanimage --list

You should see this response:

device `epson:/dev/usb/scanner0' is a Epson GT-8200 flatbed scanner

If you did, that's great. If you didn't, the scanner isn't connected right, or something else is wrong. You may need to join the SANE mailing lists and ask there.

If you were able to list the scanner, try this:

scanimage --test

You should see your Epson Perfection 1650's lights flash and hear the carriage move! Then you should see output like this:

scanimage: scanning image of size 424x584 pixels at 1 bits/pixel
scanimage: acquiring gray frame, 1 bits/sample
scanimage: reading one scanline, 53 bytes...    PASS
scanimage: reading one byte...          PASS
scanimage: stepped read, 2 bytes...     PASS
scanimage: stepped read, 4 bytes...     PASS
scanimage: stepped read, 8 bytes...     PASS
scanimage: stepped read, 16 bytes...    PASS
scanimage: stepped read, 32 bytes...    PASS
scanimage: stepped read, 64 bytes...    PASS
scanimage: stepped read, 63 bytes...    PASS
scanimage: stepped read, 31 bytes...    PASS
scanimage: stepped read, 15 bytes...    PASS
scanimage: stepped read, 7 bytes...     PASS
scanimage: stepped read, 3 bytes...     PASS

This is a sanity check which tests reading from the scanner in particular. If all is well, try this command:

scanimage

Then you should see some garbage characters. That is the output of the scanner in PNM (Portable aNyMaP) format.

Now try this:

scanimage -v > out.pnm

This will do a basic monochrome scan and the output will be the file 'out.pnm'. You can view this image file using an image viewer such as gqview, Electric Eyes or The Gimp. Use one of these commands:

gqview out.pnm
ee out.pnm
gimp out.pnm

Here is what my desktop looks like after running scanimage -v > out.pnm and then ee out.pnm

Once you have got basic scanning working, you can experiment with the more advanced tools like XSane, shown here.

The Epson Perfection 1650 can scan at up to 1600 dots per inch and this is fully supported in Linux. At this resolution you can clearly see the halftone in the printed original I've scanned in this example. The irregular blue line of spots is supposed to be there.

Links

Feedback

If this document helped you then please do let me know, my email is at the top of this page. Comments and queries also welcome.