[sane-devel] multipage scans (was: Re: --batch-prompt with Fujitsu backend and iX500)

Andy Bennett andyjpb at ashurst.eu.org
Mon Dec 14 09:21:34 UTC 2015

Hi Carl,

> I am hoping there is support for the button.

I wrote the attached patch (explanation below) to support the button for
my ScanSnap iX500 with scanimage.

Please let me know if you are able to try it out and whether it works
for you.

-------- Forwarded Message --------
Subject: Re: [sane-devel] --batch-prompt with Fujitsu backend and iX500
Date: Sun, 28 Dec 2014 20:41:30 +0000
From: Andy Bennett <andyjpb at ashurst.eu.org>
To: sane-devel at lists.alioth.debian.org


> Is there a way for "scanimage --batch-prompt ..." to poll the button on
> the front of the scanner instead of waiting for RETURN?
> In gscan2pdf I can see the button sensor activate when I press the
> button (and refresh the scanner list with the button held down) but I
> can't see it in xsane or with "scanimage -A".
> I'm happy to start the program manually (rather than using scanbd or
> scanbuttond) but it'd be nice if I can then just load the hopper and
> press the button on the scanner for each batch.
> Maybe it would be better to have a scanimage option which just blocks
> until the button (chosen with command line flags?) is pressed

Please find a patch to scanimage.c attached.

This patch adds the "--sensor-trap" and "-s" options.

With no arguments this option prints the status of all the sensors as
per the "-A" option. When the name of the sensor is given as the option
argument it waits for that sensor to change state before proceeding as
normal. i.e. it scans with the supplied options unless "-n" is present,
in which case it exits with success.

I have tested this on the Fujitsu ScanSnap iX500.

With the "--sensor-trap=scan" option it waits until the button up event
on the front panel button before proceeding (provided the button is not
held down when scanimage is run).

With the "--sensor-trap=page-loaded" option it waits for a piece of
paper to be placed in the hopper before immediately scanning it.
Interestingly, if the hopper contains a piece of paper when scanimage is
invoked then it  immediately scans it otherwise it waits until the page
is inserted and then scans it. I'm not sure if this will be the case for
all scanners.

There are a couple of issues that might require further attention:

I'm not sure if the signal handler initialisation is in the correct
place: If I Ctrl-C the binary whilst it is waiting for the state change
then it can't stop the scanner on the first try and aborts on the second.

I'm not sure if the indenting or function signature styles are correct.


andyjpb at ashurst.eu.org


andyjpb at ashurst.eu.org
0290 DA75 E982 7D99 A51F  E46A 387A 7695 7EBA 75FF

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sensor-trap-2014-12-28-01.patch
Type: text/x-patch
Size: 4903 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20151214/fd6f6b51/attachment-0001.bin>

More information about the sane-devel mailing list