[sane-devel] sane-find-scanner vs. scanimage --list-devices?

Steven Lembark lembark@wrkhors.com
Sun, 11 Nov 2001 13:23:26 -0600


Did a strings on the scanner binary, found "SANE_DEFAULT_DEVICE".
Tried it:

    root@dizzy:bin # export 
SANE_DEFAULT_DEVICE='hp:/dev/scsi/host2/bus0/target1/lun0/generic'

    root@dizzy:bin # ./scanimage
    [sanei_debug] Setting debug level of dll to 255.
    [dll] sane_init: SANE dll backend version 1.0.4 from sane-backends-1.0.6
    [dll] add_backend: adding backend hp
    [dll] load: loading backend hp
    [dll] load: couldn't find /opt/sane/1.0.6/libsane-hp.so.1 (No such file
    or directory) scanimage: open of device
    hp:/dev/scsi/host2/bus0/target1/lun0/generic failed: Invalid argument
    [dll] sane_exit: exiting
    [dll] sane_exit: calling backend `hp's exit function
    [dll] op_unsupported: call to unsupported backend operation

    root@dizzy:bin # find /opt/sane/1.0.6/ -name '*hp*'
    /opt/sane/1.0.6/lib/sane/libsane-hp.so.1.0.6
    /opt/sane/1.0.6/lib/sane/libsane-hp.so.1
    /opt/sane/1.0.6/lib/sane/libsane-hp.so
    /opt/sane/1.0.6/lib/sane/libsane-hp.la
    /opt/sane/1.0.6/lib/sane/libsane-hp.a
    /opt/sane/1.0.6/etc/sane.d/hp.conf
    /opt/sane/1.0.6/man/man5/sane-hp.5
    /opt/sane/1.0.6/doc/sane-1.0.6/README.hp-ux

Q: How does sane process argv[0] to get the libdir?

The installation I ran through used:

    cd /scratch/sane-backends-1.0.6;
    ./configure --prefix=/opt/sane/1.06;
    make all install;


    cd /scratch/sane-frontends-1.0.6;
    ./configure --prefix=/opt/sane/1.0.6;
    make all install;

The frontends seemd to find the backends they needed during the
configure and compile, but something isn't mangling the paths
properly to get the lib's...

Mangling the lib's gets me quite a bit further:

root@dizzy:bin # export LD_LIBRARY_PATH='/opt/sane/1.0.6/lib/sane';

root@dizzy:bin # ./scanimage
[sanei_debug] Setting debug level of dll to 255.
[dll] sane_init: SANE dll backend version 1.0.4 from sane-backends-1.0.6
[dll] add_backend: adding backend hp
[dll] load: loading backend hp
[dll] load: dlopen()ing `/opt/sane/1.0.6/lib/sane/libsane-hp.so.1'
[dll] init: initializing backend `hp'
[sanei_debug] Setting debug level of hp to 17.
[hp] sane_init called
[hp] sane_init will finish with Success
[dll] init: backend `hp' is version 1.0.8
[hp] sane_open called
[hp] hp_read_config: hp backend v0.95 starts reading config file
[hp] hp_get_dev: New device /dev/scanner, connect-scsi, scsi-request=1
[hp] sanei_hp_device_new: /dev/scanner
[hp] scsi_inquire: sending INQUIRE
[hp] scsi_new: sending TEST_UNIT_READY
[hp] scsi_flush: writing 2 bytes:
[hp]  0x0000  1B 45                                            .E
[hp] scsi_flush: writing 7 bytes:
[hp]  0x0000  1B 2A 73 32 35 37 45                             .*s257E
[hp] scl_inq: read failed (Error during device I/O)
[hp] scl_errcheck: Can't read SCL error stack: Error during device I/O
[hp] sanei_hp_device_new: SCL reset failed
[hp] scsi_close: closing fd 3
[hp] hp_device_info_get: device /dev/scsi/host2/bus0/target1/lun0/generic 
not configured. Using default
[hp] hp_get_dev: New device /dev/scsi/host2/bus0/target1/lun0/generic, 
connect-scsi, scsi-request=1
[hp] sanei_hp_device_new: /dev/scsi/host2/bus0/target1/lun0/generic
[hp] scsi_inquire: sending INQUIRE
[hp] scsi_new: sending TEST_UNIT_READY
[hp] scsi_flush: writing 2 bytes:
[hp]  0x0000  1B 45                                            .E
[hp] scsi_flush: writing 7 bytes:
[hp]  0x0000  1B 2A 73 32 35 37 45                             .*s257E
[hp] scl_inq: read failed (Error during device I/O)
[hp] scl_errcheck: Can't read SCL error stack: Error during device I/O
[hp] sanei_hp_device_new: SCL reset failed
[hp] scsi_close: closing fd 3
scanimage: open of device hp:/dev/scsi/host2/bus0/target1/lun0/generic 
failed: Error during device I/O
[dll] sane_exit: exiting
[dll] sane_exit: calling backend `hp's exit function
[hp] sane_exit called
[hp] sane_exit will finish


Any suggestions on handling this?

Suggestion: Add a "--sane-libs" switch to sane-config that prints
out where scanimage expects the lib's to be.

thanx.

--
Steven Lembark                               2930 W. Palmer
Workhorse Computing                       Chicago, IL 60647
                                            +1 800 762 1582