<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Hi,<br>
    <br>
    <div class="moz-cite-prefix">On 2022-08-02 12:46, Guy B wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAB-P8TZeF1qNgAjVNpn=YRMsYJsA__6V+CPM7Fi9dsTVjCb8bQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">I'm trying to determine if this setup can actually
        be made to function (and Googling has given no obvious answer).<br>
        <br>
        Server A - connected to scanner via USB, exposed via network
        <div>      ↓<br>
          Server B - connected to A via the "net" interface, re-exposes
          scanner to another net via "net" interface<br>
               ↓<br>
          Server C - connects to B via "net"<br>
          <br>
          The reason that I'm trying to do this is because "A" in this
          use case is actually a VM running an ancient version of Ubuntu
          because that's the only place I can make the binary-only
          drivers work (and I don't want a 10+ year old version of
          Ubuntu exposed to <i>any</i> network). "B" is then a real
          machine that I want to use to expose it to the rest of the
          network.<br>
          <br>
          While I've had no trouble plumbing things through to "B", I
          can't figure out how (or if it is possible) to re-share the
          network scanner again.</div>
        <div><br>
        </div>
        <div>-Guy</div>
      </div>
    </blockquote>
    <br>
    So to summarise:<br>
        - Server A (VM) will be running the binary driver and saned,<br>
        - Server B will be running SANE with the "net" backend
    (configured to connect to Server A's saned) and also saned,<br>
        - Server C will be running SANE with the "net" backend
    (configured to connect to Server B's saned).<br>
    <br>
    Although this sounds reasonable, the only issue that I can see with
    this setup is that saned running on Server B will not pick up the
    devices through the "net" backend.<br>
    The reason for this is that saned is intended to advertise local
    devices only and when asking the "net" backend for local devices, it
    will simply return with an empty list.<br>
    Partly the reason for this is to stop deadly embrace loops where the
    "net" backend and saned could conceivably keep re-advertising each
    other's devices in an endless loop.<br>
    <br>
    Without changing code, I don't see an obvious way around this
    restriction. However, there are two ways you could get around this
    in your circumstance if you are willing do some minor code changes
    and rebuild.<br>
    <br>
    Do one of:<br>
    <br>
    A. Rebuild saned with a small change to the code here around line
    1851 of saned.c:<br>
    <br>
          sane_get_devices ((const SANE_Device ***)
    &reply.device_list,<br>
                    SANE_TRUE);<br>
    <br>
    to <br>
    <br>
          sane_get_devices ((const SANE_Device ***)
    &reply.device_list,<br>
                    SANE_FALSE);<br>
    <br>
    This removes the restriction on local-only devices.<br>
    <br>
    or:<br>
    <br>
    B. Rebuild the net backend with a small change to the code around
    line 1223 of net.c:<br>
    <br>
      if (local_only)<br>
        {<br>
          *device_list = empty_devlist;<br>
          return SANE_STATUS_GOOD;<br>
        }<br>
    <br>
    ...by removing this code entirely.<br>
    <br>
    If you are willing to give this a try, I would say that changing the
    net backend and using that is probably the easiest solution.<br>
    To give it a go, I would clone the backends repo, make the change,
    build it, take the built net backend files (libsane-net.*) and
    temporarily replace your regular ones on Server B with the built
    ones so that Server B's saned will see them.<br>
    Probably not a good permanent solution but a place to start at
    least.<br>
    <br>
    Actually, since we have had this question come up a couple of times
    in the past, it might be an optional feature that we could add,
    switched off by default, to the core code.<br>
    <br>
    Anyway, let us know if you need help giving that a try.<br>
    <br>
    Cheers,<br>
    Ralph<br>
  </body>
</html>