[sane-devel] sane_init(), sane_get_devices() and SANE_Authorization_Callback()

Kåre Särs kare.sars at iki.fi
Wed May 26 08:28:01 UTC 2010


Hi,

I have a couple of somewhat related problems regarding  sane_get_devices(), 
sane_init() and SANE_Authorization_Callback().

1) sane_get_devices() does not update the available devices list without 
calling sane_init(). I asked about this some time ago and got the answer that 
it was a bug. With the version in (K)Ubuntu Lucid and the pashazz-sane PPA, I 
still have the problem that the scanner is not found if turned on after 
sane_init(). I use the epson2 and v4l backends. With epson2 I get a crash if 
the scanner is on the first time but is turned off before the second 
sane_get_devices().

Do you have any hints on where to start digging?

2) With  sane_get_devices() I can get the vendor, model, type and backend 
names for the available scanners. Is there a way to get the same information
about the currently opened device? I do not find an API for that.  Have I 
missed something? The problem is that I can specify a backend like "test" and 
sane_open() will open either "test:0" or "test:1", but I do not know which one 
and I do not get the vendor, model and type strings.

3) libksane can be used in multi threaded applications and at the moment I'm 
making sure that sane_exit() is only called when the last instance exits, as 
sane_exit() will invalidate the other running instances. Should I do the same 
for sane_init()?. So far it has not resulted in problems, but when I tried a 
workaround for the  sane_get_devices() problem I noticed that I got unwanted 
behavior.

4) Again in a multi threaded application there might be two scanners that 
require authentication. The resource string that is provided to 
SANE_Authorization_Callback() contains the backend name and a md5 hash, but it 
does not contain the same ":libusb:001:004" extra info type of sting that 
sane_get_devices() returns for the backend. 
How should I identify the different scanners with the same backend? Or is the 
authorization restricted to the backend with the same authentication for all 
the scanners with the same backend?

Thanks in advance, 
  Kåre



More information about the sane-devel mailing list