Setting up V300 Scanner in Unix(Linux)

Donald Kenney (donaldkenney@gmail.com)
Last Update: Wed May 18 14:00:57 2016



Introduction

One of the problems in using flatbed (as opposed to all-in-one) scanners in Unix/Linux is that few if any scanners that one can buy off the shelf at any moment in time actually work with Unix without tinkering. Although there is a long list of compatible devices on the SANE website, they seem entirely to be older models that are no longer sold new.

Worse, the documentation on persuading a scanner to work is fragmented, sometimes out of date, often less than helpful and the Operating System interfaces have been in (and remain) in a state of constant change.

Here are some notes on getting the inexpensive Epson Perfection V300 scanner to work in Slackware Linux Version 12.1.

This incidentally is the last item on my list of things that had to be done before I could completely abandon Windows. As I projected when I started, the switch to Linux has taken me several years and has been far from painless (And in fact, I have still a copy of Win98 running in a VM so I can run snood which does not run properly in wine. I reckon that I'm not completely Windows free even now.)

Make sure that your USB works

This may seem elementary, and it may also seem unnecessary since one would think that no modern PC unix would ship without USB support. However, one of the dual boot options on my main computer is Ubuntu 8.04 which was released in April 2008. Not only did my Ubuntu 8.04 have USB turned off, but once USB was activated, it turned out to be misconfigured and, at best, to work erratically and only for certain devices. My scanner is not one of them. Could I fix it? Probably. Am I going to? I quit using Ubuntu because I thought it to be obtuse, somewhat oddly built, and way too hard to fix. Why would I want to invest time in fixing it?

Be that as it may, here are a few tests that can and possibly should be run to verify that your Linux computer supports USB. All but the last can be run before paying money for a scanner:

What should you do if your USB doesn't work?

Fix it ... Or find another distribution where USB doesn't need fixing. Most shouldn't. Unfortunately, Linux usb support is complicated and, worse, it is a moving target so that what was needed to fix it 8 years ago is not what was needed 4 years ago, and may not be what is needed today. Fixing it is non-trivial.

What could be wrong? The kernel may not have USB support turned on or USB support may be supplied via hardware dependent loadable modules (commonly ehci-hcd,ohci-hcd,uhci-hcd) that are not being loaded. These may not be statically loaded or the dynamic loading mechanism may not be working. Configuration ("rules") files for the udev and or hald subsystems (which may not even be present on older releases) might be faulty. There can also be problems with USB hardware. Conceptually, all USB hardware is fully functional and fully compatible. In practice, some ports and devices sometimes are more fully functional and compatible than others.

Enough of USB for now -- what software Is needed to make the Scanner Work

What Software is Needed?

Basically, you need three things to make a V300 scanner work.

Where does one get that stuff?

Installation and Configuration

Installation

For reasonably current Unix releases, there is a good chance that installing the SANE and iscan packages plus possibly a few configuration tweaks are all that is required. If they aren't, try the alternate configurations

Configuration

The following settings may be needed.

Root vs User

In my opinion, those who think that the Unix security model is useful on a personal computer are delusional. (It is useful and largely effective for preventing users from stumbling over each other in a true multi-user environment). In time, I expect that most of them will learn that they are depending on an erratic, bad tempered, and largely ineffective guard dog for security. In the meantime, however, we must deal with the fact that not only is the model ineffective, it doesn't usually tell one if the rules have been violated. Things simply fail with no user explanation (ghastly human factors, useless, but very likely secure).

In order to avoid permission problems, I would strongly recommend installing and testing scanner software while running as root. If one actually exists in a multi-user environment or it one thinks the security model might have merits (unlikely IMHO, but I'm wrong sometimes), user permissions can be straightened out once it is clear that the scanner works and the only issue is permissions. In general, the user or the group including the user, must have both read and write permissions for devices and read permission for files. Keep in mind that if devices are set up dynamically, as USB devices often are, the rules or scripts for creating the device files must set the necessary permissions -- probably 660 or higher.

Alternate Configurations

This section is intended to describe some of the complexities of interfacing a V300 to USB on an older PC/Unix distribution. In effect, what we have here is a brief history of how USB is interfaced to Unix.

In the beginning there was the fixed device. Internally, this is a file like entity in the /dev directory created by the mknod program. It consists of a single 8 bit major node that tells the kernel what driver to use and an associated 8 bit minor mode that uniquely identifies the device. This arrangement worked very well for most devices until hot plugable device systems like pcmcia and usb came into use. The initial practice was to install usb drivers, a usb scanner driver (typically scanner.o), create an appropriate node (typically major 180, minor 43 = /dev/sg0), and hope that the scanner came up in the same place the next time it was turned on.

That arrangement was not terribly satisfactory, so hotplug was created and released with the 2.2.19 Linux kernel. Basically, hotplug is a subsystem that checks for changes in I/O configuration and runs scripts if specific conditions occur. The usb related portion of the scripts still needs to create a device node. A scanner.o module is still required in the kernel. Hotplug is used with 2.4 and some early 2.6 kernels. Hotplug configuration files should be in /etc/hotplug/usb/directory.

The next step was to replace hotplug by defining a separate file system for dynamically installed/removed devices. This file system is called udev. Udev contains a monitoring system analogous to hotplug that monitors hardware state and performs actions defined by "rules". udev allows usb devices to be arbitrarily plugged and unplugged with minimal confusion. Udev is used in 2.6. kernels.

Yet another rule based hardware detection and enablement system is the Hardware Abstraction Layer (HAL). Proponents of HAL seem quite enthused about it. I must confess that I do not understand HAL or what it is good for. It is, nonetheless, possibly important because it seems that a usb scanner could be detected and configured via HAL rather than udev. You may be interested to know that HAL might be replaced by DeviceKit at some point.

Finally, there is libusb which is a collection of programs (an API) that allows usb devices to be accessed without the need for kernel code. The use of libusb is apparently the reason that SANE libraries are used by iscan.

  1. If you need to determine what kernel version your Linux is running, try uname -r.
  2. To determine if udev is in use, run ps -A | grep udev. If a udevd device shows up, **udev ** is in use.
  3. To check for a Hardware Abstraction Layer, ps -A | grep hald and see if a hald process is listed.

/dev and module scanner.o or scanner.ko

Those used to Unix without libusb may feel an urge to run modprobe scanner.o or insmod scanner.o to load a scanner device driver into the kernel. This has not been needed since the 2.6.26 kernel unless you need for some reason to use hotplug to access the scanner instead of libusb. It might actually be counterproductive.

Likewise /dev/scanner or /dev/usbscanner should not be set if libusb is to be used. Of the two,/dev/usbscanner is least bad as all of the usb and scsi backends will be checked against the /dev/scanner device if the device is defined. That's time consuming at the very least.

Does the scanner Work?

Easiest way:

  1. Boot the computer.
  2. Turn the scanner on. Green light should come on
  3. Plug the scanner usb cable into the computer.
  4. Run iscan. You will then have to wait for a while iscan finds the scanner. When (if) it is found, the scanner motor will come on and the lights will blink. If things are properly configured (and only one scanner is present) iscan will eventually run. If multiple scanners are present or are thought to be present, the process will take longer and you will have to manually select a scanner.

Other potentially useful commands

  1. strace -e trace=open iscan will run iscan (or anything else) listing all the files opened. There are a multitude of other options for strace. If iscan quits without scanning, check which files were opened just prior to the end. Very likely one of them is a configuration file or some such that is missing or needs changes.

  2. scanimage -L may (eventually) provide a listing of the available scanners. lsusb will do the same thing (and faster) but using scanimage will confirm that the scanning software can communicate with the scanner.

  3. scanimage -T will test the scanner. If there are multiple scanners, you will need to specify a --device= parameter. Documentation says that the scanner must be manually reset by physically removing power after the test. That does happen sometimes ... and not just after tests. But sometimes it doesn't.

Some Links

  1. https://web.archive.org/web/20090606135326/http://www.linux-solved.com/post/SOLVED-Epson-V300-flatbed-scanner-support-33777.html
  2. Ubuntu discussion 2006. Early situation for V300 embedded in discussion of 1670 scanner.
  3. Ubuntu V300 situation 2008
  4. V300 install on Ubuntu Jan 2009 http://tuxi.ripabe.net/?p=100
  5. iscan installation manual
  6. Slackware install info
  7. iscan-registry -a interpreter usb 0x04b8 0x0131 /usr/lib/esci/esci-interpreter-gt-f720
  8. v200 installation
  9. hotplug https://web.archive.org/web/20080207165855/http://linux.about.com/library/cmd/blcmdl8_hotplug.htm
  10. see USB_SCANNER_CONFIG
  11. and scanner.txt
  12. udev - with links to background info at http://web.archive.org/web/20110721110427/http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html
  13. Linux usb FAQ
  14. usb file permissions


Copyright 2006-2012 Donald Kenney (Donald.Kenney@GMail.com). Unless otherwise stated, permission is hereby granted to use any materials on these pages under the Creative Commons License V2.5.

This page will have been validated as Valid HTML 4.01 Transitional prior to posting on the web site. W3C Logo Image omitted.