sane-project-website/old-archive/2000-05/0187.html

186 wiersze
6.9 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: Correct Network Scanner Syntax? (a question)</TITLE>
<META NAME="Author" CONTENT="abel deuring (a.deuring@satzbau-gmbh.de)">
<META NAME="Subject" CONTENT="Re: Correct Network Scanner Syntax? (a question)">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Re: Correct Network Scanner Syntax? (a question)</H1>
<!-- received="Sat May 27 11:56:00 2000" -->
<!-- isoreceived="20000527185600" -->
<!-- sent="Sat, 27 May 2000 21:00:37 +0200" -->
<!-- isosent="20000527190037" -->
<!-- name="abel deuring" -->
<!-- email="a.deuring@satzbau-gmbh.de" -->
<!-- subject="Re: Correct Network Scanner Syntax? (a question)" -->
<!-- id="39301B55.3BFF9921@satzbau-gmbh.de" -->
<!-- inreplyto="m27lcg6f5t.fsf@boreas.southchinaseas" -->
<STRONG>From:</STRONG> abel deuring (<A HREF="mailto:a.deuring@satzbau-gmbh.de?Subject=Re:%20Correct%20Network%20Scanner%20Syntax?%20(a%20question)&In-Reply-To=&lt;39301B55.3BFF9921@satzbau-gmbh.de&gt;"><EM>a.deuring@satzbau-gmbh.de</EM></A>)<BR>
<STRONG>Date:</STRONG> Sat May 27 2000 - 12:00:37 PDT
<P>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0188.html">Timothy Reaves: "Re: Xsane &amp; no devices"</A>
<UL>
<LI><STRONG>Previous message:</STRONG> <A HREF="0186.html">Steve Sheriff: "Re: Xsane &amp; no devices"</A>
<LI><STRONG>In reply to:</STRONG> <A HREF="0178.html">John Fremlin: "Re: Correct Network Scanner Syntax? (a question)"</A>
<!-- nextthread="start" -->
<LI><STRONG>Next in thread:</STRONG> <A HREF="0192.html">John Fremlin: "Re: Correct Network Scanner Syntax? (a question)"</A>
<LI><STRONG>Next in thread:</STRONG> <A HREF="0170.html">Petter Reinholdtsen: "Re: Correct Network Scanner Syntax?"</A>
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#187">[ date ]</A>
<A HREF="index.html#187">[ thread ]</A>
<A HREF="subject.html#187">[ subject ]</A>
<A HREF="author.html#187">[ author ]</A>
</UL>
<HR NOSHADE><P>
<!-- body="start" -->
<P>
John Fremlin wrote:
<BR>
<P><EM>&gt; Hmm. I don't know if Oliver added anything to my version, but here is
</EM><BR>
<EM>&gt; what I sent him (relative to sane-cvs). The patch to
</EM><BR>
<EM>&gt; sanei/sanei_scsi.c should not be necessary if sane is setup properly,
</EM><BR>
<EM>&gt; and is probably incorrect wrt other sane backends.
</EM><BR>
<EM>&gt;
</EM><BR>
<EM>&gt; Index: sanei/sanei_scsi.c
</EM><BR>
<EM>&gt; ===================================================================
</EM><BR>
<EM>&gt; RCS file: /cvsroot/external/sane/sanei/sanei_scsi.c,v
</EM><BR>
<EM>&gt; retrieving revision 1.2
</EM><BR>
<EM>&gt; diff -u -r1.2 sanei_scsi.c
</EM><BR>
<EM>&gt; --- sanei_scsi.c 2000/03/05 13:57:15 1.2
</EM><BR>
<EM>&gt; +++ sanei_scsi.c 2000/05/19 17:25:19
</EM><BR>
<EM>&gt; @@ -1302,13 +1302,15 @@
</EM><BR>
<EM>&gt; /* make sure that we got as much memory as we wanted, otherwise
</EM><BR>
<EM>&gt; the backend might be confused
</EM><BR>
<EM>&gt; */
</EM><BR>
<EM>&gt; - if (real_buffersize != wanted_buffersize)
</EM><BR>
<EM>&gt; + /*
</EM><BR>
<EM>&gt; + if (real_buffersize != wanted_buffersize)
</EM><BR>
<EM>&gt; {
</EM><BR>
<EM>&gt; DBG(1, &quot;sanei_scsi_open: could not allocate SG buffer memory &quot;
</EM><BR>
<EM>&gt; &quot;wanted: %i got: %i\n&quot;, wanted_buffersize, real_buffersize);
</EM><BR>
<EM>&gt; sanei_scsi_close(*fdp);
</EM><BR>
<EM>&gt; return SANE_STATUS_NO_MEM;
</EM><BR>
<EM>&gt; }
</EM><BR>
<EM>&gt; + */
</EM><BR>
<P>If this patch to sanei_scsi.c works for your setup (Microtek USB
<BR>
scanner, if my memory is right), it's fine. But it might break the
<BR>
memory management for other backends which use the function
<BR>
sanei_scsi_open. Most backends open the device file for scanner access
<BR>
more than once, and with newer versions of the Linux SG driver there is
<BR>
no guaraantee that the driver is able to allocate as much memory as
<BR>
requested. A backend may allocate some buffers based on the value of
<BR>
sanei_scsi_max_request_size during initialisation (function attach, for
<BR>
example). If the value of sanei_scsi_max_request_size increases during
<BR>
another call to sanei_scsi_open, the backend might write beyond the end
<BR>
of those buffers.
<BR>
<P>Therefore, it would be better to work with the environment variable
<BR>
SANE_SG_BUFFERSIZE, or to use the configure-option
<BR>
--enable-scsibuffersize.
<BR>
<P>But even this will cause conflicts, if somebody tries to use Sane &quot;out
<BR>
of the box&quot; from one of the big Linux distributions. Either
<BR>
--enable-scsibuffersize is set to a small value like 32k, so that the
<BR>
microtek USB scanners work. In this case people would get a serious
<BR>
performance degradation for some scanners without setting
<BR>
SANE_SG_BUFFERSIZE. Or the default buffer size is useful for most
<BR>
scanners. Then, users of a USB scanner _must_ set the enviroment
<BR>
variable. Some of them will forget to do so, I'm afraid.
<BR>
<P>To remove this conflict, I suggest to use sanei_scsi_open_extended
<BR>
instead of sanei_scsi_open in those backends which support USB scanners.
<BR>
Practically, this means to get rid of sanei_scsi_max_request_size, and
<BR>
to check all buffer sizes after each call to sanei_scsi_open_extended,
<BR>
or to allocate all buffers after this call. The Umax, Mustek and Sharp
<BR>
backends show how this can be done.
<BR>
<P>Abel
<BR>
<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:%20Correct%20Network%20Scanner%20Syntax?%20(a%20question)&In-Reply-To=&lt;39301B55.3BFF9921@satzbau-gmbh.de&gt;">majordomo@mostang.com</A>
</PRE>
<P><!-- body="end" -->
<HR NOSHADE>
<UL>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0188.html">Timothy Reaves: "Re: Xsane &amp; no devices"</A>
<LI><STRONG>Previous message:</STRONG> <A HREF="0186.html">Steve Sheriff: "Re: Xsane &amp; no devices"</A>
<LI><STRONG>In reply to:</STRONG> <A HREF="0178.html">John Fremlin: "Re: Correct Network Scanner Syntax? (a question)"</A>
<!-- nextthread="start" -->
<LI><STRONG>Next in thread:</STRONG> <A HREF="0192.html">John Fremlin: "Re: Correct Network Scanner Syntax? (a question)"</A>
<LI><STRONG>Next in thread:</STRONG> <A HREF="0170.html">Petter Reinholdtsen: "Re: Correct Network Scanner Syntax?"</A>
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#187">[ date ]</A>
<A HREF="index.html#187">[ thread ]</A>
<A HREF="subject.html#187">[ subject ]</A>
<A HREF="author.html#187">[ 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>Sat May 27 2000 - 11:59:36 PDT</EM>
</EM>
</SMALL>
</BODY>
</HTML>