[sane-devel] Canon MX430 / MX510 / MX925 - does not recover when ADF out of paper

Rolf Bensch rolf at bensch-online.de
Sat Mar 15 19:16:14 UTC 2014


Hi All,

Now we have Matthias on board with his MX375.

Please don't use the old patches. I started changing code in pixma.c
where we might get problems with other scanners, e.g. with the
Imageclass sub-backend. So, we should find a fix which affects
pixma_mp150.c only.

We should start at the beginning. Please use attached patch with latest
code from git. I added some additional debug outputs to show the status
of adf scanning. Please create a debug file with 'export
SANE_DEBUG_PIXMA=4'.

I also added TODO comments as hints for possible fixes.

Cheers,
Rolf



Am 14.03.2014 22:41, schrieb Matthias Peter Walther:
> Hallo Rolf,
> 
> thanks for your quick reply. I'm from Germany too, by the way. But to
> keep this conformed, I'm gonna answer you in english.
> 
> If I understood your posts correctly, you want me to use patch 3+4.
> Patch 5 is only for the feature to initiate a scan from the device.
> Which is nice, but I will look into that later.
> 
> So I pulled my git-sane-backend-repo and patched it:
> 
> mpw at Server0:~/sane$ patch -p1 < attachment-0003.bin
> patching file sane-backends/backend/pixma.c
> mpw at Server0:~/sane$ patch -p1 < attachment-0004.bin
> patching file sane-backends/backend/pixma_mp150.c
> Hunk #2 succeeded at 1397 (offset -12 lines).
> Hunk #3 succeeded at 1439 (offset -12 lines).
> Hunk #4 succeeded at 1493 (offset -12 lines).
> Hunk #5 succeeded at 1560 (offset -12 lines).
> Hunk #6 succeeded at 1568 (offset -12 lines).
> Hunk #7 succeeded at 1580 (offset -12 lines).
> 
> I think the offset is related to the age of the patch.
> 
> After installing, I check the ldconfig:
> 
> $ sudo ldconfig -v | grep libsane
> /sbin/ldconfig.real: Kann »stat()« für »/lib/i686-linux-gnu« nicht
> aufrufen: Datei oder Verzeichnis nicht gefunden
> /sbin/ldconfig.real: Kann »stat()« für »/usr/lib/i686-linux-gnu« nicht
> aufrufen: Datei oder Verzeichnis nicht gefunden
> /sbin/ldconfig.real: Pfad »/usr/local/lib« mehrfach angegeben
> /sbin/ldconfig.real: Pfad »/lib/x86_64-linux-gnu« mehrfach angegeben
> /sbin/ldconfig.real: Pfad »/usr/lib/x86_64-linux-gnu« mehrfach angegeben
>     libsane.so.1 -> libsane.so.1.0.25
>     libsane.so.1 -> libsane.so.1.0.22
> /sbin/ldconfig.real: Es ist nicht möglich, den Status (stat()) der Datei
> /usr/lib/x86_64-linux-gnu/libsoftokn3.so zu lesen: Datei oder
> Verzeichnis nicht gefunden
>     libsane.so.1 -> libsane.so.1.0.22
>     libsane-canon_mfp.so.1 -> libsane-canon_mfp.so.1.0.9
> 
> This looks good, I think I had 1.0.24 from last october before. Okay, I
> tried a scan then:
> 
> $ scanadf
> scanadf: sane_read: Error during device I/O
> Error during device I/O
> Scanned 0 pages
> $
> 
> This did not work before, either. Maybe my sane-frontend is too old? I
> have the original one from Ubuntu 12.04.4.
> $ scanadf --version
> scanadf (sane-frontends) 1.0.14
> 
> Next try, scanimage:
> $ scanimage --source "Automatic Document Feeder" -p --batch
> Scanning -1 pages, incrementing by 1, numbering from 1
> Scanning page 1
> Scanned page 1. (scanner status = 5)
> Scanning page 2
> scanimage: sane_read: Document feeder out of documents
> Scanned page 2. (scanner status = 7)
> mpw at Server0:~/sane$ ls
> attachment-0003.bin  attachment-0004.bin  out1.pnm  sane-backends
> 
> This is a first success. But as you can see in the output of ls, it
> stores only the first page, the second is lost. Or is there something
> wrong with my scanimage-command?
> 
> BTW: Can you please change "Automatic Document Feeder" to simply "ADF",
> that would be much more comfortable to type :)
> 
> So thanks for your patch, I think it's almost perfect. I just need to
> store the 2nd page.
> 
> Please let me know, if you need more detailed debugging output. Will you
> commit this two patches to the git repository?
> 
> Grüße aus Münster
> Matthias
> 
> Am 14.03.2014 19:31, schrieb Rolf Bensch:
>> Hi Matthias,
>>
>> Please read this thread:
>> http://lists.alioth.debian.org/pipermail/sane-devel/2014-March/032138.html.
>>
>> Cheers,
>> Rolf
>>
>>
>> Am 12.03.2014 21:11, schrieb Matthias Peter Walther:
>>> Hello,
>>>
>>> I'm new to this, but I'm gonna try my luck. I own a Canaon MX375
>>> all-in-one. The PIXMA-backend has this annoying adf-empty-bug.
>>>
>>> Is there any information I could provice to help to fix this?
>>>
>>> The binary driver from canon.uk works with their gui-frontend only and
>>> I'd like to get it working on a headless system.
>>>
>>> Thanks for any comments.
>>>
>>> Bye
>>> Matthias Walther
>>>
>>>
> 
> 
-------------- next part --------------
--- ./pixma_mp150.c	2014-03-15 19:33:34.000000000 +0100
+++ ../sane-backends/backend/pixma_mp150.c	2014-03-15 19:52:05.000000000 +0100
@@ -1395,7 +1395,9 @@
 
   tmo = 10;
   if (s->param->adf_pageid == 0 || mp->generation <= 2)
