sane-project-website/old-archive/2000-09/0297.html

330 wiersze
11 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: FIX: color scanning problems with snapscans in</TITLE>
<META NAME="Author" CONTENT="Lawrence Glaister (lg@jfm.bc.ca)">
<META NAME="Subject" CONTENT="Re: FIX: color scanning problems with snapscans in sane 1.0.3">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Re: FIX: color scanning problems with snapscans in sane 1.0.3</H1>
<!-- received="Thu Sep 28 17:19:27 2000" -->
<!-- isoreceived="20000929001927" -->
<!-- sent="Thu, 28 Sep 2000 17:34:52 -0700" -->
<!-- isosent="20000929003452" -->
<!-- name="Lawrence Glaister" -->
<!-- email="lg@jfm.bc.ca" -->
<!-- subject="Re: FIX: color scanning problems with snapscans in sane 1.0.3" -->
<!-- id="03ca01c029ad$179b2b20$bf0aa8c0@dufusiii" -->
<!-- inreplyto="Pine.LNX.4.21.0009281949540.497-100000@up.physik.uni-mainz.de" -->
<STRONG>From:</STRONG> Lawrence Glaister (<A HREF="mailto:lg@jfm.bc.ca?Subject=Re:%20FIX:%20color%20scanning%20problems%20with%20snapscans%20in%20sane%201.0.3&In-Reply-To=&lt;03ca01c029ad$179b2b20$bf0aa8c0@dufusiii&gt;"><EM>lg@jfm.bc.ca</EM></A>)<BR>
<STRONG>Date:</STRONG> Thu Sep 28 2000 - 17:34:52 PDT
<P>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0298.html">kwlee: "SANE 2.0"</A>
<UL>
<LI><STRONG>Previous message:</STRONG> <A HREF="0296.html">Oliver Rauch: "Re: io error on xsane"</A>
<!-- nextthread="start" -->
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#297">[ date ]</A>
<A HREF="index.html#297">[ thread ]</A>
<A HREF="subject.html#297">[ subject ]</A>
<A HREF="author.html#297">[ author ]</A>
</UL>
<HR NOSHADE><P>
<!-- body="start" -->
<P>
Hi Richard,
<BR>
I have my code full of debug entries, so a patch is not is not too practical
<BR>
at
<BR>
this time. I have included the 2 routines you need to change... cut and
<BR>
paste should get you there. Sorry if my mailer trashed the formatting.
<BR>
<P>/*
<BR>
* replace 2 routines in backend/snapscan-sources.c with
<BR>
* the following code. You can remove some of the debug code
<BR>
* if you like... it is still in use here.
<BR>
* Lawrence Glaister VE7IT <A HREF="mailto:lg@jfm.bc.ca?Subject=Re:%20FIX:%20color%20scanning%20problems%20with%20snapscans%20in%20sane%201.0.3&In-Reply-To=&lt;03ca01c029ad$179b2b20$bf0aa8c0@dufusiii&gt;">lg@jfm.bc.ca</A>
<BR>
*/
<BR>
<P><P>static SANE_Status
<BR>
FDSource_get (Source * pself, SANE_Byte * pbuf, SANE_Int * plen)
<BR>
{
<BR>
&nbsp;&nbsp;&nbsp;SANE_Status status = SANE_STATUS_GOOD;
<BR>
&nbsp;&nbsp;&nbsp;FDSource *ps = (FDSource *) pself;
<BR>
&nbsp;&nbsp;&nbsp;SANE_Int remaining = *plen;
<BR>
&nbsp;&nbsp;&nbsp;SANE_Int plen_in = *plen;
<BR>
<P>&nbsp;&nbsp;&nbsp;while (remaining &gt; 0
<BR>
&nbsp;&nbsp;&nbsp;&amp;&amp; pself-&gt;remaining (pself) &gt; 0 &amp;&amp; status == SANE_STATUS_GOOD)
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SANE_Int bytes_read = read(ps-&gt;fd, pbuf, remaining);
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (bytes_read == -1)
<BR>
&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (errno == EAGAIN)
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* No data currently available */
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DBG (1, &quot;FDSource_get EAGAIN break requested=%d
<BR>
remaining=%d\n&quot;,plen_in,remaining);
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;usleep(10000); // give the usb driver a 10ms to get more data
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;continue;
<BR>
/*============&gt; break; ===replaced by 2 lines above*/
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* It's an IO error */
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DBG (1,
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;%s: read failed: %s\n&quot;, __FUNCTION__, strerror (errno));
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;status = SANE_STATUS_IO_ERROR;
<BR>
&nbsp;&nbsp;}
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (bytes_read == 0)
<BR>
&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
<BR>
&nbsp;&nbsp;}
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ps-&gt;pss-&gt;bytes_remaining -= bytes_read;
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;remaining -= bytes_read;
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pbuf += bytes_read;
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}
<BR>
<P>&nbsp;&nbsp;&nbsp;*plen -= remaining;
<BR>
<P>&nbsp;&nbsp;&nbsp;DBG (1, &quot;FDSource_get plen_in=%d plen_out=%d\n&quot;, plen_in,*plen);
<BR>
&nbsp;&nbsp;&nbsp;return status;
<BR>
}
<BR>
<P><P><P>static SANE_Int
<BR>
RGBRouter_remaining (Source * pself)
<BR>
{
<BR>
&nbsp;&nbsp;RGBRouter *ps = (RGBRouter *) pself;
<BR>
&nbsp;&nbsp;static char me[] = &quot;RGBRouter_remaining&quot;;
<BR>
&nbsp;&nbsp;SANE_Int remaining1 =
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;(TxSource_remaining (pself) - ps-&gt;cb_size + ps-&gt;cb_line_size);
<BR>
&nbsp;&nbsp;SANE_Int remaining2 =
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;(TxSource_remaining (pself) + ps-&gt;cb_line_size - ps-&gt;pos);
<BR>
&nbsp;&nbsp;SANE_Int remaining;
<BR>
<P><P>&nbsp;&nbsp;if (ps-&gt;cb_start &lt; 0)
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;remaining = remaining1;
<BR>
&nbsp;&nbsp;else
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;remaining = remaining2;
<BR>
<P>&nbsp;&nbsp;DBG (1,
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;%s TxSource_remaining()= %d, pos= %d, cb_size =%d, cb_line_size=%d,
<BR>
cb_start=%d ch_offset[]=%d %d %d\n&quot;,
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;me, TxSource_remaining (pself), ps-&gt;pos, ps-&gt;cb_size,
<BR>
ps-&gt;cb_line_size,
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ps-&gt;cb_start, ps-&gt;ch_offset[0], ps-&gt;ch_offset[1], ps-&gt;ch_offset[2]);
<BR>
<P><P>&nbsp;&nbsp;DBG (1, &quot;%s %d %d ret=%d\n&quot;, me, remaining1, remaining2, remaining);
<BR>
&nbsp;&nbsp;if ( remaining &lt; 0 )
<BR>
&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;usleep(100000);
<BR>
&nbsp;&nbsp;remaining = 1;
<BR>
&nbsp;&nbsp;DBG(1,&quot;%s, ERROR -- setting remaining to 1 to save our ass\n&quot;,me);
<BR>
&nbsp;&nbsp;}
<BR>
&nbsp;&nbsp;return remaining;
<BR>
}
<BR>
<P><P><P>=======================================================
<BR>
Lawrence Glaister VE7IT email: <A HREF="mailto:lg@jfm.bc.ca?Subject=Re:%20FIX:%20color%20scanning%20problems%20with%20snapscans%20in%20sane%201.0.3&In-Reply-To=&lt;03ca01c029ad$179b2b20$bf0aa8c0@dufusiii&gt;">lg@jfm.bc.ca</A>
<BR>
1462 Madrona Drive <A HREF="http://jfm.bc.ca">http://jfm.bc.ca</A>
<BR>
Nanoose Bay BC Canada
<BR>
V9P 9C9
<BR>
=======================================================
<BR>
----- Original Message -----
<BR>
From: Richard B. Kreckel &lt;<A HREF="mailto:kreckel@ginac.de?Subject=Re:%20FIX:%20color%20scanning%20problems%20with%20snapscans%20in%20sane%201.0.3&In-Reply-To=&lt;03ca01c029ad$179b2b20$bf0aa8c0@dufusiii&gt;">kreckel@ginac.de</A>&gt;
<BR>
To: Lawrence Glaister &lt;<A HREF="mailto:lg@jfm.bc.ca?Subject=Re:%20FIX:%20color%20scanning%20problems%20with%20snapscans%20in%20sane%201.0.3&In-Reply-To=&lt;03ca01c029ad$179b2b20$bf0aa8c0@dufusiii&gt;">lg@jfm.bc.ca</A>&gt;
<BR>
Cc: &lt;<A HREF="mailto:sane-devel@mostang.com?Subject=Re:%20FIX:%20color%20scanning%20problems%20with%20snapscans%20in%20sane%201.0.3&In-Reply-To=&lt;03ca01c029ad$179b2b20$bf0aa8c0@dufusiii&gt;">sane-devel@mostang.com</A>&gt;
<BR>
Sent: Thursday, September 28, 2000 10:53 AM
<BR>
Subject: Re: FIX: color scanning problems with snapscans in sane 1.0.3
<BR>
<P><P><EM>&gt; On Thu, 28 Sep 2000, Lawrence Glaister wrote:
</EM><BR>
<EM>&gt; &gt; thankyou for the feedback on the change.... I am surprised you see the
</EM><BR>
same
<BR>
<EM>&gt; &gt; problems with the 1236s as I thought the problem was only related to usb
</EM><BR>
<EM>&gt; &gt; connected scanners. I did end up removing the change below and modifying
</EM><BR>
the
<BR>
<EM>&gt; &gt; code in two other places.
</EM><BR>
<EM>&gt; &gt; In backend/snapscan-sources.c RGBRouter_remaining(), I added a check for
</EM><BR>
<EM>&gt; &gt; a -ve return code and if negative, I returned 1. This is a really gross
</EM><BR>
hack
<BR>
<EM>&gt; &gt; but was required to get my scanner working at 600dpi. I know the reason
</EM><BR>
for
<BR>
<EM>&gt; &gt; the problem (scan would hang forever without moving the scanhead) and
</EM><BR>
have
<BR>
<EM>&gt; &gt; discussed it with Steve Underwood, but have not come up with a cleaner
</EM><BR>
fix
<BR>
<EM>&gt; &gt; yet. The second change was in backend/snapscan-sources.c FDSource_get().
</EM><BR>
<EM>&gt; &gt; At the bottom of the if (errno==EAGAIN) code, remove the break and add 2
</EM><BR>
<EM>&gt; &gt; lines: usleep(10000); and continue;
</EM><BR>
<EM>&gt; &gt; This will clear up the problem that the resulted in corrupted color
</EM><BR>
images
<BR>
<EM>&gt; &gt; or missing scanner data. You can return the code in RGBRouter_get() to
</EM><BR>
<EM>&gt; &gt; normal as the problem is fixed by the EAGAIN patch above.
</EM><BR>
<EM>&gt; &gt; I would like a little more feedback from snapscan users and some more
</EM><BR>
<EM>&gt; &gt; testing by myself before proposing the fixes as patches.
</EM><BR>
<EM>&gt;
</EM><BR>
<EM>&gt; Err, can you send me a patch file? Can I get this from CVS? Or from
</EM><BR>
<EM>&gt; elsewhere? I am absolutely new to the sane code and the description above
</EM><BR>
<EM>&gt; is beyond me but I would be glad to help testing things. (Sorry for being
</EM><BR>
<EM>&gt; a bit dense...)
</EM><BR>
<EM>&gt;
</EM><BR>
<EM>&gt; Regards
</EM><BR>
<EM>&gt; -richy.
</EM><BR>
<EM>&gt; --
</EM><BR>
<EM>&gt; Richard Kreckel
</EM><BR>
<EM>&gt; &lt;<A HREF="mailto:Richard.Kreckel@Uni-Mainz.DE?Subject=Re:%20FIX:%20color%20scanning%20problems%20with%20snapscans%20in%20sane%201.0.3&In-Reply-To=&lt;03ca01c029ad$179b2b20$bf0aa8c0@dufusiii&gt;">Richard.Kreckel@Uni-Mainz.DE</A>&gt;
</EM><BR>
<EM>&gt; &lt;<A HREF="http://wwwthep.physik.uni-mainz.de/~kreckel/">http://wwwthep.physik.uni-mainz.de/~kreckel/</A>&gt;
</EM><BR>
<EM>&gt;
</EM><BR>
<EM>&gt;
</EM><BR>
<EM>&gt;
</EM><BR>
<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:%20FIX:%20color%20scanning%20problems%20with%20snapscans%20in%20sane%201.0.3&In-Reply-To=&lt;03ca01c029ad$179b2b20$bf0aa8c0@dufusiii&gt;">majordomo@mostang.com</A>
</PRE>
<P><!-- body="end" -->
<HR NOSHADE>
<UL>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0298.html">kwlee: "SANE 2.0"</A>
<LI><STRONG>Previous message:</STRONG> <A HREF="0296.html">Oliver Rauch: "Re: io error on xsane"</A>
<!-- nextthread="start" -->
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#297">[ date ]</A>
<A HREF="index.html#297">[ thread ]</A>
<A HREF="subject.html#297">[ subject ]</A>
<A HREF="author.html#297">[ 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>Thu Sep 28 2000 - 17:21:58 PDT</EM>
</EM>
</SMALL>
</BODY>
</HTML>