[sane-devel] scsi works only when debugged epson

Henning Meier-Geinitz henning@meier-geinitz.de
Sun, 28 Mar 2004 18:26:33 +0200


On Fri, Mar 26, 2004 at 02:26:45PM +0100, Klaus Dittrich wrote:
> SCSI storage controller: LSI Logic / Symbios Logic 53c875 (rev 04)
> (Works well with SANE-Backends-1.0.12, cdrecord, DAT-Tape, disks)
> The scanner has two interfaces SCSI(attached) and USB(unplugged).
> sane-find-scanner -q
> found SCSI processor "EPSON Perfection1640 1.06" at /dev/sg2
> found USB scanner (vendor=0x067b, product=0x2303) at libusb:003:003
> Bug : Scanner found on unused interface too.

No. That's not your scanner but your "Prolific Technology, Inc. PL2303
Serial Port". At least if I read the ids correctly. This misdetection
is not a bug, it's the result of a bug in the USB spec. There is no
class for scanners so we have to use some tricks to only show scanners
in the output of sane-find-scanner. This heuristics doesn't work
sometimes so some devices are misdetected. But that's better than
not detecting some scanners.

> Wish: Device independent reporting format,
> 	  would make writing scanner scripts simpler.

> e.g.
> Found Scanner "EPSON Perfection1640 1.06" (vendor=0x067b, product=0x2303) \
> SCSI epson:/dev/sg2 
> Found Scanner "EPSON Perfection1640 1.06" (vendor=0x067b, product=0x2303) \
> USB  epson:libusb:003:003

That's not possible. sane-find-scanner just reports what the device
tells the operating ystem. In case of SCSI, the device reports the
manufacturer and product name.These are the ids that are used to
identify a SCSI device.

For USB, there are the unique vendor and product ids (numbers).
Sometimes there are also names for the vendor and product but that's
not always the case.

Also you mix the output of sane-find-scanner and scanimage -L here.
sane-find-scanner knows nothing about backends so it can't print
"epson:libusb:..." as it doesn't know anything about the eposn backend.

> 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).
> but
> scanimage -d epson:/dev/sg2 --test works, the scanner does something.

Maybe the SCSI modules are not loaded before trying to run "scanimage
-L"? "scanimage -L" looks in /proc/scs/scsi for the scanner and if the
SCSI modules are not loaded, it can't find the scanner. If you
explicitely state the device name, the backend just opens it so the
test in /proc/scsi/scsi isnT done. See bug #300165:


> scanimage -d epson:/dev/sg2 --resolution 100 
> returns	scanimage: sane_start: Error during device I/O

No idea about that one.

> but after a export SANEI_DEBUG_SANEI_SCSI=128
> scanimage -d epson:/dev/sg2 --resolution 100 
> P4
> # SANE data follows
> 848 1169
> ... 
> works, puts out data.

Usually this means that there is a timing problem inside SANE or the
kernel SCSI driver (or the hardware). Enabling debugging slows down
the code. There may be other reasons but I'm not an expert for that

> scanimage -L
> device `epson:/dev/sg2' is a Epson Perfection1640 flatbed scanner
> now works too.

I guess it would also work without debugging after you called
scanimage with the device name once.