Re: mustek-probs: color, preview

David Mosberger-Tang (davidm@azstarnet.com)
Fri, 30 May 1997 08:16:17 -0700

>>>>> On Fri, 30 May 1997 10:27:35 +0100 (MET DST), Andreas Gaumann <gg261@appl2.hrz.uni-siegen.de> said:

Andreas> Hello all, last week I've written that I have some probs
Andreas> with the preview-window and color-scanning on my Mustek
Andreas> MSF-6000SP (Rev. 3.12).

Andreas> Now there are no more horizontal stripes in color-images
Andreas> but therefore they are horizontal scaled by the factor 2 if
Andreas> the resolution is <=300 dpi (equal if color- or gray-mode)
Andreas> and the are all right if the resolution is >300 dpi. The
Andreas> preview-window runs only if I set the y_range.max to
Andreas> 180. But then all pictures are also scaled.

Andreas> Now here is more detailed what I have tested and find out:

Andreas> --------- 1. scanning-speed (->SIG_BIG_BUFF): ---------

Andreas> In /usr/include/scsi/sg.h I've set SIG_BIG_BUFF to
Andreas> 1024*128-512. (Before I've forgot the -512). I have not
Andreas> exactly compared the scanning-times but (subjective) I
Andreas> would say that scanning is a little bit faster.

It should be a _lot_ faster --- on the order of 4 times faster in
color mode (because there will be only a quarter of backtracks, which
take all the time) --- this is true unless your scanner has a very big
internal buffer, which could help to avoid backtracking completely.

Andreas> In /var/log/messages the entries of the preview test are

Andreas> ncr53c810-0: restart (ncr dead ?).

This is your problem. I just expanded the info in sane-mustek(5) a
bit:

ncr810 When using this controller, be sure to
configure the ker- nel
such that tagged command queueing is dis-
abled, targets are not allowed to discon-
nect, and make sure the SCSI timeout is rea-
sonably big; the default timeout for the
Linux 2.0 kernels is 10 seconds, which is
way too low when scanning large area. If
you get messages of the form "restart (ncr
dead ?)" in your /var/log/messages file or
on the system console, it's an indication
that the timeout is too short. In this
case, find the line "if (np->latetime>10)"
in file ncr53c8xx.c (normally in directory
/usr/src/linux/drivers/scsi) and change the
constant 10 to, say, 60 (one minute). Then
rebuild the kernel/module and try again.

If this isn't clear, let me know.

Andreas> I've added the line

Andreas> dev-> flags |= MUSTEK_FLAG_LD_MFS;

Andreas> in backend/mustek.c in the "attach"-function nearly line
Andreas> 324. This line is copied from the MFS-1200SP if-tree. After
Andreas> recompiling sane with

Andreas> make distclean; ./configure; make; make install

Andreas> it has two effects: 1. There are no more horizontal stripes
Andreas> in color-images. 2. All images (color, gray, lineart, ...)
Andreas> are horizontal stretched by the factor 2 if the resolution
Andreas> is in 0..300 dpi. But if the resolution is
Andreas> >=301 dpi the images are all right!!!

The scaling is most likely due to the fact that once you turn on
MUSTEK_FLAG_LD_MFS, the line-distance command is not sent to the
scanner anymore. I have observed the same scaling-effect on my
scanner when not sending the line-distance command. This makes me
doubt that setting the MUSTEK_FLAG_LD_MFS bit is the proper solution.

Could you undo all your changes and then change mustek.c around line 1409
to:

#if 0
if (s->hw->flags & MUSTEK_FLAG_LD_MFS)
fix_line_distance_mfs (s, lines_per_buffer, bpl, data, extra);
else if (s->ld.max_value)
/* need to correct for distance between r/g/b sensors: */
fix_line_distance_normal (s, lines_per_buffer, bpl, data, extra);
else
#endif
memcpy (extra, data, lines_per_buffer * bpl);

and then scan an image that has three vertical bands of pure red,
green, and blue at 100dpi and send me the resulting image? The image
doesn't have to be very large---it's enough if you get one or two
backtracks.

--david

--
Source code, list archive, and docs: http://www.azstarnet.com/~axplinux/sane/
To unsubscribe: mail -s unsubscribe sane-devel-request@listserv.azstarnet.com