[sane-devel] SANE2 standard revisited: Code flow

Henning Meier-Geinitz henning at meier-geinitz.de
Tue Dec 10 00:30:55 GMT 2002


Hi,

On Mon, Dec 09, 2002 at 11:36:22PM +0100, Oliver Rauch wrote:
> > "... However, as options are set, other options may become active or
> >  inactive or their constraint may change. Thus, after setting
> >  an option, it may be necessary to re-read the descriptors."
> >
> > | Image data is collected by repeatedly calling sane_read() until this
> > | function will return an end-of-file status (SANE_STATUS_EOF). This
> > | indicates the end of the current frame.
> >
> > Is this change of wording intended? The old standard says:
> > | Image data is collected by repeatedly calling sane_read(). Eventually,
> > | this function will return an end-of-file status (SANE_STATUS_EOF).
> > | This indicates the end of the current frame.
> >
> > I'm not sure but the new versions sound like you must call sane_read()
> > until EOF while the old version seems to allow to use the select_fd to
> > detect EOF. So with the new version we need to call sane_read to get
> > the EOF even if we already know of EOF from the select_fd. Does this
> > make sense?
> >
> > The example pseudo code is nice. I would pipe it through indent -gnu
> > or at least use a sonsitant coding style but that's just cosmetics :-)
> 
> but this would make the sane_cancel unnecessaryly complex
> because you have to call
> 
> 	sane_cancel
> 	while (sane_read != SANE_STATUS_EOF);
> 
> and wait until sane_read really reutrnes SANE_STATUS_EOF.
> 
> I suggest to keep this like it is: no need to call sane_read when
> sane_cancel is called!

Now I understan your intention.

I wasn't talking about sane_cancel at all. You are right, that
sane_cancel means that the scan is canceled immediately after
sane_cale has finished or, if sane_read is currently running, after
that call is finished.

I thought that this was clear from the description of sane_cancel but
we can add an explanation in code flow, too. E.g. "If the scan was
cancelled by calling sane_cancel() no further calls to sane_read() are
allowed.".

I was talking about the select_fd. (I want to get rid of it anyway,
but just in case we keep it.) With your current description, it's
necessary to call sane_read to get the final SANE_STATUS_EOF even if
we use the select_fd which flag this status. This voids one of the
reasons to use select_fd.

Bye, 
  Henning
  









More information about the sane-devel mailing list