[sane-devel] SANE2 standard completion

stef stef.dev at free.fr
Wed Apr 9 04:36:11 UTC 2008


Le Sunday 06 April 2008 21:16:44 m. allan noah, vous avez écrit :
> On 3/28/08, Rene Rebe <rene at exactcode.de> wrote:
> > > >       But before starting, there are some things I'd like to see in
> > > > the
> >
> > new standard:
> > > >       - the current code flow is
> > > >       sane_init
> > > >               sane_open
> > > >                       sane_start
> > > >                               sane_read
> > > >                       sane_cancel
> > > >               sane_close
> > > >       sane_exit
> > > >
> > > >               rather than calling sane_cancel at the end of scan, I'd
> >
> > like to have a sane_end function. Leaving the use of sane_cancel for
> > canceling the scan like it allready does. This new function would do
> > about
> >
> > the same, but code flow would be cleaner and easier to understand:
> > > >       sane_init
> > > >               sane_open
> > > >                       sane_start
> > > >                               sane_read
> > > >                       sane_end
> > > >               sane_close
> > > >       sane_exit
> > >
> > > this is a simple, single scan case. can you draw up what you think an
> > > ADF or duplex scan would look like? right now, it does sane_start,
> > > sane_read, sane_start, sane_read, sane_start, sane_read,
> >
> >  I do not see a problem in this call graph. Sure, we could leave the
> >  cancel (or rename it to _end :-), however existing codebase like
> >  frontends (applications) have deal with the current API and
> >  backends (drivers) anyway. This is what I mean when I declare
> >  unnecessary work. The gain is just a little nicer callgraph on
> >  the paper.
>
> actually, i have some code in my private version of fujitsu backend
> now, to try and make sane_cancel work properly. and i can say that
> stef is right that separating the 'cancel' from 'dont want more
> images' would be very nice for ADF programming. without it, i have to
> replicate some measure of the 'EOF' sending code into the cancelling
> code, so that it can tell if it needs to actually stop the scanner, or
> just not start again.
>
	Another case where having a different function for regular end of scan and 
error path is for the lexmark backend. The X11xx/X12xx devices don't have a 
sensor to detect home position. Parking position must be find by scanning a 
white area with a black dot in it.
	Currently, when sane_cancel is called, the backend doesn't know if scan is 
finished regularly or aborted, so it parks head slowly, scanning to find the 
dot because it don't 'know' where the scanning head is. If there were a 
difference between 'abort' and 'scans are finished', in case of normal end, 
the backend could just go back by the amount of scanned lines, going back 
faster.

> gentlement (and ladies if there are any), i am in favor of starting a
> new sane2 draft, with soversion bump.
>
> allan
>
> --
> "The truth is an offense, but not a sin"s,
	
Regards,
	Stef





More information about the sane-devel mailing list