[sane-devel] USB kernel scanner driver

Henning Meier-Geinitz henning@meier-geinitz.de
Wed, 23 Oct 2002 18:29:52 +0200


Hi,

While sending some questions and patches to the linux-usb-devel
mailing list, I was asked by Greg KH, the Linux USB maintainer:

| So the userspace SANE tools don't need the scanner driver anymore?  If
| so, I'd be glad to remove the driver, like the others that we dropped a
| while ago for this same reason.

I answered:

| SANE 1.0.9 will have support for both the scanner driver and libusb.
| However, some backends (drivers) still have hardcoded links to
| /dev/usb/scanner? so it will take at least one more version to get it
| right. So basically, no, the scanner driver isn't needed in future. If
| the removal is only in Linux 2.5, I think that's ok. For 2.4, I
| wouldn't do that because people tend to update their kernels more
| often than their SANE package and shouldn't lose their ability to
| access USB scanners.
| 
| I don't know vuescan very well, so maybe it depends on the kernel
| scanner driver. I have no idea about other packages.
| 
| But that's just my personal opinion.

The background is, that there isn't a really good reason to have a
generic driver for USB scanners in the kernel. There is no USB class
for scanners, so the scanner driver must be constantly updated with
new vendor and product ids. Furthermore, the scanner driver doesn't
provide any functionality that can't be accessed through the generic
/proc/bus/usb interface, i.e. libusb.

The reason why this came up is the ongoing trouble concerning the
maintainance of the kernel scanner driver. Adding new device ids is
quite slow, and some long-standing patches haven't been integrated for
months (years?) and generally, the interface is too inflexible. Also,
it just doesn't make sense to keep the vendor and product ids in two
different places (kernel and SANE).

Furthermore, libusb supports more platforms then the Linux-alike
scanner modules.

Since SANE 1.0.9, sanei_usb can also use libusb. If a backend just
uses sanei_usb_attach_matching_devices() with "usb vendor product"
lines or sanei_usb_find_devices() directly, there is no need to change
the backend at all. I's only necessary to keep the vendor and product
ids somewhere in the backend, either in the code itsself or (better)
in the config files.

So the basic question is: Is there anything that the scanner driver
can do that libusb can't and that's needed by any backend? Are there
any other reasons to not remove the USB scanner driver in Linux some
day in the future?

If there are no objections, the plan will be to change the backends to
be able to use both libusb and the kernel scanner module.

The following backends seem to support USB scanners:

canon630u  looks like libusb-ready
coolscan2  looks like libusb-ready
epson      already has a check for vendor/device ids but may need a way
           to search for all epson scanners automatically
mustek_usb is libusb-ready
plustek    will need some work to autodetect all supported scanners
           (currently the approach is: check ids of /dev/usb/scanner for
	   everything we now)
snapscan   looks like libusb-ready
umax       looks like libusb-ready
umax1220u  looks like libusb-ready

I've only looked at the config files and sometimes source code, so I
may be wrong.

Bye,
  Henning