[sane-devel] PATCH: Call script per output file from scanimage in batch mode

Simon Matter simon.matter at invoca.ch
Tue Aug 24 08:42:27 UTC 2010


> On Mon, Aug 23, 2010 at 11:20 AM, Simon Matter <simon.matter at invoca.ch>
> wrote:
>> Hi Allan,
>>
>>> Simon, this is a great idea, and is also one of the last things
>>> missing for users to switch from the (now deprecated) scanadf to
>>> scanimage.
>>>
>>> Is there any chance you could find the time to make your patch
>>> compatible with the scanadf -S option? Specifically setting the
>>> various SCAN_* environment vars? You could add your page number as
>>> SCAN_PAGE or some such. You would need to check if scanadf cares about
>>> the return value for the script.
>>
>> I was afraid this question might come up and I was already looking at
>> scanadf because I knew it does something like that. Due to my complete
>> lack of experience and knowledge in programming C I found it quite
>> difficult to implement the same behaviour which is why I decided to do
>> it
>> in a much simpler way.
>
> No problem. If I find some time in the next week or two, I'll do it
> (though volunteers are welcome :)
>
>> Scanadf has the ability to call scripts in background and wait or not
>> wait
>> for them to finish before exiting. That's so simple to implement in the
>> scripts so I see no reason to hardwire it in scanimage.
>
> Agreed.
>
>> From what I understand scanadf does not check the return value of
>> scripts
>> but I decided to do it because it gives you more control.
>
> I guess it does let you call sane_cancel. Probably useful enough to
> break backwards compat for it.

That's what my version does. Every script exit status > 0 makes scanimage
cancel the current job.

>
>> The biggest problem are the various SCAN_* environment vars. I have just
>> no idea how this could be implemented without changing much code. Since
>> all values needed there are only local to scan_it() they are not
>> available
>> in main() for exporting them. If I understand this correctly then the
>> device var is a global static var used everywhere and if the same could
>> be
>> done with parm from scan_it() then it would be usable in main() as well.
>> But then I'm afraid that's considered bad style :(
>
> Well, globals are generally frowned upon, but some of that is just
> people parroting what they have heard :) Another option is to declare
> a param struct outside of scan_it(), and pass the struct ref as an
> argument.

While we are at it, the batch-start option lies in the manpage.

Regards,
Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sane-backends-1.0.21-manpage-batch-start.patch
Type: text/x-patch
Size: 460 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20100824/65357708/attachment-0001.bin>


More information about the sane-devel mailing list