[sane-devel] attach function status?
Thu, 2 May 2002 11:38:19 +0200
On Wed, May 01, 2002 at 02:54:59PM -0700, Dave Close wrote:
> If not status, then it seems to me that it would be useful if
> sanei_config_attach_matching_devices() could return a count of the
> number of devices found. sane_init() could then total the results and
> complain when that was appropriate.
Can't you already do this in the backend's attach function? Or to be
more exact, most backends alredy generate a list of devices for
sane_get_devices(). So you could check how many devices are listed
there and print the an appropriate warning message (if the debug level
is > 0).
Counting in sanei_config_attach_matching_devices() doesn't make much
sense in my opinion because it's often called more than once per
backend and the attach function checks if the scanner is already found.
E.g. a config file like this:
would result in sanei_config_attach_matching_devices() to be called
four times and everytime it will find one scanner (on my system). But
in total it's not four but one scanner, because they are all the same.
If you really want to return something different from SANE_STATUS_GOOD
in sane_init, have a look at dll.c to see what happens: The backend is
just ignored and no error is printed. So this won't help.
And you can't return an error code in dll.c if one backend returns an
error code because you don't know if the user is interested at all in