[sane-devel] sane_get_devices() is very slow

Derry Bryson dbryson@techass.com
Thu, 13 Feb 2003 00:54:39 -0800


I am writing a set of classes for the wxWindows GUI library to allow
cross-platform image acquistion.  I am currently using TWAIN on Windows 
and Mac and SANE (of course) on Linux/Unix.  SANE might also be viable
on MacOS X as well.

I notice that calling sane_get_devices() is very slow when using the sane dll
backend.  It takes 36 seconds on my test machine.  This seems way to long just
to generate a list of scanners to select from.  I haven't looked at it 
closely, but I would suspect the problem is that each backend is checking
for a scanner when loaded by the dll backend.  

The TWAIN DSM does basically the same thing, only they specify that the DS 
(similar to a SANE backend) load and respond as quickly as possible not checking
to see if the hardware is present. 

Hopefully I am doing things wrong and someone can point out how I should
be querying for available devices.  If not, I might propose that SANE be 
modified such that sane_init() should basically do nothing other than check 
for basic kernel support (or whatever) and return success and the actual 
device detection be moved to sane_open() such that sane_get_devices() would
return almost instantaneously with list of devices supported even if they
are not connected.  I realize there is a basic difference here in that 
TWAIN DS's usually only support a single device and SANE backends might
support a family of devices, but I think it might be better to immediately 
present the user with a list of devices and let them choose their scanner
even if it means giving them an error message for non-existant devices.

Regards,

Derry Bryson