Hi Louis,<div><br></div><div>Sorry, but after fighting with this scanner for all of last weekend and realizing just how pitiful Canon&#39;s Linux support is, I returned it and bought an HP instead.  The HP works perfectly with Sane.</div>
<div><br></div><div>I do have quite a few debug logs recorded and it looks like the &quot;unknown1&quot; 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.</div>
<div><br></div><div>I&#39;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.</div>
<div><br></div><div>Of course, since I don&#39;t have this scanner anymore I don&#39;t expect anyone to actually look at these.</div><div><br></div><div>-Kenton</div><div><br><div class="gmail_quote">On Sat, Jan 22, 2011 at 7:32 AM, Louis Lagendijk <span dir="ltr">&lt;<a href="mailto:louis@lagendijk.xs4all.nl">louis@lagendijk.xs4all.nl</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">On Sun, 2011-01-16 at 02:04 -0800, Kenton Varda wrote:<br>
I leave your first question for Nicolas to answer. I don&#39;t understand<br>
the backend well enough to dig into this part. sorry for the late reply,<br>
I have been out of the country for a few days and busy with work...<br>
<div class="im"><br>
&gt; Unfortunately, there is another, less-deterministic problem.  It seems<br>
&gt; that the scanner very frequently refuses sane&#39;s TCP connections:<br>
&gt;<br>
&gt;<br>
&gt; [pixma] Reader task terminated<br>
&gt; Scanned page 1. (scanner status = 5)<br>
&gt; Scanning page 2<br>
&gt; [pixma] Reader task id=14568 (forked)<br>
&gt; [pixma] Reader task started<br>
&gt; [pixma] sanei_bjnp_activate (0)<br>
&gt; [pixma] udp_command: Sending UDP command to <a href="http://10.0.1.22:8612" target="_blank">10.0.1.22:8612</a><br>
&gt; [pixma] bjnp_open_tcp: Can not connect to scanner: Connection refused<br>
&gt; [pixma] sanei_bjnp_deactivate (0)<br>
&gt; [pixma] udp_command: Sending UDP command to <a href="http://10.0.1.22:8612" target="_blank">10.0.1.22:8612</a><br>
&gt; [pixma] [pixma] Reader task terminated: EINVAL<br>
&gt; read_image():reader task closed the pipe:0 bytes received, 10718400<br>
&gt; bytes expected<br>
&gt; scanimage: sane_read: Invalid argument<br>
&gt; Scanned page 2. (scanner status = 4)<br>
&gt; [pixma] pixma_close(): Canon PIXMA MX870<br>
&gt; [pixma] sanei_bjnp_close(0):<br>
&gt;<br>
&gt;<br>
&gt; It&#39;s hard to pin down a pattern describing when this happens, but:<br>
&gt;<br>
&gt;<br>
&gt; - It never happens if the scanner was just powered on (and had time to<br>
&gt; boot).  Or in other words, power cycling the scanner fixes problems,<br>
&gt; suggesting that the scanner is getting into a bad state.<br>
&gt;<br>
</div>I have seen cases before where we got stuck opening a TCP connection<br>
where the scanner got confused. Your guess is most likely correct.<br>
<div class="im">&gt;<br>
&gt; - It always happens when the ADF runs out of paper.  sane appears to<br>
&gt; form a new connection for each page.  After the last page, sane tries<br>
&gt; to connect again even though there are no more pages, and this<br>
&gt; connection always fails AFAICT.  This causes scanimage to exit with an<br>
&gt; error code even though technically it completed its task successfully.<br>
&gt;<br>
&gt;<br>
&gt; - After having completed a batch, the scanner is sometimes (but not<br>
&gt; always) left in a state where all further connections are refused<br>
&gt; until the device is power-cycled.  Sometimes the device will recover<br>
&gt; from this state magically without a power cycle, if I retry a few<br>
&gt; times.  Sometimes running Scangear MP can revive the device from this<br>
&gt; state, but not always.<br>
&gt;<br>
&gt;<br>
&gt; - I changed the TCP connection code to retry once, and the result is<br>
&gt; even odder:  The retry sometimes succeeds, but then the scanner<br>
&gt; apparently does not reply to any requests on the new connection.<br>
&gt;<br>
</div>I has a look at the bjnp code again, but can not check details as some<br>
of the information is missing. Can you please get me a log file with<br>
log-level 14 or (maybe even better) a wireshark trace? I am especially<br>
interested to see what the &quot;unknown1&quot; value of the last UDP command is<br>
before we try to open the TCP connection. I have never seen it set, but<br>
that may be due to the fact that I don&#39;t have an ADF....It may be that<br>
your scanner uses that unknown stuff to signal that is is not ready to<br>
read more data. It may also be that we need to teach the higher level of<br>
the backend when no more pages will be available. Does a USB connection<br>
behave any better?<br>
<div class="im">&gt;<br>
&gt; I tried comparing network dumps between SANE and Scangear MP, but they<br>
&gt; were completely different.  Scangear MP appears to make only one TCP<br>
&gt; connection for the whole batch, rather than one per page.<br>
&gt;<br>
</div>That is due to the fact that the backend closes the bjnp connection<br>
(like if does for the USB-connection).<br>
&gt;<br>
&gt; Any ideas?<br>
Please provide some detailed traces so we can see what is happening<br>
<br>
best regards, Louis<br>
<br>
</blockquote></div><br></div>