[sane-devel] SANE2 standard completion

René Rebe rene at exactcode.de
Wed Apr 9 10:48:22 UTC 2008


stef wrote:
> 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.

As the backend controls the device and reads the image data somehow,
it should have knowledge about the actual head position and should be
able to perform the required actions even with the current interface.

Where exactly should there be the problem?


   René Rebe - ExactCODE GmbH - Europe, Germany, Berlin
   http://exactcode.de | http://t2-project.org | http://rene.rebe.name

More information about the sane-devel mailing list