[sane-devel] sane_get_devices and sanei_usb_init

Olaf Meeuwissen olaf.meeuwissen at avasys.jp
Mon Dec 1 23:14:13 UTC 2008

"m. allan noah" <kitno455 at gmail.com> writes:

> On Mon, Dec 1, 2008 at 12:10 AM, ABC <abc at telekom.ru> wrote:
>>> http://www.sane-project.org/html/doc012.html
>>> 4.3.3 sane_get_devices
>>> ...
>>> This function can be called repeatedly to detect when new devices
>>> become available.
>> Nice writing but it is not possible with usb now, because sanei usb
>> infrastructure get list of devices only when sanei_usb_init() is called.
>> And it is not possible to call sanei_usb_init() more than once without
>> breaking already opened devices.
> how do they break?

sanei_usb_open() returns an index into the devices array.  That index
is passed to the sanei_usb I/O functions and sanei_usb_close() to find
which one of the devices you want to use.
Problem is that sanei_usb_init() memset()s the devices array.

Hope this helps,
Olaf Meeuwissen, LPIC-2           FLOSS Engineer -- AVASYS Corporation
FSF Associate Member #1962               Help support software freedom

More information about the sane-devel mailing list