[sane-devel] devfs and scanner detection
Henning Meier-Geinitz
henning at meier-geinitz.de
Fri Aug 22 16:55:29 BST 2003
Hi,
On Thu, Aug 21, 2003 at 10:35:54PM +0800, Mr E_T wrote:
> No at the moment you are loading the backends and having them do the detection.
Yes. But the "loading" can be done in different ways...
> If you load the backends and have a function get the device ids and type -
> eg Mustek 1200 ub plus (or numeric equivilent of)
>
> then invoke the device files to check the "id" against the id list
>
> after which you can unload unneeded backends.
It's much more complicated than that. That's what I called
"flexibility":
SANE backends can be:
- linked statically to the frontend (one backend per frontend)
- linked as a shared library to the frontend (one backend per frontend)
- linked statically ("preloaded") to a meta backend called "dll
backend" (multiple backends "inside" the meta backend)
- dynamically loaded by the meta backend
The last one is the default. If dynamic loading is not abvailable or
not wanted by the user, SANE falls back to the other methods.
So you can't just put some clever code into dll.c because that backend
may not even be used.
The only way I see is to use a daemon that can be asked by all the USB
backends. But that's too complicated and has other issues (e.g. when
should the daemon scan for new devices)?
> this would only check each device once.
>
> It would involve moving the detection routine and creating a "plugin register
> function"
>
> I have just been scanning the backend and sanei sources to come to this
> conclusion.
>
> I beleive that most of the peices are in place - but a reordering is needed.
I think it doesn't work that way. It's a proinciple limitation of the
SANE architecture.
In my opinion the real problem is the slowlyness of the stat/open
calls in Linux when devfs is active. Even with less calls to open the
device files it's still slow.
Bye,
Henning
More information about the sane-devel
mailing list