[sane-devel] sane_get_devices() questions

Kåre Särs kare.sars at iki.fi
Sun May 31 20:46:05 UTC 2009


Hi,

I have an unexpected behavior with sane_get_device(). In the standard (1.04) 
it states (4.3.3) "This function can be called repeatedly to detect when new 
devices become available". From that I expected that this sequence would work:

sane_init(version, 0);
sane_get_device(&device_list, SANE_TRUE);
...
sane_get_device(&device_list, SANE_TRUE);
...
sane_get_device(&device_list, SANE_TRUE);
sane_exit();

but the result is that, no mater if a scanner is added/removed, the list stays 
the same as the first one.

This following sequence does update the list, but is not really what I wanted:

sane_init(version, 0);
sane_get_device(&device_list, SANE_TRUE);
sane_exit();
...
sane_init(version, 0);
sane_get_device(&device_list, SANE_TRUE);
sane_exit();
...
sane_init(version, 0);
sane_get_device(&device_list, SANE_TRUE);
sane_exit();
 

The questions: 
1) Have I missed something or is this just the way it works? (If this is the 
way it "should" work, there could be a clarifying sentence about it in the 
standard.)

2) Is there a way to avoid calling sane_exit()?

Thanks in advance,
  Kåre 




More information about the sane-devel mailing list