[sane-devel] scanimage timeouts

Henning Meier-Geinitz henning@meier-geinitz.de
Tue, 21 Jan 2003 13:14:12 +0100


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/.

scanimage -L takes 0.5 seconds here with this patch.

Possible work-arounds:
- Remove /dev/usb/scanner* entries you don't need.
- Use libusb instead of scanner module (you may need sane 1.0.10-pre2
  for this to work with all backends).
- disable backends you don't need
- disable "usb vendor product" lines in backend .conf files and use
  hardwired device names instead (e.g. /dev/usb/scanner0)

> I ran Xsane with sane_debug_dll=128, and I experienced long timeouts with
> these backends:
> snapscan:  9 seconds
> plustek:	 15 seconds

These are backends that test for lots of USB scanners.

> dc210:  11 seconds
> dc25:  30 seconds

That's a different problem (not an USB device). Also, these backends
are disabled by default.

> At the moment I don't have any scanners attached.
> I use Mandrake's rpm, which also has the viceo backend, plustek 0.45,
> primaxscan 1.1beta1, hp4200 0.3 and testtool 20021120_1 patched into it.
> Probably I should just run debugging on the backends mentioned on top, and
> report that, right?

Not necessary, at least for the USB backends.

> Would it be an idea to run a first scan, checking if there are usb or scsi
> devices, and if there's for example no usb device, that backends will not scan
> for an usb scanner, only for scsi or parport. This might speed up scanning in
> a more general way.

How do you detect if there is no USB scanner? You have to check all
the device files to do that and that's already done. We could buffer
the results so if the same backend asks again, there would be no new
test. However, USB is about hotplugging, so the next time we ask for
devices, the scanner could be already removed or a new one connected.
--> doesn't work.

> Or maybe running sane-find-scanner first. If that doesn't find a scanner, then
> there's no use scanning with the backends. Or am I wrong on that one?

sane-find-scanner does the same thing as the backends. It just does it
only once because it asks a different question: show me all devices
and their ids. The backends want to now the device file(s) for one or
more specific ids. As there is no way to ask the OS for this
information, you have to check all device files.

This is not a bug in SANE. It's also not a new issue. It only is more
visible as more and more backends support more USB scanners.