[sane-devel] [PATCH] Fix ADF scanning for Canon MF57x0 devices

Dmitry Deshevoy mityada at gmail.com
Fri Sep 30 13:38:48 UTC 2016


Canon MF57x0 devices require abort_session() after each page except
the last one.
The result from calibrate() should be ignored, so that scanning is not
interrupted with PIXMA_STATUS_BUSY.
---
 backend/pixma_mp730.c | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/backend/pixma_mp730.c b/backend/pixma_mp730.c
index 06bc9ee..b0692e4 100644
--- a/backend/pixma_mp730.c
+++ b/backend/pixma_mp730.c
@@ -459,6 +459,8 @@ step1 (pixma_t * s)
           default:
             break;
         }
+
+      error = 0;
     }
   if (error >= 0)
     error = activate (s, 0);
@@ -747,19 +749,22 @@ mp730_finish_scan (pixma_t * s)
       query_status (s);
       activate (s, 0);

-      if (! aborted && s->cfg->pid == IR1020_PID)
- {
-  error = abort_session (s);
-  if (error < 0)
-    {
-      PDBG (pixma_dbg
-    (1, "WARNING:abort_session() failed %s\n",
-     pixma_strerror (error)));
-      query_status (s);
-      query_status (s);
-      activate (s, 0);
-    }
- }
+      if (!aborted &&
+          (s->param->source == PIXMA_SOURCE_ADF ||
+           s->param->source == PIXMA_SOURCE_ADFDUP) &&
+          has_paper (s) &&
+          (s->cfg->pid == MF5730_PID ||
+           s->cfg->pid == MF5750_PID ||
+           s->cfg->pid == MF5770_PID ||
+           s->cfg->pid == IR1020_PID))
+        {
+          error = abort_session (s);
+          if (error < 0)
+            PDBG (pixma_dbg
+                  (1, "WARNING:abort_session() failed %s\n",
+                   pixma_strerror (error)));
+        }
+
       mp->buf = mp->lbuf = mp->imgbuf = NULL;
       mp->state = state_idle;
       /* fall through */
-- 
2.9.3



More information about the sane-devel mailing list