[sane-devel] Error: Canon Pixma MG7550 hangs

Rolf Bensch rolf at bensch-online.de
Fri Apr 3 22:07:03 UTC 2015


Hi All,

Sorry for my late response. And sorry again, I'm very busy on my new job
and I can only sometimes look into the mailing list. It's more secure to
set me on cc, if you want to address me.

It seems that we have a general problem in the Pixma backend. During the
past months, several people reported timeouts resp. hang problems with
their scanners.

I also had such problems with my new USB3 card, but as I found time to
solve this problem, it has been gone by itself...

Now let's start with troubleshooting.

(1) Please try different frontends, if you have problems with scanning.
Some users reported problems with scanimage, but xsane is working.

(2) If you're checking USB scanning, always switch off | disable |
disconnect all ethernet | WiFi connections from your scanner.

(3) If you're checking ethernet | WiFi connection, always disconnect USB
from your scanner. And don't mix ethernet and WiFi.

(4) What's the lastest status of USB only scanning from flatbed? This is
the base function and should always run without any problems.

(5) If flatbed scans are running and if you have problems with adf, we
need to check the usb protocols. Please create log files for single page
and 2-page scans with 'export SANE_DEBUG_PIXMA=11'. And to reduce log
files sizes, please scan only small image areas of about 5mm x 5mm.
Background: All pages are scanned in one scan session. We need to check
if the scan session will be closed after the last page resp. after
detecting paper empty with 10s timeout.

I prepared 2 patches for you, if your scanner hangs at the end of a
scan. Or if your scanner doesn't want to scan a 2nd time without
repowering. Exclude item (5). Please try only one patch at one time, and
revoke it before you want to try the other one.

(6) I found an old patch, I got about 3 years ago as a bug fix
(3c5cc2a). There is an EOF declared as an error! The original patch was
for USB only, but has been extended for all protocols with a later
patch. Attached patch file pixma_io_sanei.c.patch revokes the old patches.

(7) Due to the reported issue that sometimes xsane is working and
scanimage doesn't, I found out that the method mp150_finish_scan() in
pixma_mp150.c will be called twice: (a) At the end of the scan and (b)
called from scanimage (I didn't investigated other frontends than
scanimage). Existing code can create communication problems with the
scanner, if calling (b) is faster than (a) is ready. I'm not sure, if
this could really happen. Attached patch file pixma_mp150.c.patch fixes
this issue. I also prepared a patch file for the Pixma CCD scanners
(pixma_mp810.c.patch).

Please report your results and|or respond your suggestions.

Cheers,
Rolf



