Recipe for Setting Up a Scanner using USB Karl Larsen November 17, 2002 If the scanner you have has a USB cable that plugs into the computer, and if your computer has a plug for it to plug into, this paper will tell you how to make certain that the software called SANE on your Linux operating system can identify the scanner. First the Linux. It should have at least a 2.4.8 kernel and among other things should have the scanner module compiled and ready for use. Next the SANE. You should have a recent version of this software. To find out what you have, run this simple test. In an Xterm window type scanimage --version. This will print out the backend version and it needs to be 1.0.7 or higher to work well with a USB scanner. If your version is older you need to install the latest version from: http://www.mostang.com/sane/ In terms of the Red Hat Linux, version 7.3 or higher will support running a USB scanner. But depending on your scanner version you might require both a kernel and SANE upgrade. All versions of Linux can work with more USB scanners if you use version 1.0.9 available at the web site above. Plug your scanner into the computer and turn it on. Notice the Name of your scanner and it's model number. Now in a Terminal window at the command line do this: $cat /proc/bus/usb/devices This lists all the data about your USB ports. Here is a copy of my computer's setup: T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2 B: Alloc= 0/900 us ( 0%), #Int= 0, #Iso= 0 D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 P: Vendor=0000 ProdID=0000 Rev= 0.00 S: Product=USB UHCI Root Hub S: SerialNumber=6400 C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=255ms T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=ff(vend.) Sub=00 Prot=ff MxPS= 8 #Cfgs= 1 P: Vendor=04b8 ProdID=010f Rev= 1.00 S: Manufacturer=EPSON S: Product=EPSON Scanner 010F C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr= 2mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=ff Driver=(none) E: Ad=81(I) Atr=03(Int.) MxPS= 1 Ivl=16ms E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms I have an Epson model Perfection 1250 scanner and you can see that this printout is correct for an Epson. Notice at the second P: is listed a number called Vender=04b8 which means Epson. ProdID=010f which means model Perfection 1250 are the 2 numbers we need to set up SANE so it can find the scanner. Not all scanners print out this way. If yours is a Mustek BearPaw 2400 CU Plus scanner it will print out like this: T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 5 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=055f ProdID=021d Rev= 1.00 S: Product=USB Scanner C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms The name doesn't show up but at the P: line you can still get the Vendor and Product numbers which in this are 055f and 021d. The numbers need to be changed to exact Hex numbers so instead of 04b8 it is written 0x04b8 and 010f is written 0x010f. We will use these numbers with the scanner module to set up a working scanner. It's assumed your scanner driver is compiled as a module. To load the module with the scanner numbers in place we use modprobe and we must be in a Terminal window as root. To do this type su - and when it asks for your password type that in. You will see the prompt turn to # and you will be in the /root directory. First to be sure the scanner driver is not already loaded, at the prompt type rmmod scanner. Now type in the following: #modprobe scanner vendor=0x04b8 product=0x010f but instead of my numbers put in your scanners numbers. It should take a second to do it's job and then stop without any error messages. If you get an error message you didn't type it in right. Now to see if SANE can find the scanner. For this we use the tool that comes with SANE called "sane-find-scanner". In a Terminal window type: $sane-find-scanner My Linux came back with this: # Note that sane-find-scanner will find any scanner that is connected # to a SCSI bus and some scanners that are connected to the Universal # Serial Bus (USB) depending on your OS. It will even find scanners # that are not supported at all by SANE. It won't find a scanner that # is connected to a parallel or proprietary port. sane-find-scanner: found USB scanner (vendor = 0x04b8, product = 0x010f) at device /dev/usb/scanner0 Notice the last 2 lines that begin "sane-find-scanner:". It says Sane has found our scanner because it gives the proper vendor and product numbers for my scanner. Newer versions of sane-find-scanner will print different last lines that look like this: found USB scanner (vendor=0x055f, product=0x021d [USB Scanner]) at libusb:001:0 At this point your scanner will probably not work yet but you are sure that SANE can find your scanner. It will work if your scanner is supported by SANE. To use the scanner you will want to load the module scanner each time you turn on your Linux. There are several ways to do this but the most straight forward way is to load scanner from the file /etc/rc.d/rc.local. This file on my computer looks like this: #!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. touch /var/lock/subsys/local # This turns on the scanner module with the Epson scanner modprobe scanner vendor=0x04b8 product=0x010f Testing the setup is easy and takes little time. Remove the scanner module from the kernel with rmmod scanner. Then run sane-find-scanner and see it can't find it. Then use modprobe to re-load it and again run sane-find-scanner and observe it again finds it. At this point you are ready to approach which back end to use with your scanner. If your scanner was made in 2001 or later you should be aware that with a new scanner you will need both a new kernel and SANE. Consider the following. The USB standard defines different kinds of transfer messages. All USB devices have a control pipe, used for control messages. These are used for short commands, like "turn scanner lamp on". If you transfer data, like the image from the scanner, you would use "bulk" pipes instead. So scanners usually have a control and one or more bulk pipes. Early scanner modules couldn't send control messages, only bulk data. Some scanners use the bulk data for everything, but not all. At least the following scanners use control messages: Canon 630u, 636u, Microtek 3600, Umax Astra 1220 U, 2000 U, 2200 U. To use these you must have kernel 2.4.12 installed. The following scanners also need them, but support is not in SANE version 1.0.9 but will be in SANE 1.0.10: Artec Ultima 2000, Boeder SmartScan Slim Edition, Lexmark X70, Medion/Lifetec/Tevion/Cytron MD/LT 9385, Medion/Lifetec/Tevion LT 9452, Medion/Lifetec/Tevion MD 9458, Mustek BearPaw 1200 CS, Mustek BearPaw 1200 CU (Plus), Mustek BearPaw 1200 TA, Mustek BearPaw 2400 CU (Plus), Mustek BearPaw 2400 TA (Plus), Mustek ScanExpress 1200 UB Plus, Packard Bell Diamond 1200, Plustek OpticPro 1248U, Trust Compact Scan USB 19200, Trust Flat Scan USB 19200, Artec E+ 48U, Tevion MD 9693, Medion MD 9693, Medion MD 9705 and Trust Easy Webscan 19200.