Linking to pages and resources on this site is encouraged, but the links MUST be placed on a publically-accessible page. Placing links behind any form of login or access restriction is strictly forbidden.

Ubuntu: udev rules for USB scanner


How to create a udev rule to get a USB scanner working in Ubuntu jaunty.

Assumes that: (1) user is a member of group "scanner", (2) sane is installed.

Symptoms of problem: "sane-find-scanner" detects the existence of the scanner, but "scanimage -L" does not report it when run with user permissions, only when run with root permissions. Scanning works as root, but not as a normal user.

1) Run "lsusb" to find the scanner's manufacturer and device IDs. Example output:

$ lsusb
Bus 003 Device 014: ID 04b8:012e Seiko Epson Corp.
Bus 003 Device 012: ID 046d:c408 Logitech, Inc. Marble Mouse (4-button)
Bus 003 Device 011: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 013: ID 04b8:0005 Seiko Epson Corp. Stylus Printer
Bus 001 Device 001: ID 0000:0000
$


In the above example, the first line relates to the scanner... in this case an Epson Perfection V200... it is somewhat unhelpful that this particular scanner's text ID string is nothing more than "Seiko Epson Corp.", but it is easy to determine that that device is indeed the scanner by running "lsusb" both with and without the scanner plugged in.

The four-digit hex number "04b8" is the manufacturer ID (observe that the Epson printer on the penultimate line has the same manufacturer ID), and "012e" is the device ID.

2) Create a file /etc/udev/rules.d/40-scanner.rules containing the following (your browser may have wrapped this; it should be all on one line):

SUBSYSTEMS=="usb", ATTRS{idVendor}=="04b8", ATTRS{idProduct}=="012e", ENV{libsane_matched}="yes", GROUP="scanner"


Of course you will substitute the appropriate values for your scanner, obtained from "lsusb", for the idVendor and idProduct entries.

The SUBSYSTEMS and ATTRS entries have double == signs whereas the ENV and GROUP entries have single = signs. This is not a typo.

3) Restart udev:

$ sudo /etc/init.d/udev restart
* Stopping kernel event manager... [ OK ]
* Starting kernel event manager... [ OK ]
$


4) Unplug the scanner and plug it in again.

5) Check that it has obtained the correct permissions. Run "lsusb" again to determine the bus and device IDs - they will have changed due to the unplugging and replugging. Then check the appropriate device node in /dev/bus/usb:

$ lsusb
Bus 003 Device 015: ID 04b8:012e Seiko Epson Corp.
Bus 003 Device 012: ID 046d:c408 Logitech, Inc. Marble Mouse (4-button)
Bus 003 Device 011: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 013: ID 04b8:0005 Seiko Epson Corp. Stylus Printer
Bus 001 Device 001: ID 0000:0000
$ ls -l /dev/bus/usb/003/015
crw-rw-r-- 1 root scanner 189, 269 Apr 24 19:10 /dev/bus/usb/003/015
$


If the output corresponds with the above, all should be well, and running "scanimage -L" with user permissions should now pick the scanner up:

$ scanimage -L
device `epkowa:libusb:003:015' is a Epson Perfection V200 flatbed scanner
$


Note that the V200 requires a driver. Two packages, iscan and iscan-plugin-gt-f670 (apparently the V200 is also called that sometimes) must be installed, before carrying out the procedure described above. The latest versions (iscan is up to 2.30 at the time of writing) are available on Epson's website (used to be on Avasys's). I tried these, for experiment. They didn't work. I cannot now remember how or why they didn't work. The reason I can't remember is because I also don't care. The reason I don't care is because I have older versions installed and they work just fine. Here are tarballs of the versions I am using, containing both the i386 and amd64 versions of the packages:

iscan_2.19.0-4doctormo2_orig_and_debs.tar.gz
iscan-plugin-gt-f670_2.1.2-1_rpms_and_debs.tar.gz

You don't, of course, need this driver if your scanner is not a V200; you need only the udev rules. A few other scanners also require their own specific drivers, but the majority of scanners do not. Use the SANE project database to check the compatibility and requirements of your particular scanner.




Back to Pigeon's Nest


Be kind to pigeons




Valid HTML 4.01!