[sane-devel] Cascading saned servers

Olaf Meeuwissen olaf.meeuwissen at avasys.jp
Wed Jul 16 23:06:55 UTC 2014

Jens-U. Mozdzen writes:

> Hi *, just a minor follow-up:
> Zitat von "Jens-U. Mozdzen" <jmozdzen at nde.ag>:
>> Hi *,
>> I'm attempting to use cascading saned servers, in other words: I'm  
>> trying to share a scanner that is reachable from the "saned" system  
>> via its network back-end.
>> Technically, this works. Unfortunately, either saned or the clients  
>> are not prepared for this, as the network scanners are not not  
>> listed via "xsane" nor "scanimage -L".
>> [...]
> saned's source code reveals that it is intended behaviour on saned's side:
> --- cut here ---
>    switch (current_request)
>      {
>        {
>          SANE_Get_Devices_Reply reply;
>          reply.status =
>            sane_get_devices ((const SANE_Device ***) &reply.device_list,
>                              SANE_TRUE);
>          sanei_w_reply (w, (WireCodecFunc) sanei_w_get_devices_reply, &reply);
>        }
>        break;
> --- cut here ---
> the "SANE_TRUE" value for the second parameter of "sane_get_devices()"  
> means "return only local devices" and is handed to net.c's  
> implementation, which then simply returns an empty list.
> Would a patch to make this configurable (via command line option of  
> saned) be acceptable? I'd implement a "-r" option, with a semantic of  
> "re-export network-accessed scanner devices" and prepare a patch.

Just make sure you prevent infinite recursion.  If A re-exports B and B
re-exports A, that sane_get_devices() request is going to chase its own
tail and won't ever return.

You have a star topology, IIRC, where this won't happen but if there is
one loop somewhere in the saned servers setup you're in trouble.

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