sane-project-website/old-archive/2001-01/0113.html

207 wiersze
7.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>sane-devel: Re: SANE standard / get_select_fd / sane_read</TITLE>
<META NAME="Author" CONTENT="Oliver Rauch (oliver.rauch@Wolfsburg.DE)">
<META NAME="Subject" CONTENT="Re: SANE standard / get_select_fd / sane_read">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Re: SANE standard / get_select_fd / sane_read</H1>
<!-- received="Wed Jan 10 08:55:11 2001" -->
<!-- isoreceived="20010110165511" -->
<!-- sent="Wed, 10 Jan 2001 18:16:39 +0100" -->
<!-- isosent="20010110171639" -->
<!-- name="Oliver Rauch" -->
<!-- email="oliver.rauch@Wolfsburg.DE" -->
<!-- subject="Re: SANE standard / get_select_fd / sane_read" -->
<!-- id="3A5C98F7.AFB25619@wolfsburg.de" -->
<!-- inreplyto="200101101018.LAA11256@siegel.math.uni-frankfurt.de" -->
<STRONG>From:</STRONG> Oliver Rauch (<A HREF="mailto:oliver.rauch@Wolfsburg.DE?Subject=Re:%20SANE%20standard%20/%20get_select_fd%20/%20sane_read&In-Reply-To=&lt;3A5C98F7.AFB25619@wolfsburg.de&gt;"><EM>oliver.rauch@Wolfsburg.DE</EM></A>)<BR>
<STRONG>Date:</STRONG> Wed Jan 10 2001 - 09:16:39 PST
<P>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0114.html">Ralf: "MICROTEK2 failure : out of memory with kernel 2.4"</A>
<UL>
<LI><STRONG>Previous message:</STRONG> <A HREF="0112.html">Douglas Gilbert: "Canon scanners and Linux kernel 2.4.0"</A>
<LI><STRONG>In reply to:</STRONG> <A HREF="0107.html">Christian Nassau: "SANE standard / get_select_fd / sane_read"</A>
<!-- nextthread="start" -->
<LI><STRONG>Next in thread:</STRONG> <A HREF="0114.html">Ralf: "MICROTEK2 failure : out of memory with kernel 2.4"</A>
<LI><STRONG>Reply:</STRONG> <A HREF="0114.html">Ralf: "MICROTEK2 failure : out of memory with kernel 2.4"</A>
<LI><STRONG>Reply:</STRONG> <A HREF="0146.html">Christian Nassau: "Re: SANE standard / get_select_fd / sane_read"</A>
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#113">[ date ]</A>
<A HREF="index.html#113">[ thread ]</A>
<A HREF="subject.html#113">[ subject ]</A>
<A HREF="author.html#113">[ author ]</A>
</UL>
<HR NOSHADE><P>
<!-- body="start" -->
<P>
Hi Christian,
<BR>
<P>Christian Nassau wrote:
<BR>
<EM>&gt;
</EM><BR>
<EM>&gt; To be more concrete: I wonder if we could make the following
</EM><BR>
<EM>&gt; setup legal:
</EM><BR>
<EM>&gt;
</EM><BR>
<EM>&gt; - the file descriptor handed over by the backend signals
</EM><BR>
<EM>&gt; readable if raw data from the scanner is available to
</EM><BR>
<EM>&gt; the backend, but
</EM><BR>
<EM>&gt;
</EM><BR>
<EM>&gt; - the backend does some postprocessing and would rather
</EM><BR>
<EM>&gt; keep some of the data until more data is available
</EM><BR>
<EM>&gt;
</EM><BR>
<EM>&gt; (take chroma correction, for example, where the backend
</EM><BR>
<EM>&gt; doesn't want to send some lines at the beginning
</EM><BR>
<EM>&gt; which have incomplete color components. The initial
</EM><BR>
<EM>&gt; call to sane_read() might just put some lines into an
</EM><BR>
<EM>&gt; internal buffer, which will be (partially) transferred
</EM><BR>
<EM>&gt; when sane_read() is called the next time)
</EM><BR>
<P>sane_read is a command that shall read image data from a buffer.
<BR>
sane_read should not be used to get the image data from the scanner,
<BR>
the backend should start a second process (reader_process) for
<BR>
reading the image data from the scanner and put it into a buffer.
<BR>
<P>Then you also can do postprocessing with the image data without
<BR>
that sane_read will see it.
<BR>
<P><EM>&gt;
</EM><BR>
<EM>&gt; Basically, this is a question about the specification of
</EM><BR>
<EM>&gt; sane_read(). There seem to be two competing ideas of what a
</EM><BR>
<EM>&gt; successful call to sane_read() is:
</EM><BR>
<EM>&gt;
</EM><BR>
<EM>&gt; - The last line on page 29, allows sane_read() to transfer
</EM><BR>
<EM>&gt; 0 bytes but still return SANE_STATUS_GOOD
</EM><BR>
Yes, this is allowed in non blocking mode.
<BR>
<P><EM>&gt;
</EM><BR>
<EM>&gt; - On page 30 (blocking I/O mode) sane_read() has to transfer
</EM><BR>
<EM>&gt; at least one byte if it wants to return SANE_STATUS_GOOD
</EM><BR>
<EM>&gt;
</EM><BR>
<EM>&gt; Wouldn't it be better to allow a backend to transfer 0 bytes,
</EM><BR>
<EM>&gt; as long as it considers this a success for some internal reasons?
</EM><BR>
<P>Blocking mode means that sane_read has to wait until there is at
<BR>
least one byte of image data!
<BR>
<P><EM>&gt;
</EM><BR>
<EM>&gt; Actually, I've got another question about sane_read():
</EM><BR>
<EM>&gt;
</EM><BR>
<EM>&gt; It might be convenient for a backend to internally store only
</EM><BR>
<EM>&gt; complete lines of image data (not fractions of a line). So:
</EM><BR>
<P>No. That is not allowed. The fronend may ask for any number
<BR>
of bytes.
<BR>
<P><EM>&gt;
</EM><BR>
<EM>&gt; - Does it have to be legal (for the frontend) to request
</EM><BR>
<EM>&gt; less than bytes_per_line bytes?
</EM><BR>
<P>Yes.
<BR>
<P>scanimage -T does test exactly that. The frontend may ask for any number
<BR>
of bytes it likes to do.
<BR>
<P><EM>&gt;
</EM><BR>
<EM>&gt; This could easily lead to a deadlock if the backend transfers
</EM><BR>
<EM>&gt; 0 bytes successfully in such a case. (Which it may do in
</EM><BR>
<EM>&gt; non-blocking mode.)
</EM><BR>
<P>Wrong.
<BR>
Non Blocking mode means that the backend may return with 0 bytes
<BR>
transfered (because it has no data in the moment and it returns
<BR>
to give the frontend the chance to react to user action, refresh display
<BR>
etc.)
<BR>
<P><PRE>
--
Homepage: <A HREF="http://www.wolfsburg.de/~rauch">http://www.wolfsburg.de/~rauch</A>
sane-umax: <A HREF="http://www.wolfsburg.de/~rauch/sane/sane-umax.html">http://www.wolfsburg.de/~rauch/sane/sane-umax.html</A>
xsane: <A HREF="http://www.wolfsburg.de/~rauch/sane/sane-xsane.html">http://www.wolfsburg.de/~rauch/sane/sane-xsane.html</A>
E-Mail: mailto:<A HREF="mailto:Oliver.Rauch@Wolfsburg.DE?Subject=Re:%20SANE%20standard%20/%20get_select_fd%20/%20sane_read&In-Reply-To=&lt;3A5C98F7.AFB25619@wolfsburg.de&gt;">Oliver.Rauch@Wolfsburg.DE</A>
<P>--
Source code, list archive, and docs: <A HREF="http://www.mostang.com/sane/">http://www.mostang.com/sane/</A>
To unsubscribe: echo unsubscribe sane-devel | mail <A HREF="mailto:majordomo@mostang.com?Subject=Re:%20SANE%20standard%20/%20get_select_fd%20/%20sane_read&In-Reply-To=&lt;3A5C98F7.AFB25619@wolfsburg.de&gt;">majordomo@mostang.com</A>
</PRE>
<P><!-- body="end" -->
<HR NOSHADE>
<UL>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0114.html">Ralf: "MICROTEK2 failure : out of memory with kernel 2.4"</A>
<LI><STRONG>Previous message:</STRONG> <A HREF="0112.html">Douglas Gilbert: "Canon scanners and Linux kernel 2.4.0"</A>
<LI><STRONG>In reply to:</STRONG> <A HREF="0107.html">Christian Nassau: "SANE standard / get_select_fd / sane_read"</A>
<!-- nextthread="start" -->
<LI><STRONG>Next in thread:</STRONG> <A HREF="0114.html">Ralf: "MICROTEK2 failure : out of memory with kernel 2.4"</A>
<LI><STRONG>Reply:</STRONG> <A HREF="0114.html">Ralf: "MICROTEK2 failure : out of memory with kernel 2.4"</A>
<LI><STRONG>Reply:</STRONG> <A HREF="0146.html">Christian Nassau: "Re: SANE standard / get_select_fd / sane_read"</A>
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#113">[ date ]</A>
<A HREF="index.html#113">[ thread ]</A>
<A HREF="subject.html#113">[ subject ]</A>
<A HREF="author.html#113">[ author ]</A>
</UL>
<!-- trailer="footer" -->
<HR NOSHADE>
<P>
<SMALL>
<EM>
This archive was generated by <A HREF="http://www.hypermail.org/">hypermail 2b29</A>
: <EM>Wed Jan 10 2001 - 08:57:28 PST</EM>
</EM>
</SMALL>
</BODY>
</HTML>