Difference between revisions of "Linux/optical scanners"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
(note about moving to SANE; network scanning section)
m (post-import cleanup)
Line 1: Line 1:
{{stub}}
+
{{seed}}
<center>'''To do''': Parts of this article should be moved
+
<center>'''To do''': Parts of this article should be moved eventually to [[SANE]]</center>
eventually to [[SANE]]</center>
+
[[Computing]]: [[Linux]]: [[Optical Scanners in Linux|Scanners]]
[[Category:Techniques]]
+
 
[[Techniques]]: [[Linux]]: [[Linux:Scanners|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 &ndash; 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.
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==
 
==Some Commands==
(The following worked with an AcerScan 620UT USB scanner I was able to
+
(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:
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
+
lsmod|grep usb
(warty and hoary versions) on a 1.7 GHz AMD Duron.)
+
 
Some scanners need to have the firmware uploaded when first powered up.
+
On Ubuntu, you get the following:
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
+
usbcore 107384 2 ohci_hcd
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.
+
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:
Do this once, to find out what modules you use: lsmod|grep usb
+
 
On Ubuntu, you get the following: usbcore 107384 2 ohci_hcd
+
[[rmmod]] ohci-hcd
With Fedora Core 2, I got "uhci_hcd" instead of "ohci...". Make sure
+
 
you are [[Linux:root|root]], and then substitute the appropriate module
+
(Note that the module commands consider "-" and "_" to be equivalent; "-" is usually easier to type, so I will use it instead.) If the
name in the next command: [[Linux:rmmod|rmmod]] ohci-hcd
+
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
(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.)
 
Ubuntu.)
Next, again substitute the appropriate module name in the following
+
 
command: [[Linux:modprobe|modprobe]] ohci-hcd
+
Next, again substitute the appropriate module name in the following command:
Assuming no errors have shown up, try this: sane-find-scanner
+
 
This should return with something like this:
+
[[Linux:modprobe|modprobe]] ohci-hcd
<pre> # No SCSI scanners found. If you expected something
+
 
different, make sure that # you have loaded a SCSI driver for your SCSI
+
Assuming no errors have shown up, try this: sane-find-scanner This should return with something like this:
adapter. # Also you need support for SCSI Generic (sg) in your
+
<pre>
operating system. # If using Linux, try "modprobe sg".
+
# No SCSI scanners found. If you expected something different, make sure that # you have loaded a SCSI driver for your SCSI adapter.
found USB scanner (vendor=0x04a5 [Color], product=0x2040 [
+
# Also you need support for SCSI Generic (sg) in your operating system.
FlatbedScanner 13]) at libusb:001:002 # Your USB scanner was (probably)
+
# If using Linux, try "modprobe sg". found USB scanner (vendor=0x04a5 [Color], product=0x2040 [FlatbedScanner 13]) at libusb:001:002
detected. It may or may not be supported by # SANE. Try scanimage -L
+
# Your USB scanner was (probably) detected. It may or may not be supported by
and read the backend's manpage. # Not checking for parallel port
+
# SANE. Try scanimage -L and read the backend's manpage. # Not checking for parallel port scanners.
scanners. # Most Scanners connected to the parallel port or other
+
# Most Scanners connected to the parallel port or other proprietary ports
proprietary ports # can't be detected by this program. # You may want
+
# can't be detected by this program.
to run this program as root to find all devices. Once you # found the
+
# You may want to run this program as root to find all devices. Once you
scanner devices, be sure to adjust access permissions as # necessary.
+
# found the scanner devices, be sure to adjust access permissions as
 +
# necessary.
 
</pre>
 
</pre>
As long as you get the "found..." message, something is working. If
+
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
you've gained confidence in how things work, you can skip the next
+
step, which is just to do what the above message recommends:
step, which is just to do what the above message recommends: scanimage
+
 
-L
+
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
+
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
item in any other graphics application) to use the scanner.
+
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:
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
 
* turning the scanner off and on again
* running "rmmod ohci-hcd", turning the scanner off and on, then
+
* running "rmmod ohci-hcd", turning the scanner off and on, then running "[[modprobe]] ohci-hcd"
running "modprobe ohci-hcd"
 
 
* unmounting and mounting usbdevfs
 
* unmounting and mounting usbdevfs
 
==Network Scanning==
 
==Network Scanning==
SANE was designed in a modular way which allows a scanner device to be
+
SANE was designed in a modular way which allows a scanner device to be networked. More information on this once I've played around with it, but meanwhile here's the relevant command: [http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=sane-net sane-net]
networked. More information on this once I've played around with it,
 
but meanwhile here's the relevant command:
 
[http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=sane-net
 
sane-net]
 

Revision as of 16:41, 11 October 2005

This page is a seed article. You can help HTYP water it: make a request to expand a given page and/or donate to help give us more writing-hours!
To do: Parts of this article should be moved eventually to SANE

Computing: 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

Network Scanning

SANE was designed in a modular way which allows a scanner device to be networked. More information on this once I've played around with it, but meanwhile here's the relevant command: sane-net