[sane-devel] scanimage timeouts

Henning Meier-Geinitz henning@meier-geinitz.de
Tue, 21 Jan 2003 23:48:38 +0100


On Tue, Jan 21, 2003 at 06:29:25PM +0100, Marcel Pol wrote:
> On Tue, 21 Jan 2003 13:14:12 +0100
> Henning Meier-Geinitz <henning@meier-geinitz.de> wrote:
> > On Tue, Jan 21, 2003 at 11:06:35AM +0100, Marcel Pol wrote:
> > > I currently use Sane 1.0.9, and when I enable all backends it takes a long
> > > time to run scanimage -L
> > 
> > That's a known issue of the Linux USB scanner driver. The problem is
> > that the scanner driver issues an error for each device file that it
> > doesn't know about. Check your syslog. If you have /dev/usb/scanner0 -
> > /dev/usb/scanner15 but only one scanner, there will be syslog entries
> > for devices 1-15. And this is repeated over and over again for each
> > test. Check your syslog.
> > 
> > Fix (downgrade this error to a dbg) is in Linux 2.4.21-pre3. Or get
> > the latest code from http://www.meier-geinitz.de/kernel/.
> I'm currently using 2.4.21-pre3, that's what I used this morning also.
> I don't have any devices listed under /dev/usb, because Ii use devfs, which
> only ceates dev files when devices are there.

Ok, so I used devfs for the first time in my life to check this out :-)

You are right, that one is not related to the scanner driver. It also
happens if the scanner driver isn't loaded at all.

I quick test shows that opening non-existing devices with devfs is
just extremely slow. The same goes for stat() instead of open().
1000 stats take 11 seconds if the file does not exist and 0.01
seconds if it exists :-(((

> > Possible work-arounds:
> > - Use libusb instead of scanner module (you may need sane 1.0.10-pre2
> >   for this to work with all backends).
> I could try this, and see how it works. All usb scanners should be supported
> by it?

As far as I know, yes.

> > - disable "usb vendor product" lines in backend .conf files and use
> >   hardwired device names instead (e.g. /dev/usb/scanner0)
> I noticed the snapscan driver has a lot of these lines.

It supports lots of scanners.

> Can these be uncommented,

You mean: commented out?

> since they are integrated into the scanner kernel driver? Even if I
> had such a scanner?

No, they won't be detected in this case. At least not automatically.

The idea of the usb lines is to just plug in the scanner and run sane.
If you don't use them, you must edit the config files and put
/dev/usb/scanner0 or whatever file in the device line. So that
requires manual editing everytime you use a different scanner.

Another workaround is to decrease the number of files that are checked
in sanei_usb.c. E.g. the check of /dev/usbscanner* can be removed for
your distribution, I guess. You could also decrease the number of
files in /dev/usb/scanner* that is checked from 16 e.g. to e.g. 4.
That means, that only four scanners can be detected at the same time.
I guess that works for most people but should be documented.

> I'm not just asking for myself. In the Mandrake packages all drivers
> are disabled by default, and can be enabled by scannerdrake, a config
> utility. This is not the way it should be....

True. That's why we have this autoconfiguration stuff.

I have no idea, why devfs is so slow. Is this problem new, or has that
happened with older kernels, too?

I will do some more tests.