sane-project-website/old-archive/2000-02/0174.html

482 wiersze
14 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>sane-devel: Re: Missing mustek backend maintainer, got patches?</TITLE>
<META NAME="Author" CONTENT="Henning Meier-Geinitz (henningmg@gmx.de)">
<META NAME="Subject" CONTENT="Re: Missing mustek backend maintainer, got patches?">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Re: Missing mustek backend maintainer, got patches?</H1>
<!-- received="Wed Feb 16 23:34:21 2000" -->
<!-- isoreceived="20000217073421" -->
<!-- sent="Thu, 17 Feb 2000 00:07:39 +0100" -->
<!-- isosent="20000216230739" -->
<!-- name="Henning Meier-Geinitz" -->
<!-- email="henningmg@gmx.de" -->
<!-- subject="Re: Missing mustek backend maintainer, got patches?" -->
<!-- id="20000217000739.B20942@hmg1.vortex.robin.de" -->
<!-- inreplyto="200002150129.JAA26331@minerva.ee.uwa.edu.au" -->
<STRONG>From:</STRONG> Henning Meier-Geinitz (<A HREF="mailto:henningmg@gmx.de?Subject=Re:%20Missing%20mustek%20backend%20maintainer,%20got%20patches?&In-Reply-To=&lt;20000217000739.B20942@hmg1.vortex.robin.de&gt;"><EM>henningmg@gmx.de</EM></A>)<BR>
<STRONG>Date:</STRONG> Wed Feb 16 2000 - 15:07:39 PST
<P>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0175.html">Karl Heinz Kremer: "Re: 'scanimage -T' ?"</A>
<UL>
<LI><STRONG>Previous message:</STRONG> <A HREF="0173.html">Henning Meier-Geinitz: "Re: New CVS snapshot 20000213"</A>
<LI><STRONG>In reply to:</STRONG> <A HREF="0142.html">Petter Reinholdtsen: "Missing mustek backend maintainer, got patches?"</A>
<!-- nextthread="start" -->
<LI><STRONG>Next in thread:</STRONG> <A HREF="0235.html">Petter Reinholdtsen: "Re: Missing mustek backend maintainer, got patches?"</A>
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#174">[ date ]</A>
<A HREF="index.html#174">[ thread ]</A>
<A HREF="subject.html#174">[ subject ]</A>
<A HREF="author.html#174">[ author ]</A>
</UL>
<HR NOSHADE><P>
<!-- body="start" -->
<P>
Hi,
<BR>
<P><EM>&gt; I am not qualified to apply and test these patches (I don't have a
</EM><BR>
<EM>&gt; supported scanner), and would really like someone else to keep the
</EM><BR>
<EM>&gt; mustek backend up to date. What should I do?
</EM><BR>
<P>I don't know much about the other Mustek scanners and don't have any
<BR>
documentation so I'm not sure if I can help here.
<BR>
<P>As a interim solution I have reworked my patch a bit to avoid possible
<BR>
problems with other (non 600 II N) scanners as I don't want to break
<BR>
anything. So the bug &quot;cancel during scan freezes scanner&quot; isn't fixed. The
<BR>
remaining patch fixes a timeout problem for 600 II Ns and adds (working)
<BR>
color support for 600 II Ns firmware 1.01 (including documentation updates).
<BR>
It doesn't touch anything for non parallel port scanners so this should be
<BR>
ok.
<BR>
<P>If this patch is included I could test the Mustek backend on a different
<BR>
Mustek scanner (belonging to a friend, IIRC a mfs 6000 cz SCSI scanner).
<BR>
I am on vacation next week so I can't do this before 2000-02-28.
<BR>
<P>Anybody out there using the Mustek backend who could test the patch for not
<BR>
breaking anything?
<BR>
<P>Some more information about the Mustek 600 II N can be found here:
<BR>
<A HREF="http://hmg.home.pages.de/sane/">http://hmg.home.pages.de/sane/</A>
<BR>
<P>Bye, Henning
<BR>
<P>cd sane-devel-20000213;patch -p1 &lt;/path/to/patch
<BR>
<P>----------------------- snip ------------------------------
<BR>
diff -u -r sane-1.0.1/backend/mustek.c sane-1.0.1.patched/backend/mustek.c
<BR>
--- sane-1.0.1/backend/mustek.c Sat Apr 3 07:02:21 1999
<BR>
+++ sane-1.0.1.patched/backend/mustek.c Wed Jan 26 23:07:08 2000
<BR>
@@ -1452,7 +1452,8 @@
<BR>
&nbsp;
<BR>
&nbsp;&nbsp;&nbsp;if (s-&gt;fd &gt;= 0)
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
<BR>
- if (status == SANE_STATUS_CANCELLED)
<BR>
+ if ((status == SANE_STATUS_CANCELLED) &amp;&amp;
<BR>
+ !(s-&gt;hw-&gt;flags &amp; MUSTEK_FLAG_PP))
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DBG(4, &quot;do_stop: waiting for scanner to become ready\n&quot;);
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dev_wait_ready (s);
<BR>
@@ -1509,7 +1510,9 @@
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* According to Andreas Czechanowski, the line-distance
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;values returned for the parallel-port scanners are
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;garbage, so we have to fix things up manually. Not
<BR>
- good. */
<BR>
+ good.
<BR>
+ This is true for firmware 2.00. PP scanners with firmware
<BR>
+ 1.01 don't need this fix. */
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (peak_res == 600)
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (res &lt; 51)
<BR>
@@ -1851,9 +1854,10 @@
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
<BR>
&nbsp;}
<BR>
&nbsp;
<BR>
+/* Mustek 600 II N firmware 2.00 */
<BR>
&nbsp;static int
<BR>
-fix_line_distance_pp (Mustek_Scanner *s, int num_lines, int bpl,
<BR>
- u_int8_t *raw, u_int8_t *out)
<BR>
+fix_line_distance_pp_2 (Mustek_Scanner *s, int num_lines, int bpl,
<BR>
+ u_int8_t *raw, u_int8_t *out)
<BR>
&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;u_int8_t *out_end, *out_ptr, *raw_end = raw + num_lines * bpl;
<BR>
&nbsp;&nbsp;&nbsp;int c, num_saved_lines, line;
<BR>
@@ -1925,6 +1929,85 @@
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
<BR>
&nbsp;}
<BR>
&nbsp;
<BR>
+/* Mustek 600 II N firmware 1.01; the last lines returned are ...rgbrgbrgb
<BR>
+ not e.g. ...rgbgbgbbbbb so some lines are missing. The color sequence
<BR>
+ is different form the one of 2.0.
<BR>
+ Henning Meier-Geinitz &lt;<A HREF="mailto:hmg@gmx.de?Subject=Re:%20Missing%20mustek%20backend%20maintainer,%20got%20patches?&In-Reply-To=&lt;20000217000739.B20942@hmg1.vortex.robin.de&gt;">hmg@gmx.de</A>&gt; */
<BR>
+static int
<BR>
+fix_line_distance_pp_1 (Mustek_Scanner *s, int num_lines, int bpl,
<BR>
+ u_int8_t *raw, u_int8_t *out)
<BR>
+{
<BR>
+ u_int8_t *out_end, *out_ptr, *raw_end = raw + num_lines * bpl;
<BR>
+ int c, num_saved_lines, line;
<BR>
+
<BR>
+ if (!s-&gt;ld.buf[0])
<BR>
+ {
<BR>
+ /* This buffer must be big enough to hold maximum line distance
<BR>
+ times max_bpl bytes. The maximum line distance for 600 dpi
<BR>
+ parallel-port scanners is 23. We use 32 to play it safe... */
<BR>
+ DBG(2, &quot;fix_line_distance_pp: allocating temp buffer of %d*%d bytes\n&quot;,
<BR>
+ 32, bpl);
<BR>
+ s-&gt;ld.buf[0] = malloc (32 * (long) bpl);
<BR>
+ if (!s-&gt;ld.buf[0])
<BR>
+ {
<BR>
+ DBG(1, &quot;fix_line_distance_pp: failed to malloc temporary buffer\n&quot;);
<BR>
+ return 0;
<BR>
+ }
<BR>
+ }
<BR>
+
<BR>
+ num_saved_lines = s-&gt;ld.index[0] - s-&gt;ld.index[1];
<BR>
+ if (num_saved_lines &gt; 0)
<BR>
+ /* restore the previously saved lines: */
<BR>
+ memcpy (out, s-&gt;ld.buf[0], num_saved_lines * bpl);
<BR>
+
<BR>
+ while (1)
<BR>
+ {
<BR>
+ if (++s-&gt;ld.lmod3 &gt;= 3)
<BR>
+ s-&gt;ld.lmod3 = 0;
<BR>
+
<BR>
+ c = s-&gt;ld.lmod3;
<BR>
+ if (s-&gt;ld.index[c] &lt; 0)
<BR>
+ ++s-&gt;ld.index[c];
<BR>
+ else
<BR>
+ {
<BR>
+ s-&gt;ld.quant[c] += s-&gt;ld.peak_res;
<BR>
+ if (s-&gt;ld.quant[c] &gt; s-&gt;ld.max_value)
<BR>
+ {
<BR>
+ s-&gt;ld.quant[c] -= s-&gt;ld.max_value;
<BR>
+ line = s-&gt;ld.index[c]++ - s-&gt;ld.ld_line;
<BR>
+ out_ptr = out + line * bpl + c;
<BR>
+ out_end = out_ptr + bpl;
<BR>
+ while (out_ptr != out_end)
<BR>
+ {
<BR>
+ *out_ptr = *raw++;
<BR>
+ out_ptr += 3;
<BR>
+ }
<BR>
+
<BR>
+ if (raw &gt;= raw_end)
<BR>
+ {
<BR>
+ DBG (1, &quot;fix_line_distance_pp: lmod3=%d, index=(%d,%d,%d)\n&quot;,
<BR>
+ s-&gt;ld.lmod3,
<BR>
+ s-&gt;ld.index[0], s-&gt;ld.index[1], s-&gt;ld.index[2]);
<BR>
+ num_lines = s-&gt;ld.index[1] - s-&gt;ld.ld_line;
<BR>
+
<BR>
+ /* copy away the lines with at least one missing
<BR>
+ color component, so that we can interleave them
<BR>
+ with new scan data on the next call */
<BR>
+ num_saved_lines = s-&gt;ld.index[0] - s-&gt;ld.index[1];
<BR>
+ memcpy (s-&gt;ld.buf[0], out + num_lines * bpl,
<BR>
+ num_saved_lines * bpl);
<BR>
+
<BR>
+ /* notice the number of lines we processed */
<BR>
+ s-&gt;ld.ld_line = s-&gt;ld.index[1];
<BR>
+ /* return number of complete (r+g+b) lines */
<BR>
+ return num_lines;
<BR>
+ }
<BR>
+ }
<BR>
+ }
<BR>
+ }
<BR>
+}
<BR>
+
<BR>
+
<BR>
&nbsp;static int
<BR>
&nbsp;fix_line_distance_se (Mustek_Scanner *s, int num_lines, int bpl,
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;u_int8_t *raw, u_int8_t *out)
<BR>
@@ -2481,7 +2564,17 @@
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (s-&gt;ld.max_value)
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (s-&gt;hw-&gt;flags &amp; MUSTEK_FLAG_PP)
<BR>
- num_lines = fix_line_distance_pp (s, num_lines, bpl, data, extra);
<BR>
+ {
<BR>
+ if (s-&gt;hw-&gt;flags &amp; MUSTEK_FLAG_LD_FIX)
<BR>
+ /* If we need manual line distance values it's probably a
<BR>
+ scanner with firmware 2.00 */
<BR>
+ num_lines = fix_line_distance_pp_2 (s, num_lines, bpl, data,
<BR>
+ extra);
<BR>
+ else
<BR>
+ /* Otherwise it's firmware 1.01 or some other */
<BR>
+ num_lines = fix_line_distance_pp_1 (s, num_lines, bpl, data,
<BR>
+ extra);
<BR>
+ }
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fix_line_distance_normal (s, num_lines, bpl, data, extra);
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
<BR>
diff -u -r sane-1.0.1/backend/mustek.desc sane-1.0.1.patched/backend/mustek.desc
<BR>
--- sane-1.0.1/backend/mustek.desc Fri Oct 30 07:23:33 1998
<BR>
+++ sane-1.0.1.patched/backend/mustek.desc Wed Jan 26 23:04:24 2000
<BR>
@@ -41,6 +41,8 @@
<BR>
&nbsp;:comment &quot;1 pass; (f/w == ? ; scsi id C03 S10IDW)&quot;
<BR>
&nbsp;:model &quot;SE-12000SP&quot;
<BR>
&nbsp;:comment &quot;1 pass; (f/w == 1.01; scsi id C06 S12IDW)&quot;
<BR>
-
<BR>
+:model &quot;600 II N&quot;
<BR>
+:comment &quot;1 pass; (f/w = 1.01 &amp; 2.00; non SCSI; id MFC-06000CZ)&quot;
<BR>
+:url &quot;<A HREF="http://hmg.home.pages.de/sane/">http://hmg.home.pages.de/sane/</A>&quot;
<BR>
&nbsp;; :comment and :url specifiers are optional after :mfg, :model, :desc,
<BR>
&nbsp;; and at the top-level.
<BR>
diff -u -r sane-1.0.1/doc/sane-mustek.man sane-1.0.1.patched/doc/sane-mustek.man
<BR>
--- sane-1.0.1/doc/sane-mustek.man Fri Oct 30 07:22:19 1998
<BR>
+++ sane-1.0.1.patched/doc/sane-mustek.man Wed Jan 26 23:04:24 2000
<BR>
@@ -95,7 +95,8 @@
<BR>
&nbsp;controllers (notably the ncr810 controller under Linux). If color
<BR>
&nbsp;scans have horizontal stripes and/or the colors are off, then it's
<BR>
&nbsp;likely that your controller suffers from this problem. Turning on
<BR>
-this option usually fixes the problem.
<BR>
+this option usually fixes the problem. The parallel port scanner 600
<BR>
+II N is a special case, see section PARALLEL PORT SCANNERS below.
<BR>
&nbsp;
<BR>
&nbsp;Option
<BR>
&nbsp;.B lineart-fix
<BR>
@@ -196,6 +197,13 @@
<BR>
&nbsp;brightness. However, the first image scanned after such a shutdown may
<BR>
&nbsp;have stripes and appear to be over-exposed. When this happens, just
<BR>
&nbsp;take another scan, and the image will be fine.
<BR>
+.PP
<BR>
+If your images have horizontal stripes in color mode, check option
<BR>
+linedistance-fix (see above). Apply this option for a scanner with
<BR>
+firmware version 2.00 and disable it for version 1.01. Please contact
<BR>
+the mailing list
<BR>
+.IR sane\<A HREF="mailto:-devel@mostang.com?Subject=Re:%20Missing%20mustek%20backend%20maintainer,%20got%20patches?&In-Reply-To=&lt;20000217000739.B20942@hmg1.vortex.robin.de&gt;">-devel@mostang.com</A>
<BR>
+if you have a 600 II N with a different firmware version.
<BR>
&nbsp;.SH FILES
<BR>
&nbsp;.TP
<BR>
&nbsp;.I @CONFIGDIR@/mustek.conf
<BR>
<P><P><P><P><PRE>
--
Source code, list archive, and docs: <A HREF="http://www.mostang.com/sane/">http://www.mostang.com/sane/</A>
To unsubscribe: echo unsubscribe sane-devel | mail <A HREF="mailto:majordomo@mostang.com?Subject=Re:%20Missing%20mustek%20backend%20maintainer,%20got%20patches?&In-Reply-To=&lt;20000217000739.B20942@hmg1.vortex.robin.de&gt;">majordomo@mostang.com</A>
</PRE>
<P><!-- body="end" -->
<HR NOSHADE>
<UL>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0175.html">Karl Heinz Kremer: "Re: 'scanimage -T' ?"</A>
<LI><STRONG>Previous message:</STRONG> <A HREF="0173.html">Henning Meier-Geinitz: "Re: New CVS snapshot 20000213"</A>
<LI><STRONG>In reply to:</STRONG> <A HREF="0142.html">Petter Reinholdtsen: "Missing mustek backend maintainer, got patches?"</A>
<!-- nextthread="start" -->
<LI><STRONG>Next in thread:</STRONG> <A HREF="0235.html">Petter Reinholdtsen: "Re: Missing mustek backend maintainer, got patches?"</A>
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#174">[ date ]</A>
<A HREF="index.html#174">[ thread ]</A>
<A HREF="subject.html#174">[ subject ]</A>
<A HREF="author.html#174">[ author ]</A>
</UL>
<!-- trailer="footer" -->
<HR NOSHADE>
<P>
<SMALL>
<EM>
This archive was generated by <A HREF="http://www.hypermail.org/">hypermail 2b29</A>
: <EM>Wed Feb 16 2000 - 23:38:40 PST</EM>
</EM>
</SMALL>
</BODY>
</HTML>