[sane-devel] 'scanimage -L' fails first time with modular SCSI drivers

Major A andras@users.sourceforge.net
Tue, 19 Feb 2002 17:51:08 +0000


> On Linux, when the SCSI drivers are compiled modular, 'scanimage -L'
> fails unless they modules are loaded.
> 
> After running it once (and it fails), the drivers appear to have been
> automatically loaded (by an open("/dev/sg0") I think), and so a
> subsequent 'scanimage -L' works.
> 
> [root@cyberelk root]# scanimage -L
> 
> No scanners were identified. If you were expecting something
> different,
> check that the scanner is plugged in, turned on and detected by the
> sane-find-scanner tool (if appropriate). Please read the documentation
> which came with this software (README, FAQ, manpages).
> [root@cyberelk root]# scanimage -L
> device `hp:/dev/sg0' is a Hewlett-Packard C5110A flatbed scanner
> 
> Curiously enough, if I create a link /dev/scanner -> sg0, I don't see
> this behaviour and the first 'scanimage -L' succeeds.
> 
> I'm trying this with SANE 1.0.7.

This sounds much like expected behaviour. I have no exact insight into
either the way SANE SCSI handling works nor how the backend you use
performs its probing, but my assumptions are as follows:

- your backend uses the sanei_scsi functions to probe for devices when
  you do scanimage -L. Unless there is a link /dev/scanner, it will
  take its list of scanners from the /proc filesystem, and your
  scanner is not there unless the relevant modules have been loaded;

- some other backend, which is loaded after your backend, probes
  /dev/sg0 and thus makes the kernel load the relevant modules, this
  is why it works the second time.

To test the second one, try disabling all but your backend in
dll.conf, this will (hopefully) cause scanimage -L to fail however
often you try.

Just my twopence, I may well be wrong.

  Andras

===========================================================================
Major Andras
    e-mail: andras@users.sourceforge.net
    www:    http://andras.webhop.org/
===========================================================================