[sane-devel] Canon PIXMA MX870

Kenton Varda temporal at gmail.com
Sun Jan 16 10:04:50 UTC 2011


OK, I did some playing around, trying things, reading logs, and looking at
the code.  I think I'm seeing a few different problems.

First, if I place more than one page in the ADF and then try to scan only a
single page (scanimage without --batch), then sane will leave the scanner
hanging after the first page.  The scanner loads page 2 and waits for
commands, but scanimage returns success.  This isn't just a matter of
scanimage being oblivious, though:  if only one page is physically present,
scanimage sends the EndJob XML message after scanning that page, but if a
second page is present, then no EndJob is sent.  I believe I tracked this
down to:

pixma_mp150.c line 1506:
      /* FIXME: to process several pages ADF scan, must not send
       * abort_session and start_session between pages (last_block=0x28) */
      if (mp->generation <= 2 || !is_scanning_from_adf (s) || mp->last_block
== 0x38)

The EndJob message is sent in this branch.  I'm guessing what the comment is
telling me is that last_block is 0x28 when additional pages are available,
instead of 0x38, and therefore the branch won't be taken.

That said, this is arguably a case of incorrect usage anyway.  If I have
loaded multiple pages into the ADF, I really ought to be using --batch.  And
when I do, scanimage is able to scan multiple pages OK.

==========

Unfortunately, there is another, less-deterministic problem.  It seems that
the scanner very frequently refuses sane's TCP connections:

[pixma] Reader task terminated
Scanned page 1. (scanner status = 5)
Scanning page 2
[pixma] Reader task id=14568 (forked)
[pixma] Reader task started
[pixma] sanei_bjnp_activate (0)
[pixma] udp_command: Sending UDP command to 10.0.1.22:8612
*[pixma] bjnp_open_tcp: Can not connect to scanner: Connection refused*
[pixma] sanei_bjnp_deactivate (0)
[pixma] udp_command: Sending UDP command to 10.0.1.22:8612
[pixma] [pixma] Reader task terminated: EINVAL
read_image():reader task closed the pipe:0 bytes received, 10718400 bytes
expected
scanimage: sane_read: Invalid argument
Scanned page 2. (scanner status = 4)
[pixma] pixma_close(): Canon PIXMA MX870
[pixma] sanei_bjnp_close(0):

It's hard to pin down a pattern describing when this happens, but:

- It never happens if the scanner was just powered on (and had time to
boot).  Or in other words, power cycling the scanner fixes problems,
suggesting that the scanner is getting into a bad state.

- It always happens when the ADF runs out of paper.  sane appears to form a
new connection for each page.  After the last page, sane tries to connect
again even though there are no more pages, and this connection always fails
AFAICT.  This causes scanimage to exit with an error code even though
technically it completed its task successfully.

- After having completed a batch, the scanner is sometimes (but not always)
left in a state where all further connections are refused until the device
is power-cycled.  Sometimes the device will recover from this state
magically without a power cycle, if I retry a few times.  Sometimes running
Scangear MP can revive the device from this state, but not always.

- I changed the TCP connection code to retry once, and the result is even
odder:  The retry sometimes succeeds, but then the scanner apparently does
not reply to any requests on the new connection.

I tried comparing network dumps between SANE and Scangear MP, but they were
completely different.  Scangear MP appears to make only one TCP connection
for the whole batch, rather than one per page.

Any ideas?

On Sat, Jan 15, 2011 at 9:13 PM, Kenton Varda <temporal at gmail.com> wrote:

> Hi Nicolas and sane-devel,
>
> Back in July there was a thread on the Canon PIXMA MX870 that ended here:
>
> http://lists.alioth.debian.org/pipermail/sane-devel/2010-July/027197.html
>
> Using the latest sources from git, I find myself stuck at basically the
> same place as Matthais.
>
> When using the scanner over ethernet, I can sometimes scan one page from
> the ADF, but multiple pages fail.  In general the device is very finicky.
>
> Over USB, scanimage -T just hangs.  (I also had the same conflict with
> usblp that Matthias mentioned, but that went away when I did modprobe -r
> usblp usb_storage.)
>
> What can I do to help get this working?
>
> Note that the scanner works in Linux with Canon's "Scangear MP", but I'd
> rather use sane.
>
> Thanks,
> -Kenton
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20110116/88a02a8a/attachment.htm>


More information about the sane-devel mailing list