4

I'm running a little script with the scanimage batch-command on a remote server and would like to know if and how the scan has been done the batch. Therefore the script requires a proper "error"-description to handle the next steps.

Yet scanimage does return a pretty odd message:

scanimage: sane_start: Document feeder out of documents

So the whole output looks like this if there was a success:

scanscript "scanimage --device='brother4:net1;dev0' --format tiff --resolution=150 --source 'Automatic Document Feeder(left aligned,Duplex)' -l 0mm -t 0mm -x210mm -y297mm --batch=$(date +%Y%m%d_%H%M%S)_p%04d.tiff" "/home/qohelet/scans/images/281/" "myscan"
scanimage: rounded value of br-x from 210 to 209.981
scanimage: rounded value of br-y from 297 to 296.973
Scanning -1 pages, incrementing by 1, numbering from 1
Scanning page 1
Scanned page 1. (scanner status = 5)
Scanning page 2
Scanned page 2. (scanner status = 5)
Scanning page 3
scanimage: sane_start: Document feeder out of documents

Technically this is correct, yes - but this happens always when the job is done. In case I haven't put any paper into the feeder it looks like that:

scanscript "scanimage --device='brother4:net1;dev0' --format tiff --resolution=150 --source 'Automatic Document Feeder(left aligned,Duplex)' -l 0mm -t 0mm -x210mm -y297mm --batch=$(date +%Y%m%d_%H%M%S)_p%04d.tiff" "/home/qohelet/scans/images/281/" "myscan"
scanimage: rounded value of br-x from 210 to 209.981
scanimage: rounded value of br-y from 297 to 296.973
Scanning -1 pages, incrementing by 1, numbering from 1
Scanning page 1
scanimage: sane_read: Error during device I/O
Scanned page 1. (scanner status = 9)

The error 9 is unfortunately just one part of the output. How can I distinguish whether it was thrown or not?

In my scanscript I use if to evaluate whether or not the scan was successful:

if eval $1; then
    #Do stuff
else
    #Do error stuff and exit with error code
fi

Unfortunately when using scanimage with a batch it's always counted as a failure. Is there a way to find out what actually happened?

Seems someone had a similar issue with a different scanner (I have a Brother-Scanner, but that's not really related to the issue) already: http://sane.10972.n7.nabble.com/Issue-with-Fujitsu-ScanSnap-iX500-td18589.html

But the topic was not continued there, yet now I'm stuck here and would like to know what to do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.