<div dir="ltr"><div>I would recommend referencing said document in the relevant API documents. Something along the lines of "Bytes in each sample value are transmitted in the machine's native byte order per the 'SANE Environment' document." That way if someone skips that document initially, they'll go back to it.</div><div><br></div><div><br></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Sat, Jun 7, 2025 at 2:54 PM Ralph Little <<a href="mailto:skelband@gmail.com">skelband@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Hi,</div><div>So I was looking through the SANE API specification and there *is* some guidance on byte order. It is just separated from the function definitions.</div><div>In the section "The SANE Environment": <a href="https://sane-project.gitlab.io/standard/environment.html#sec-imageformat" target="_blank">https://sane-project.gitlab.io/standard/environment.html#sec-imageformat</a></div><div><br></div><div>"In the latter case, the bytes of each
sample value are transmitted in the machine’s native byte order."</div><div><br></div><div>So I guess that settles that.</div><div><br></div><div>Cheers,</div><div>Ralph</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 4, 2025 at 9:28 AM Ralph Little <<a href="mailto:skelband@gmail.com" target="_blank">skelband@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div>Thanks, I will check that out.</div><br><div>Cheers,</div><div>Ralph</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 4, 2025 at 9:25 AM m. allan noah <<a href="mailto:kitno455@gmail.com" target="_blank">kitno455@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>A quote from fujitsu.c that seems relevant:</div><div><br></div><div>*<br> * @@ Section 5 - SANE cleanup functions<br> */<br>/*<br> * Cancels a scan. <br> *<br> * It has been said on the mailing list that sane_cancel is a bit of a<br> * misnomer because it is routinely called to signal the end of a<br> * batch - quoting David Mosberger-Tang:<br> * <br> * > In other words, the idea is to have sane_start() be called, and<br> * > collect as many images as the frontend wants (which could in turn<br> * > consist of multiple frames each as indicated by frame-type) and<br> * > when the frontend is done, it should call sane_cancel(). <br> * > Sometimes it's better to think of sane_cancel() as "sane_stop()"<br> * > but that name would have had some misleading connotations as<br> * > well, that's why we stuck with "cancel".<br> * <br> * The current consensus regarding duplex and ADF scans seems to be<br> * the following call sequence: sane_start; sane_read (repeat until<br> * EOF); sane_start; sane_read... and then call sane_cancel if the<br> * batch is at an end. I.e. do not call sane_cancel during the run but<br> * as soon as you get a SANE_STATUS_NO_DOCS.<br> * <br> * From the SANE spec:<br> * This function is used to immediately or as quickly as possible<br> * cancel the currently pending operation of the device represented by<br> * handle h. This function can be called at any time (as long as<br> * handle h is a valid handle) but usually affects long-running<br> * operations only (such as image is acquisition). It is safe to call<br> * this function asynchronously (e.g., from within a signal handler).<br> * It is important to note that completion of this operaton does not<br> * imply that the currently pending operation has been cancelled. It<br> * only guarantees that cancellation has been initiated. Cancellation<br> * completes only when the cancelled call returns (typically with a<br> * status value of SANE_STATUS_CANCELLED). Since the SANE API does<br> * not require any other operations to be re-entrant, this implies<br> * that a frontend must not call any other operation until the<br> * cancelled operation has returned.<br> */<br><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 4, 2025 at 12:06 PM Ralph Little <<a href="mailto:skelband@gmail.com" target="_blank">skelband@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div>BTW, just on that note, something that has bothered me is that the SANE API specification doesn't make the ADF multi-page scanning process super clear in terms of result codes, sequence etc. I will perhaps also review that section to see if additional detail could be added to make it more concrete.</div><div><br></div><div>Any changes I propose, I will offer them up here for review before updating the document.</div><div><br></div><div>Cheers,</div><div>Ralph</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 4, 2025 at 9:02 AM Ralph Little <<a href="mailto:skelband@gmail.com" target="_blank">skelband@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Hi,</div><div>OK, I will draft something up for the standard.</div><div><br></div><div>If there is anything else to update the standard with, perhaps people could let me know.</div><div>Just to be clear, I am not changing the interface with this update, just adding come clarification, so if anybody feels that there is anything else unclear in the standard, they should possibly raise it now. </div><div><br></div><div>I will add address this on the weekend.</div><div><br></div><div>Cheers,</div><div>Ralph</div><div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 4, 2025 at 8:57 AM m. allan noah <<a href="mailto:kitno455@gmail.com" target="_blank">kitno455@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Makes sense to me.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 4, 2025 at 10:12 AM Ralph Little <<a href="mailto:skelband@gmail.com" target="_blank">skelband@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 3, 2025 at 11:36 PM <sane-devel@symme.link> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tue, Jun 03, 2025 at 10:00:45PM -0700, Ralph Little wrote:<br>
> On Tue, Jun 3, 2025 at 9:54 PM James Ring <<a href="mailto:sjr@jdns.org" target="_blank">sjr@jdns.org</a>> wrote:<br>
> > On Tue, Jun 3, 2025 at 9:46 PM Ralph Little <<a href="mailto:skelband@gmail.com" target="_blank">skelband@gmail.com</a>> wrote:<br>
> >> Someone has asked the question about byte order in multi-byte image data<br>
> >> that we might get from a SANE backend.<br>
<br>
Hi, it's me, I had the question.<br>
<br>
> >> It is not enough to assume the local machine byte order since we may get<br>
> >> data through the net backend from a remote machine with a different byte<br>
> >> order.<br>
<br>
The `net` backend explicitly swaps to local machine byte order:<br>
<a href="https://gitlab.com/sane-project/backends/-/blob/master/backend/net.c?ref_type=heads#L2356-2362" rel="noreferrer" target="_blank">https://gitlab.com/sane-project/backends/-/blob/master/backend/net.c?ref_type=heads#L2356-2362</a><br>
<br>
So, it does seem like the de facto standard is that backends produce<br>
data in local machine byte order.<br>
<br>
(The protocol documentation reinforces this as a standard:<br></blockquote><div><br></div><div>Agreed. Perhaps this is something we should add to the SANE API specification?</div><div>Allan, do you concur?</div><div><br></div><div>Cheers,</div><div>Ralph</div></div></div>
</div>
</blockquote></div><div><br clear="all"></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">"well, I stand up next to a mountain- and I chop it down with the edge of my hand"</div>
</blockquote></div></div>
</blockquote></div>
</blockquote></div><div><br clear="all"></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">"well, I stand up next to a mountain- and I chop it down with the edge of my hand"</div>
</blockquote></div>
</blockquote></div></div>
</blockquote></div><div><br clear="all"></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Kelly "STrRedWolf" Price<br><a href="http://redwolf.ws" target="_blank">http://redwolf.ws</a></div>