[sane-devel] ADF support in SANE API

Jürgen Mellinger juergen.mellinger at t-online.de
Sun Jun 28 18:22:10 BST 2020


Hi,

I’m trying to incorporate ADF support into a SANE frontend that I have written
(github.com/SimulPiscator/AirSane).
The frontend is a web server that needs to report or announce the scanner’s status to its clients.
Without an ADF, scanner status is just idle vs busy, and any error state is only temporary.
With an ADF, the "ADF empty" state prevents scanning but needs to be monitored such that
a client can know it may initiate a scan when it switches to "ADF loaded".

In the SANE API documentation, I can see SANEStatus result codes referring to ADF state:
SANE_STATUS_JAMMED, SANE_STATUS_NO_DOCS, SANE_STATUS_COVER_OPEN.
These are returned from the sane_start() and sane_read() functions, there seems to be 
no API function that can immediately retrieve ADF status.

So my question is: What can I do in order to monitor ADF status? Call sane_start() after setting an empty
scan region, so the scan is done at the first call to sane_read()? This is obviously not an option, as in the
case of a loaded feeder this would consume the first original rather than just read ADF status.
Cancel the scan immediately after sane_start() using sane_cancel()? I have no idea whether this is possible.

Is it at all posslble to monitor ADF status using SANE?

Thank you,
Juergen





More information about the sane-devel mailing list