[sane-devel] Canon MX430 / MX510 / MX925 - does not recover when ADF out of paper
Rolf Bensch
rolf at bensch-online.de
Mon Mar 17 20:39:06 UTC 2014
Hi,
As you can see on the log file, the backend doesn't start a new scan
after page 3 has been scanned. Due to this the scanner cannot handle the
scan commands and a timeout raises.
I prepared a patch with a new adf state variable. This patch is based on
the latest git sources and patch1.
Please test the patch and create a new log file.
Cheers,
Rolf
Am 17.03.2014 21:03, schrieb Matthias Peter Walther:
> Hello All,
>
> I had some trouble to apply the new patch, but Rolf helped me to fix it.
>
> Here comes the result with git + patch pixma_mp150.c.patch1, 3 pages in ADF.
>
> It works correct, but the timeout at the end acts weird. In the log it
> counts down 8 7 6...but between each line it pauses around 15-20
> seconds. This scan took ages!
>
> The log comes as attachment.
>
> Bye
> Matthias
>
> Am 15.03.2014 20:16, schrieb Rolf Bensch:
>> 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-17 20:54:01.000000000 +0100
+++ ../sane-backends/backend/pixma_mp150.c 2014-03-17 21:21:34.000000000 +0100
@@ -284,6 +284,7 @@
unsigned stripe_shift;
uint8_t tpu_datalen;
uint8_t tpu_data[0x40];
+ uint8_t adf_state; /* handle adf scanning */
} mp150_t;
/*
@@ -454,6 +455,7 @@
abort_session (pixma_t * s)
{
mp150_t *mp = (mp150_t *) s->subdriver;
+ mp->adf_state = state_idle; /* reset adf scanning */
return pixma_exec_short_cmd (s, &mp->cb, cmd_abort_session);
}
@@ -1190,6 +1192,9 @@
/* TPU info data setup */
mp->tpu_datalen = 0;
+ /* adf scanning */
+ mp->adf_state = state_idle;
+
if (mp->generation < 4)
{
query_status (s);
@@ -1337,7 +1342,9 @@
return PIXMA_EBUSY;
/* Generation 4: send XML dialog */
- if (mp->generation == 4 && s->param->adf_pageid == 0)
+ /* adf: first page or idle */
+ if ((mp->generation == 4 && s->param->adf_pageid == 0) ||
+ mp->adf_state == state_idle)
{
if (!send_xml_dialog (s, XML_START_1))
return PIXMA_EPROTO;
@@ -1394,7 +1401,9 @@
}
tmo = 10;
- if (s->param->adf_pageid == 0 || mp->generation <= 2)
+ /* adf: first page or idle */
+ if ((s->param->adf_pageid == 0 || mp->generation <= 2) ||
+ mp->adf_state == state_idle)
{ /* 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"));
@@ -1456,6 +1465,10 @@
mp150_finish_scan (s);
return error;
}
+
+ /* ADF scanning active */
+ if (is_scanning_from_adf (s))
+ mp->adf_state = state_scanning;
return 0;
}
More information about the sane-devel
mailing list