Am 03.03.2015 um 22:49 schrieb Troels Thomsen:
> Hi Martin,
>
> Good work Martin!
> Any missing commands would be a smoking gun imho.
>
> Rolf, are you following this thread ?
>
> /Troels
>
>
>
> 2015-02-24 23:09 GMT+01:00 Martin <martin.gu at intergga.ch
> <mailto:martin.gu at intergga.ch>>:
>
>     Troels
>
>     I don't have access to another computer. But I have installed
>     OpenSUSE 13.2
>     and the result is the same as on 13.1.
>     I did not (yet) test with short delays between the commands, but I
>     compared
>     the communication of the Canon software scangear on Windows with
>     the one of
>     SANE:
>
>     At start ScanGear sends the following (linebreaks added by me):
>     <?xml version="1.0" encoding="utf-8" ?>
>     <cmd xmlns:ivec="http://www.canon.com/ns/cmd/2008/07/common/"
>     xmlns:vcn="http://www.canon.com/ns/cmd/2008/07/canon/">
>       <ivec:contents><ivec:operation>VendorCmd</ivec:operation>
>         <ivec:param_set servicetype="scan">
>           <ivec:jobID> </ivec:jobID>
>           <vcn:ijoperation>ModeShift</vcn:ijoperation>
>           <vcn:ijmode>1</vcn:ijmode>
>         </ivec:param_set>
>       </ivec:contents>
>     </cmd>
>
>     response:
>     <?xml version="1.0" encoding="utf-8" ?>
>     <cmd xmlns:ivec="http://www.canon.com/ns/cmd/2008/07/common/"
>     xmlns:vcn="http://www.canon.com/ns/cmd/2008/07/canon/">
>       <ivec:contents>
>         <ivec:operation>VendorCmdResponse</ivec:operation>
>         <ivec:param_set servicetype="scan">
>           <ivec:response>OK</ivec:response>
>           <ivec:response_detail/>
>           <vcn:ijoperation>ModeShiftResponse</vcn:ijoperation>
>           <vcn:ijresponse>OK</vcn:ijresponse>
>           <vcn:ijresponse_detail/>
>         </ivec:param_set>
>       </ivec:contents>
>     </cmd>
>
>     ScanGear starts a scan with the following command sequece:
>     <?xml version="1.0" encoding="utf-8" ?>
>     <cmd xmlns:ivec="http://www.canon.com/ns/cmd/2008/07/common/">
>       <ivec:contents>
>         <ivec:operation>StartJob</ivec:operation>
>         <ivec:param_set servicetype="scan">
>           <ivec:jobID>00000001</ivec:jobID>
>           <ivec:bidi>1</ivec:bidi>
>         </ivec:param_set>
>       </ivec:contents>
>     </cmd>
>
>     response:
>     <?xml version="1.0" encoding="utf-8" ?>
>     <cmd xmlns:ivec="http://www.canon.com/ns/cmd/2008/07/common/">
>       <ivec:contents>
>         <ivec:operation>StartJobResponse</ivec:operation>
>         <ivec:param_set servicetype="scan">
>           <ivec:response>OK</ivec:response>
>           <ivec:response_detail/>
>           <ivec:jobID>00000001</ivec:jobID>
>         </ivec:param_set>
>       </ivec:contents>
>     </cmd>
>
>     command:
>     <?xml version="1.0" encoding="utf-8" ?>
>     <cmd xmlns:ivec="http://www.canon.com/ns/cmd/2008/07/common/"
>     xmlns:vcn="http://www.canon.com/ns/cmd/2008/07/canon/">
>       <ivec:contents>
>         <ivec:operation>VendorCmd</ivec:operation>
>         <ivec:param_set servicetype="scan">
>         <ivec:jobID>00000001</ivec:jobID>
>         <vcn:ijoperation>ModeShift</vcn:ijoperation>
>         <vcn:ijmode>1</vcn:ijmode>
>         </ivec:param_set>
>       </ivec:contents>
>     </cmd>
>
>     response: some data
>
>     command:
>     <?xml version="1.0" encoding="utf-8" ?>
>     <cmd xmlns:ivec="http://www.canon.com/ns/cmd/2008/07/common/">
>       <ivec:contents>
>         <ivec:operation>EndJob</ivec:operation>
>         <ivec:param_set servicetype="scan">
>           <ivec:jobID>00000001</ivec:jobID>
>         </ivec:param_set>
>       </ivec:contents>
>     </cmd>
>
>     response:
>     <?xml version="1.0" encoding="utf-8" ?>
>     <cmd xmlns:ivec="http://www.canon.com/ns/cmd/2008/07/common/">
>       <ivec:contents>
>         <ivec:operation>EndJobResponse</ivec:operation>
>         <ivec:param_set servicetype="scan">
>           <ivec:response>OK</ivec:response>
>           <ivec:response_detail/>
>           <ivec:jobID>00000001</ivec:jobID>
>         </ivec:param_set>
>       </ivec:contents>
>     </cmd>
>
>     SANE does not send the VendorCmd. Do you think incorporating the
>     missing
>     command sequence could solve the issue? I do not want to damage my
>     MG7550 with
>     wrong commands, that's why I am reluctant to experiment with
>     code-changes.
>
>     Many thanks for your help
>     Martin
>
>     Am Sonntag, 11. Januar 2015, 14.52:06 schrieb Troels Thomsen:
>     > Martin,
>     > ad 1)
>     > I'm sorry I have no understanding of the protocol what so ever,
>     and have
>     > spent max œ hour in the code, to see what the patches I was
>     sent, did.
>     > ad 2)
>     > I agree , this IS strange ...
>     > ad 3)
>     > I agree , this IS strange ...
>     > ad 4)
>     > Frankly, you have so many strange phenomenons going on, so ...
>     you could
>     > try....
>     > (not that this a satisfactory solution at all...)
>     >
>     > At this point, I think I would try to test it on another
>     computer, to see
>     > if all these really strange phenomenons (e.g. 'enabling Ethernet
>     on the
>     > device, makes usb scanning work' ) somehow is related to
>     hardware or the
>     > Linux installation. Just to make sure....
>     >
>     > Sorry, its not much help.
>     >
>     > /Troels
>     >
>     > 2015-01-07 23:26 GMT+01:00 Martin <martin.gu at intergga.ch
>     <mailto:martin.gu at intergga.ch>>:
>     > > Troels
>     > >
>     > > I agree with you, we have to be careful on the test methodology.
>     > > My knowledge in c is limited since I wrote my last c-program
>     about 20
>     > > years
>     > > ago. But I could try.
>     > > But before trying to modify the source code I have some questions:
>     > >
>     > > 1) Did you analyze the USB-calls of the Canon-software on
>     windows and
>     > > compare
>     > > them to the SANE-sequence? What is the meaning of the first
>     sequece 55 53
>     > > 42
>     > > 43 F0 36 04 0B...?
>     > >
>     > > 2) What is the difference between scanimage and xsane? Is it
>     only the
>     > > timing?
>     > >
>     > > 3) What is the difference between xsane and the gimp plugin?
>     Is it only
>     > > the
>     > > timing? Why does the gimp plugin only work after xsane?
>     > >
>     > > 4) Would it be worth while to make a few tests with the
>     printer mode, i.e.
>     > > to
>     > > try to start xsane after printing?
>     > >
>     > > Martin
>     > >
>     > > > > If the scanner does not work on a USB port it is quite
>     unlikely to
>     > > > > work
>     > > > > over the network: the bjnp network code just carries the
>     USB exchange
>     > > > > over IP.
>     > > >
>     > > > I mostly agree, though Rolf asks specifically for the USB
>     trace, because
>     > > > (as I understood) it differs slightly from the IP traces I
>     had already
>     > > > submitted.
>     > > > (fix usb first , then patch it for IP, if need be)
>     > > >
>     > > > One advice:
>     > > > Be very paranoid on your test methodology. I looked stupid a
>     couple of
>     > > > times (sorry Rolf!), because I was fooled by the USB
>     interface and/or
>     > > > the
>     > > > Canon firmware.
>     > > > When testing a new patch, I tried some settings in random (DPI ,
>     > > > colour/black-n-white etc) and reported the success/failures.
>     > > > BUT the thing is, that the Canon MF8230 firmware can go into
>     bad-mode,
>     > >
>     > > when
>     > >
>     > > > it has received some strange commands, and the following
>     scans might
>     > > > work
>     > > > slightly strange for that reason. I was even fooled by the
>     phenomenon,
>     > >
>     > > that
>     > >
>     > > > scanning a 1 by 1 cm square works, but scanning the whole A4
>     didn't.
>     > >
>     > > (Well
>     > >
>     > > > ... there WERE some differences between what worked through
>     USB and IP
>     > > > at
>     > > > this point in time. I'm guessing it was something
>     timing-critical, but I
>     > > > never dissected that last patch from Rolf which fixed it)
>     > > >
>     > > > So I started rebooting the scanner whenever I was in doubt.
>     > > > (disconnect/connect the USB interface plus move Cannon unit
>     from to
>     > > > "printer mode" and back to "scanner mode" was normally enough)
>     > > >
>     > > >
>     > > > So what do we do? / What is status?
>     > > >
>     > > > Since scanning CAN work , one could argue the back-end DOES
>     send all the
>     > > > necessary+correct commands to the printer.
>     > > > If timing is the critical parameter (backed by the fact that
>     something
>     > > > as
>     > > > stupid as enabling IP on the printer-side, suddenly makes it
>     work now
>     > > > and
>     > > > then), maybe we should try to insert an ugly time-delay
>     before every USB
>     > > > write? If that changes anything to the better, we can start
>     to hunt down
>     > > > where it is really necessary, and hopefully find a nicer
>     approach
>     > > > afterwards?
>     > > >
>     > > > Martin, are you comfortable with pulling the code out of the GIT
>     > > > repository, compile , install and experiment with inserting
>     delays?
>     > > > I think there is something called "SANE interface USB"
>     sanei_usb.c/h.
>     > >
>     > > That
>     > >
>     > > > was maybe a place to start.
>     > > >
>     > > > Louis, what is the odds of success for this approach?
>     > > >
>     > > > :-)
>     > > >
>     > > > /Troels
>     > > >
>     > > > 2015-01-03 20:43 GMT+01:00 Martin <martin.gu at intergga.ch
>     <mailto:martin.gu at intergga.ch>>:
>     > > > > Am Samstag, 3. Januar 2015, 11.16:10 schrieb Louis Lagendijk:
>     > > > > > On Fri, 2015-01-02 <tel:2015-01-02> at 22:59 +0100,
>     Martin wrote:
>     > > > > > > Hi Troels
>     > > > > > >
>     > > > > > > > *Is it USB3 (on the computer)?
>     > > > > > >
>     > > > > > > no, it is USB2
>     > > > > > >
>     > > > > > > > *Do you have access to another computer, where you
>     can try it -
>     > >
>     > > Does
>     > >
>     > > > > it
>     > > > >
>     > > > > > > > work excactly the same strange way ... ?
>     > > > > > >
>     > > > > > > No,I don't have access to another computer. But I have
>     also
>     > >
>     > > Windows 7
>     > >
>     > > > > > > installed. With Windows 7 and the Canon-software it
>     works OK.
>     > > > > > >
>     > > > > > > > *Does unit have ethernet connection / can you try
>     that way?
>     > > > > > >
>     > > > > > > Yes. With the ethernet connection the printer works.
>     Thus the
>     > > > >
>     > > > > IP-address
>     > > > >
>     > > > > > > below is correct.
>     > > > > > > But I cannot access the scanner.
>     > > > > > >
>     > > > > > >     xsane pixma:MG7500_192.168.0.3
>     > > > > > >
>     > > > > > > results in the error message "illegal argument". Same
>     thing with
>     > > > > > >
>     > > > > > >     scanimage --help -d bnjp://192.168.0.3:8612
>     <http://192.168.0.3:8612>
>     > > > > >
>     > > > > > Hi Martin
>     > > > > > If the scanner does not work on a USB port it is quite
>     unlikely to
>     > >
>     > > work
>     > >
>     > > > > > over the network: the bjnp network code just carries the USB
>     > > > > > exchange
>     > > > > > over IP.
>     > > > > > Anyhow, you can find the name with scanimage -L (but
>     make sure that
>     > >
>     > > port
>     > >
>     > > > > > 8612 is not blocked by a firewall (see the man-page for
>     sane-pixma
>     > > > > > in
>     > > > > > the latest sources from GIT. you need to enable port
>     8612 for both
>     > > > > > incoming and outgoing traffic.
>     > > > > >
>     > > > > > Louis
>     > > > >
>     > > > > Hi Louis
>     > > > >
>     > > > > The necessary ports on the firewall are open, yet
>     scanimage -L does
>     > > > > not
>     > > > > find
>     > > > > the scanner.
>     > > > >
>     > > > > But this lead to another discovery:
>     > > > > I enabled LAN on the MG7550. And although the unit is
>     connected via
>     > >
>     > > USB 2
>     > >
>     > > > > xsane sometimes works?! But with LAN disabled xsane never
>     works
>     > > > > without
>     > > > > prior
>     > > > > scanimage -T. And once xsane or scanimage -T failed all
>     succeeding
>     > >
>     > > calls
>     > >
>     > > > > fail
>     > > > > until the scanner is switched off and on again.
>     > > > >
>     > > > > Log of xsane working:
>     > > > > [sanei_debug] Setting debug level of pixma to 21.
>     > > > > [pixma] pixma is compiled with pthread support.
>     > > > > [pixma] pixma version 0.17.13
>     > > > > [pixma] pixma_collect_devices() found Canon PIXMA MG7500
>     Series at
>     > > > > libusb:001:007
>     > > > > [pixma] pixma_find_scanners() found 1 devices
>     > > > > [pixma] pixma_collect_devices() found Canon PIXMA MG7500
>     Series at
>     > > > > libusb:001:007
>     > > > > [pixma] pixma_open(): Canon PIXMA MG7500 Series
>     > > > > [pixma] *mp150_open***** This is a generation 4 scanner. 
>     *****
>     > > > > [pixma] [pixma] Reader task id=139772037314304 (threaded)
>     > > > > Reader task started
>     > > > > [pixma]
>     > > > > [pixma] pixma_scan(): start
>     > > > > [pixma]   line_size=4605 image_size=4895115 channels=3 depth=8
>     > > > > [pixma]   dpi=300x300 offset=(0,0) dimension=1535x1063
>     > > > > [pixma]   gamma_table=0x1f201e0 source=0
>     > > > > [pixma]   threshold=127 threshold_curve=0
>     > > > > [pixma]   ADF page count: 0
>     > > > > [pixma] OUT  T=58.770 len=288
>     > > > > [pixma]  00000000:3c 3f 78 6d 6c 20 76 65  72 73 69 6f 6e
>     3d 22 31
>     > > > > [pixma]  00000010:2e 30 22 20 65 6e 63 6f  64 69 6e 67 3d
>     22 75 74
>     > > > > ...
>     > > > > Log of xsane not working:
>     > > > > pixma] pixma_collect_devices() found Canon PIXMA MG7500
>     Series at
>     > > > > libusb:001:008
>     > > > > [pixma] pixma_find_scanners() found 1 devices
>     > > > > [pixma] pixma_collect_devices() found Canon PIXMA MG7500
>     Series at
>     > > > > libusb:001:008
>     > > > > [pixma] pixma_open(): Canon PIXMA MG7500 Series
>     > > > > [pixma] *mp150_open***** This is a generation 4 scanner. 
>     *****
>     > > > > [pixma] INTR T=1.249 len=32
>     > > > > [pixma]  00000000:00 00 00 01 00 00 00 00  00 00 00 00 00
>     00 00 00
>     > > > > [pixma]  00000010:00 00 00 00 00 00 00 00  00 00 00 00 00
>     00 00 00
>     > > > > [pixma]
>     > > > > [pixma] Sending time: '15/01/03 15:32'
>     > > > > [pixma] OUT  T=1.250 len=36
>     > > > > [pixma]  00000000:eb 80 00 00 00 00 00 00  00 00 00 00 00
>     00 00 14
>     > > > > [pixma]  00000010:31 35 2f 30 31 2f 30 33  20 31 35 3a 33
>     32 00 00
>     > > > > [pixma]  00000020:00 00 00 53
>     > > > > [pixma]
>     > > > > [pixma] IN   T=21.251 len=-9
>     > > > > [pixma]   ERROR: ETIMEDOUT
>     > > > > [pixma]
>     > > > > ...
>     > > > >
>     > > > > Martin
>     > > > >
>     > > > >
>     > > > > --
>     > > > > sane-devel mailing list:
>     sane-devel at lists.alioth.debian.org
>     <mailto:sane-devel at lists.alioth.debian.org>
>     > > > >
>     http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
>     > > > > Unsubscribe: Send mail with subject "unsubscribe
>     your_password"
>     > > > >
>     > > > >              to sane-devel-request at lists.alioth.debian.org
>     <mailto:sane-devel-request at lists.alioth.debian.org>
>     > >
>     > > --
>     > > sane-devel mailing list: sane-devel at lists.alioth.debian.org
>     <mailto:sane-devel at lists.alioth.debian.org>
>     > > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
>     > > Unsubscribe: Send mail with subject "unsubscribe your_password"
>     > >
>     > >              to sane-devel-request at lists.alioth.debian.org
>     <mailto:sane-devel-request at lists.alioth.debian.org>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20150404/e4cb5505/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pixma_io_sanei.c.patch
Type: text/x-diff
Size: 515 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20150404/e4cb5505/attachment-0003.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pixma_mp150.c.patch
Type: text/x-diff
Size: 813 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20150404/e4cb5505/attachment-0004.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pixma_mp810.c.patch
Type: text/x-diff
Size: 792 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20150404/e4cb5505/attachment-0005.patch>


More information about the sane-devel mailing list