-    {
+    { /* single sheet or first sheet from ADF */
+      /* TODO: s->param->adf_pageid != 0 @ next scan session! */
+      PDBG (pixma_dbg (4, "*mp150_scan***** start scanning *****\n"));
       error = start_session (s);
       while (error == PIXMA_EBUSY && --tmo >= 0)
         {
@@ -1436,7 +1438,11 @@
         error = send_set_tpu_info (s);
     }
   else   /* ADF pageid != 0 and gen3 or above */
+  { /* next sheet from ADF */
+    PDBG (pixma_dbg (4, "*mp150_scan***** scan next sheet from ADF  *****\n"));
     pixma_sleep (1000000);
+  }
+
 
   if ((error >= 0) || (mp->generation >= 3))
     mp->state = state_warmup;
@@ -1485,7 +1491,13 @@
       if (s->cancel)
         return PIXMA_ECANCELED;
       if ((mp->last_block & 0x28) == 0x28)
-        {       /* end of image */
+        {  /* end of image */
+           /* TODO: reset ADF page counter here!
+            *       there are 2 counters: s->param->adf_pageid == sp->adf_pageid and
+            *                             ss->page_count (see pixma.c)
+            *       OR
+            *       define a new parameter in mp150_t for new session detection in mp150_scan() */
+           PDBG (pixma_dbg (4, "*mp150_fill_buffer***** end of image  *****\n"));
            mp->state = state_finished;
            return 0;
         }
@@ -1557,6 +1569,7 @@
        * abort_session and start_session between pages (last_block=0x28) */
       if (mp->generation <= 2 || !is_scanning_from_adf (s) || mp->last_block == 0x38)
         {
+          PDBG (pixma_dbg (4, "*mp150_finish_scan***** abort session  *****\n"));
           error = abort_session (s);  /* FIXME: it probably doesn't work in duplex mode! */
           if (error < 0)
             PDBG (pixma_dbg (1, "WARNING:abort_session() failed %d\n", error));
@@ -1568,6 +1581,9 @@
                 PDBG (pixma_dbg (1, "WARNING:XML_END dialog failed \n"));
             }
         }
+      else
+        PDBG (pixma_dbg (4, "*mp150_finish_scan***** wait for next page from ADF  *****\n"));
+
         mp->state = state_idle;
       /* fall through */
     case state_idle:


More information about the sane-devel mailing list