[sane-devel] Canon PIXMA MX870

2011-01-22 Thread Kenton Varda
Hi Louis,

Sorry, but after fighting with this scanner for all of last weekend and
realizing just how pitiful Canon's Linux support is, I returned it and
bought an HP instead.  The HP works perfectly with Sane.

I do have quite a few debug logs recorded and it looks like the unknown1
value in the job details response is always zero.  I actually added some
code to write out the members of the struct in addition to the raw bytes, so
this is pretty easy to grep for.

I've attached two logs.  In the first one, the scanner successfully scanned
three pages (and then refused the connection for the fourth page, because
there was no physical fourth page).  In the second one, the scanner refuses
to connect on the first page, presumably because it has been left in a bad
state.

Of course, since I don't have this scanner anymore I don't expect anyone to
actually look at these.

-Kenton

On Sat, Jan 22, 2011 at 7:32 AM, Louis Lagendijk
louis at lagendijk.xs4all.nlwrote:

 On Sun, 2011-01-16 at 02:04 -0800, Kenton Varda wrote:
 I leave your first question for Nicolas to answer. I don't understand
 the backend well enough to dig into this part. sorry for the late reply,
 I have been out of the country for a few days and busy with work...

  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.
 
 I have seen cases before where we got stuck opening a TCP connection
 where the scanner got confused. Your guess is most likely correct.
 
  - 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 has a look at the bjnp code again, but can not check details as some
 of the information is missing. Can you please get me a log file with
 log-level 14 or (maybe even better) a wireshark trace? I am especially
 interested to see what the unknown1 value of the last UDP command is
 before we try to open the TCP connection. I have never seen it set, but
 that may be due to the fact that I don't have an ADFIt may be that
 your scanner uses that unknown stuff to signal that is is not ready to
 read more data. It may also be that we need to teach the higher level of
 the backend when no more pages will be available. Does a USB connection
 behave any better?
 
  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.
 
 That is due to the fact that the backend closes the bjnp connection
 (like if does for the USB-connection).
 
  Any ideas?
 Please provide some detailed traces so we can see what is happening

 best regards, Louis


-- next part --
An HTML attachment was scrubbed...
URL: 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20110122/3c11d688/attachment-0001.htm
-- next part --
A non-text attachment was scrubbed...
Name: mydebug1.log
Type: text/x-log
Size: 6834121 bytes
Desc: not available
URL: 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20110122/3c11d688/attachment

[sane-devel] Canon PIXMA MX870

2011-01-16 Thread Kenton Varda
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


[sane-devel] Canon PIXMA MX870

2011-01-15 Thread Kenton Varda
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/20110115/ae5507f6/attachment-0001.htm