[simple-scan: 1/2] Handle NO_DOCS response during sane_read calls



commit 0e430e4bfa6f6ecc34e46a9b2ef630bcb2b0f94e
Author: Earle F. Philhower, III <earlephilhower yahoo com>
Date:   Sat May 19 08:44:44 2018 -0700

    Handle NO_DOCS response during sane_read calls
    
    The SANE API says that SANE_STATUS_NODOCS can be returned by sane_read.
    This happens with scanner drivers that can't detect an ADF out of paper
    until the reads begin.
    
    When this happens, the frontend scanner should handle this as a normal
    end of documents, and not an error.
    
    When detected now, just clost the document and do not report a warning.

 src/scanner.vala | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/src/scanner.vala b/src/scanner.vala
index cd7c300..58141b8 100644
--- a/src/scanner.vala
+++ b/src/scanner.vala
@@ -1331,6 +1331,13 @@ public class Scanner
             return;
         }
 
+        /* Some ADF scanners only return NO_DOCS after a read */
+        if (status == Sane.Status.NO_DOCS)
+        {
+            do_complete_document ();
+            return;
+        }
+
         /* Communication error */
         if (status != Sane.Status.GOOD)
         {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]