Navigation |
HowTo run an EPSON scanner with libusb and hotpluggingLet me first try to answer the question why somebody would want to run Sane with libusb instead of the kernel scanner module: There are actually several reasons to do this on Linux, and a few for other operating systems:
The key for running libusb with hotplugging is that the device (meaning your scanner) is not claimed by any other device driver. This means that if your scanner is supported by the scanner module, it will be claimed by this driver. This is no problem for newer scanners that are not yet supported by this driver, but for older scanners, you have to disable the kernel driver. This is done by e.g. running "rmmod scanner". If your machine uses hotplug, this driver will however be reloaded every time you connect the scanner again (or powercycle) the scanner. Let's assume that no other driver claims your scanner. This means that libusb can access it: Use one of the following configuration strings in epson.conf to tell the backend to use libusb:
Scanner is known by the backendIf the backend already knows about your scanner model, you can just add a line containing the string "usb" to the epson.conf file. The backend will automatically probe for all known EPSON scanners. Scanner is not known by the backendIf you just go the latest and greates scanner from EPSON, chances are that I've
not yet added it's product ID to the backend. This means that you have to tell the
backend what vendor/product IDs to look for. This is done by usign the standard
Sane syntax for libusb support: "usb Getting the permissions right...You probably cannot access the scanner yet, that is if you are not running your frontend as root user. The problem is that the default permissions for new devices are so that normal users cannot access them. But we can change these permissions when the device is loaded by using the hotplug package. Most modern distributions come with hotplug already installed. If it's not installed on your machine, check the installation CD for an optional package. You have to add one or more lines (for one or more scanners) to the file /etc/hotplug/usb.usermap. Every line in this file is for one device, the line starts with a name that will also be used for a handler script. We are trying to get an EPSON scanner working, so let's call the entry "epson_scanner". The next entry is always 0x0003, and I don't know - and don't care - what it stands for, so let's just keep it set to 0x0003. The following two entries are the vendor ID (0x4b8 for EPSON) and the product ID (e.g. 0x11c for the Perfection 3200). The remaining fields are all set to 0, so let's just add the following after the product ID: 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 You can make this a lot simpler by just copying an existing line and replacing the script name and the two IDs. The line for the Perfection 3200 should look like this (the whole string should be on one line, I split it up so that it does not make this page unreasonabl wide): epson_scanner 0x0003 0x04b8 0x011c 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 I already mentioned a handler script that gets started when the device is connected or disconnected. Save the following script as /etc/hotplug/usb/epson_scanner #!/bin/bash if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ] then chown root "${DEVICE}" chgrp scanner "${DEVICE}" chmod 660 "${DEVICE}" fi This script assumes that your computer knows about a group named "scanner", add this to the file /etc/group, give it a unique group id (the number after the password entry). Mine looks like this: scanner:x:102:root,khkOnce I log out and log in again, the system knows that I am part of the scanner group. When the scanner gets switched on, the hotplug system will recognize it and will run the epson_scanner script, which will then change the permissions on the device file associated with the scanner to 660, which means that root and members of the scanner group can both read and write from/to this device. This should give you a working scanner without the kernel scanner module. |
Last changed on Sat Jan 25 13:11:09 2003 | |
Karl Heinz Kremer khk@khk.net http://www.khk.net |