SCM

[#314974] Adds the "--sensor-trap" and "-s" options to scanimage

View Trackers | Bugs | Export CSV

Date:
2015-02-14 14:42
Priority:
3
State:
Open
Submitted by:
Andy Bennett (andyjpb-guest)
Assigned to:
Nobody (None)
Category:
scanimage
Group:
None
Resolution:
None
Summary:
Adds the "--sensor-trap" and "-s" options to scanimage

Detailed description
Please find a patch to scanimage.c attached.

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

This is useful for driving scanning workflows from a single, user supplied script rather than having to deal with the priviledge separation and asynchronous nature of multiple events dispatched via something like scanbd.

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.


Here are some sample snippets that demonstrate how to use this from a shell script:

-----
wait_for_hopper() {
log "Waiting for hopper to be loaded..."
eval scanimage -n --sensor-trap=page-loaded
if [ $? != 0 ]; then
log "Scanner not found!"
exit 1
fi
}

do_scan() {
log "Preparing to scanning document to $PWD."
eval scanimage $ALL_OPTS --sensor-trap=scan
}


wait_for_hopper

while true; do
do_scan
wait_for_hopper
done
-----

Followups: Sort comments antichronologically

Message
Date: 2015-02-14 14:44
Sender: Andy Bennett

The patch

Attached Files:

Attachments:
Size Name Date By Download
5 KiBsensor-trap-2014-12-28-01.patch2015-02-14 14:44andyjpb-guestsensor-trap-2014-12-28-01.patch

Changes:

Field Old Value Date By
File Added6743: sensor-trap-2014-12-28-01.patch2015-02-14 14:44andyjpb-guest
Powered By FusionForge