[sane-devel] How to select a device?

Henning Meier-Geinitz henning at meier-geinitz.de
Thu Aug 18 15:34:13 UTC 2005


Hi,

On Thu, Aug 18, 2005 at 05:26:17PM +0000, kenwhale wrote:
> Hi,all. I am new to SANE but I wrote some TWAIN programs before. In 
> twain when multi device are connected, we can chose one we wanna do the 
> scan operation.

The same is true for SANE. You call sane_get_devices, check the list
of available devices and open the device you are intersted in.

> I read SANE's Document,found: there are three ways which
> frontend attaching to backend,

To be exact, there are more than three:

- static linkage with a single backend
- static linkage of the dll backend with multiple backends statically
  preloaded
- dynamic linkage with a single backend
- dynamic linkage with the dll backend with multiple backends
  statically preloaded to the dll backend
- dynamic linkage to the dll backend whick dlopens all available
  backends on runtime (this is the default)

> one of them is Dynamic linking.So how can I dynamic link to a
> backend??

Well, you just link a frontend to a shared library backend. The good
thing about this is that you can just exchange the backend and use the
same frontend without relinking.

Nicer (and the default) is the case where the dll backend is linked as
a shared library to the frontend and the dll backend loads backends
with dlopen (on demand). This way you just have to add your backend
library to /usr/lib/sane (or whereever it's found) and add the name of
your backend to dll.conf.

Bye,
  Henning



More information about the sane-devel mailing list