[sane-devel] Sane and microtek2 hangs on large scans

abel deuring a.deuring@satzbau-gmbh.de
Mon, 23 Sep 2002 19:47:53 +0200


Edenyard wrote:
>    Please could someone help me solve this problem. I have a Microtek
> Scanmaker 336 or V310 (badged Philips) connected via the parallel port
> to my P166 (64Mb RAM) running Slackware 8.1. I have kernel 2.4.18 patched
> with the ppscsi and onscsi patches. I'm running scanimage V1.0.8 and
> microtek2 backend V0.95.
> 
>    The system recognises the scanner as /dev/sg1 and I can make scans
> after a fashion. If I select color at 72 DPI, I can scan a whole sheet
> of A4. If I select LineArt at 150 DPI, it works too. However, in color
> mode, I cannot scan more than about half an A4 sheet at 150 DPI; at
> 300DPI, it's down to just a few square inches. If I exceed these
> limits, the scanner's head seems to oscillate back and forth over about
> a quarter-inch for about 40 seconds. Then the scanner stops, its green
> LED goes out; after a few more seconds the prompt returns and I find
> that I get a scan file of exactly 37 bytes. The scanner has to be
> powered down and up again to reset it. When I succeed with the smaller
> areas, the picture quality appears to be fine with no visible errors.
> 
>    Originally, I used this scanner with windows 3.1 at 300 DPI to scan a
> whole A4 sheet in colour, so I know that the hardware is capable of
> doing this. It seems as though something runs out of space under Linux,
> though. I'm sure it isn't disk space - there's over 1Gb of spare space
> on the partition. Could it be memory?
> 
>    I read somewhere that I should add to /etc/profile the line
> "export SANE_SG_BUFFERSIZE=1048576". I tried that and rebooted but it
> made no real difference. I tried varying the number in powers of 2
> downwards once or twice but that didn't cure the problem either.

Edenyard,

I doesn't seem very likely that the SG buffer size is related to your 
problem:

The  A4 size color scan with 72 dpi, which works, has asize of 
3*210*297*72*72/(25.4*25.4) = 1503609 bytes, so it will need at least 
two READ commands even with an SG buffer of 1 MB. And I am not sure, if 
the ppscsi driver will indeed allow to allocate such a large buffer. The 
environment variable SANE_SG_BUFFER_SIZE simply changes the _preferred_ 
buffer size, and you can be sure that the Sane backends (except the Nec, 
Mustek, Pie, Sharp and Umax backends) do not use a larger buffer than 
specified by SANE_SG_BUFFER_SIZE -- but depending on the capabilitites 
of the adapter driver, the actual buffer size may be smaller.

Can you run another test with SANE_DEBUG_SANEI_SCSI=255 and 
SANE_DEBUG_MICROTEK2=255 ? The debug output perhaps gives us a better 
clue about the problem.

As Henning already wrote, you don't need to set these variables in 
/etc/profile, but you can set them on the command line. Another way to 
this, is this:

export SANE_DEBUG_SANEI_SCSI=255
export SANE_DEBUG_MICROTEK2=255
xsane 2> scan.log
(or "xscanimage 2> scanlog" or "scanimage [options] 2> scan.log")

The file scan.log will contain the debug output

Abel