[sane-devel] Canon MF8330

Teemu Suikki zuikkis at gmail.com
Wed Dec 14 07:43:00 UTC 2011


Hi,

it works now as expected. I attached a patch against current pixma_imageclass.c

The scanner only works through USB, not through network. Also you have
to manually place the scanner to "Remote scanner" mode, the easier
scanner-initiated scanning seems to use completely different
protocol..

But in remote scanner mode and USB, it works fine in all resolutions.

ADF required a small hack. MF8330 always feeds all papers from ADF
tray, you can't do a single page scan. It's like that on Windows as
well. Original pixma_imageclass aborted the session after each page;
this made the scanner feed through rest of the pages without scanning
them, and it would only accept a new session after that. Now
abort_session() is only called after last page has been scanned.. This
works fine if you really scan all the pages.

All changes should only affect MF8330, so this should be a safe
patch.. If someone wants to apply this to the developer git, go ahead.

--
Teemu


--
Teemu


2011/12/3 Teemu Suikki <zuikkis at gmail.com>:
> Still one problem, ADF only works for one page. The problem is that in
> windows all ADF pages are scanned inside single session. Sane does
> abort_session after first page, then fails with EBUSY in the next
> start_session...  The scanner is busy because it is feeding the rest
> of the pages, it accepts a new session only after it has finished
> feeding the pages.
>
> I tried fixing this by checking ADF status and only do abort_session()
> if ADF has no paper, and also ignore start_session return code. This
> works very well with scanimage, batch mode scans everything correctly
> and even without batch you can do single page scans..
>
> But Ubuntu's "Simple Scan" utility fails after first scanned page..
> Don't know why.
>
> --
> Teemu
>
> 2011/12/3 Teemu Suikki <zuikkis at gmail.com>:
>> Ok,
>>
>> sorry for talking to myself. :)
>>
>> It works now 100%. All resolutions work etc.
>>
>> The problem was that in pixma_imageclass.c there is this define:
>>
>> #define IMAGE_BLOCK_SIZE (0xffff)
>>
>> MF8330 sends 0x1fff8 sized blocks, they don't fit. I increased
>> IMAGE_BLOCK_SIZE to 0x1fff and it's ok now. Should this be device
>> dependant?
>>
>> There's the current pixma_imageclass.c and a diff to the latest git
>> version in http://zuik.org/sane/
>>
>> If anyone is listening and interested, you can add my changes to git..
>>
>> --
>> Teemu
>>
>>
>>
>>
>> 2011/12/3 Teemu Suikki <zuikkis at gmail.com>:
>>> Hmm, no. I can scan any part of the paper, as long as the scan size is
>>> so small that the data fits under 65536 bytes.  Anything higher
>>> fails..
>>>
>>> I don't understand what happens, it all looks fine in the logs, until this:
>>>
>>> [pixma] read_image():reader task closed the pipe:0 bytes received,
>>> 1681920 bytes expected
>>> scanimage: sane_read: Error during device I/O
>>>
>>> This happens exactly when received data hits the 65536 bytes mark..
>>>
>>> Do other devices use >64k chunk sizes? is it possible that there is a
>>> 16bit counter used somewhere where it shouldn't..
>>>
>>> --
>>> Teemu
>>>
>>>
>>> 2011/12/3 Teemu Suikki <zuikkis at gmail.com>:
>>>> Hi,
>>>>
>>>> I tried scanning smaller area, with
>>>>
>>>> SANE_DEBUG_PIXMA=25 scanimage -l100 -t100 -x50 -y50  --format=tiff
>>>>>test.tif 2>debug
>>>>
>>>> And surprisingly it worked! :) Perfect scan. So probably the "full
>>>> page" settings are somehow out of bounds, I need to figure that out.
>>>>
>>>> The scanner was "stuck" for maybe 30 seconds after the scan, saying
>>>> "scanning" even when the scan had already competed. I noticed that
>>>> windows driver always sends cmd_abort_session after scanning; adding
>>>> this fixed it on Sane as well.
>>>>
>>>> Anyway, looks very promising now. I updated http://zuik.org/sane/ with
>>>> the latest files.
>>>>
>>>> --
>>>> Teemu
>>>>
>>>> 2011/12/3 Teemu Suikki <zuikkis at gmail.com>:
>>>>> I now started digging this myself with UsbSnoop. MF8330 really is
>>>>> using this 0xd460 instead of 0xd420, as data transfer command.. I
>>>>> couldn't find any other big differences.
>>>>>
>>>>> I modified pixma_imageclass.c to use d460.. it almost seems to work,
>>>>> but there isn't enough data coming from the scanner. For full A4 scan
>>>>> at 75dpi, scanner only sends about 65536bytes of data total.. After
>>>>> that, scanimage reports:
>>>>>
>>>>> [pixma] read_image():reader task closed the pipe:0 bytes received,
>>>>> 1683840 bytes expected
>>>>> scanimage: sane_read: Error during device I/O
>>>>>
>>>>> Why does it say 0 bytes, it's actually 65536?
>>>>>
>>>>> Also in the log there are many "empty"  data packets, that are not
>>>>> there on windows log:
>>>>>
>>>>> [pixma] OUT  T=4.841 len=11
>>>>> [pixma]  00000000:d4 60 00 00 00 00 00 00  04 00 06
>>>>> [pixma]
>>>>> [pixma] IN   T=4.845 len=8
>>>>> [pixma]  00000000:06 06 00 00 00 00 00 00
>>>>>
>>>>>
>>>>> I have the UsbSnoop.log, sane debug output and the modified source available at:
>>>>> http://zuik.org/sane/
>>>>>
>>>>> --
>>>>> Teemu Suikki
>>>>> http://www.ksportfinland.com
>>>>> http://www.z-power.fi/
>>>>
>>>>
>>>>
>>>> --
>>>> Teemu Suikki
>>>> http://www.ksportfinland.com
>>>> http://www.z-power.fi/
>>>
>>>
>>>
>>> --
>>> Teemu Suikki
>>> http://www.ksportfinland.com
>>> http://www.z-power.fi/
>>
>>
>>
>> --
>> Teemu Suikki
>> http://www.ksportfinland.com
>> http://www.z-power.fi/
>
>
>
> --
> Teemu Suikki
> http://www.ksportfinland.com
> http://www.z-power.fi/



-- 
Teemu Suikki
http://www.ksportfinland.com
http://www.z-power.fi/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pixma_imageclass.diff
Type: text/x-patch
Size: 4916 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20111214/b73c883a/attachment.bin>


More information about the sane-devel mailing list