Linux/optical scanners

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< Linux
Revision as of 22:08, 24 June 2005 by Woozle (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:stub Techniques: Linux: Scanners Getting a scanner to run under Linux can be easier or harder than under Windows. If you don't have the driver disk, you're usually sunk with Windows; with Linux, the scanner drivers included in most distros can handle most scanners. Scanning under Linux is handled by the SANE subsystem. Its Windows counterpart, TWAIN, includes the user interface with the scanning routines -- in other words, the look-and-feel of the scanner controls are part and parcel with the drivers which talk to the scanner. If you like the way the driver works but hate the way the controls work, the most you can do is buy a different scanner. SANE, however, separates the user interface from the drivers.

Some Commands

(The following worked with an AcerScan 620UT USB scanner I was able to get working on two different Linux distros, the first being Fedora Core 2 (running on a 450 MHz Athlon) and the second being Ubuntu/Kubuntu (warty and hoary versions) on a 1.7 GHz AMD Duron.) Some scanners need to have the firmware uploaded when first powered up. SANE can be configured to do this (need to document), but if the scanner gets switched off without a computer reboot, SANE may need to be prompted to re-upload. As far as I know, the only way to do this is to re-initialize part of the USB subsystem. Do this once, to find out what modules you use: lsmod|grep usb On Ubuntu, you get the following: usbcore 107384 2 ohci_hcd With Fedora Core 2, I got "uhci_hcd" instead of "ohci...". Make sure you are root, and then substitute the appropriate module name in the next command: rmmod ohci-hcd (Note that the module commands consider "-" and "_" to be equivalent; "-" is usually easier to type, so I will use it instead.) If the command takes more than a second or two to return to a prompt, turn off the scanner, wait a few seconds, and then turn it back on again. (This was necessary under FC2 but not under Ubuntu; this may have been a hardware difference. The scanner generally behaved better under Ubuntu.) Next, again substitute the appropriate module name in the following command: modprobe ohci-hcd Assuming no errors have shown up, try this: sane-find-scanner This should return with something like this:

 # No SCSI scanners found. If you expected something
different, make sure that # you have loaded a SCSI driver for your SCSI
adapter. # Also you need support for SCSI Generic (sg) in your
operating system. # If using Linux, try "modprobe sg".
found USB scanner (vendor=0x04a5 [Color], product=0x2040 [
FlatbedScanner 13]) at libusb:001:002 # Your USB scanner was (probably)
detected. It may or may not be supported by # SANE. Try scanimage -L
and read the backend's manpage. # Not checking for parallel port
scanners. # Most Scanners connected to the parallel port or other
proprietary ports # can't be detected by this program. # You may want
to run this program as root to find all devices. Once you # found the
scanner devices, be sure to adjust access permissions as # necessary.

As long as you get the "found..." message, something is working. If you've gained confidence in how things work, you can skip the next step, which is just to do what the above message recommends: scanimage -L If scanimage seems happy, then you should be able to use the "File / Acquire / XSane / Device Dialog" menu in GIMP (or a corresponding menu item in any other graphics application) to use the scanner. Sometimes I got the "found USB scanner" message and then the next step wouldn't work, and doing "sane-find-scanner" again would claim it could no longer find my scanner. At that point, I've tried several different things and always eventually been able to get it to work:

  • turning the scanner off and on again
  • running "rmmod ohci-hcd", turning the scanner off and on, then

running "modprobe ohci-hcd"

  • unmounting and mounting usbdevfs