kopia lustrzana https://gitlab.com/sane-project/website
260 wiersze
7.6 KiB
HTML
260 wiersze
7.6 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: SG_BIG_BUFF setting in Problems incorrect</TITLE>
|
|
<META NAME="Author" CONTENT="abel deuring (a.deuring@satzbau-gmbh.de)">
|
|
<META NAME="Subject" CONTENT="Re: SG_BIG_BUFF setting in Problems incorrect">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
|
|
<H1>Re: SG_BIG_BUFF setting in Problems incorrect</H1>
|
|
<!-- received="Fri Feb 4 16:53:25 2000" -->
|
|
<!-- isoreceived="20000205005325" -->
|
|
<!-- sent="Sat, 05 Feb 2000 01:39:11 +0100" -->
|
|
<!-- isosent="20000205003911" -->
|
|
<!-- name="abel deuring" -->
|
|
<!-- email="a.deuring@satzbau-gmbh.de" -->
|
|
<!-- subject="Re: SG_BIG_BUFF setting in Problems incorrect" -->
|
|
<!-- id="389B712F.6CB9D7F6@satzbau-gmbh.de" -->
|
|
<!-- inreplyto="389ABAF9.B925D70F@satzbau-gmbh.de" -->
|
|
<STRONG>From:</STRONG> abel deuring (<A HREF="mailto:a.deuring@satzbau-gmbh.de?Subject=Re:%20SG_BIG_BUFF%20setting%20in%20Problems%20incorrect&In-Reply-To=<389B712F.6CB9D7F6@satzbau-gmbh.de>"><EM>a.deuring@satzbau-gmbh.de</EM></A>)<BR>
|
|
<STRONG>Date:</STRONG> Fri Feb 04 2000 - 16:39:11 PST
|
|
<P>
|
|
<!-- next="start" -->
|
|
<LI><STRONG>Next message:</STRONG> <A HREF="0046.html">Oliver Rauch: "scsi buffer size handling for backends"</A>
|
|
<UL>
|
|
<LI><STRONG>Previous message:</STRONG> <A HREF="0044.html">Doug Alcorn: "Re: lunatic listserver"</A>
|
|
<LI><STRONG>In reply to:</STRONG> <A HREF="0035.html">abel deuring: "Re: SG_BIG_BUFF setting in Problems incorrect"</A>
|
|
<!-- nextthread="start" -->
|
|
<!-- reply="end" -->
|
|
<LI><STRONG>Messages sorted by:</STRONG>
|
|
<A HREF="date.html#45">[ date ]</A>
|
|
<A HREF="index.html#45">[ thread ]</A>
|
|
<A HREF="subject.html#45">[ subject ]</A>
|
|
<A HREF="author.html#45">[ author ]</A>
|
|
</UL>
|
|
<HR NOSHADE><P>
|
|
<!-- body="start" -->
|
|
<P>
|
|
abel deuring wrote:
|
|
<BR>
|
|
<P><EM>> That's my fault: In the recent version, sanei_scsi_open calls
|
|
</EM><BR>
|
|
<EM>> sanei_scsi_open_extended, which allows variable buffer sizes for recent
|
|
</EM><BR>
|
|
<EM>> kernels. For older kernels, a fixes buffer size of SCSIBUFFERSIZE (= 128
|
|
</EM><BR>
|
|
<EM>> * 1024) is used. And that cannot work, because SG_BIG_BUFF is by default
|
|
</EM><BR>
|
|
<EM>> set to 128 * 1024 - 512. I'll fix that this eveing. (Sorry, I can't do
|
|
</EM><BR>
|
|
<EM>> that right now at work)
|
|
</EM><BR>
|
|
<EM>>
|
|
</EM><BR>
|
|
<EM>> And updating the man page is indeed a good idea...
|
|
</EM><BR>
|
|
<P>So, here is the bugfix. sanei_scsi.c should now work again with
|
|
<BR>
|
|
SG_BIG_BUFF = 128 * 1024 - 512. (If I remember right, that was the
|
|
<BR>
|
|
maximum value for older kernels.)
|
|
<BR>
|
|
<P>I also added a paragraph to the sane-scsi man page: How to change buffer
|
|
<BR>
|
|
size for the recent versions of the SG driver.
|
|
<BR>
|
|
<P>Both patches are also "committed" to teh CVS server.
|
|
<BR>
|
|
<P>Abel
|
|
<BR>
|
|
|
|
<BR><P>
|
|
--- sane-scsi.man.orig Mon Aug 9 20:05:41 1999
|
|
<BR>
|
|
+++ sane-scsi.man Sat Feb 5 00:50:04 2000
|
|
<BR>
|
|
@@ -148,6 +148,18 @@
|
|
<BR>
|
|
bytes. After changing this value, it is necessary to recompile both
|
|
<BR>
|
|
the kernel (or the SCSI generic module) and the SCSI backends.
|
|
<BR>
|
|
.PP
|
|
<BR>
|
|
+From version 2.0 on, the maximum buffer size of Linux SG driver can
|
|
<BR>
|
|
+be changed at program run time, and the restriction to 127 kB is also
|
|
<BR>
|
|
+removed. This driver version is part of the Linux kernels from version
|
|
<BR>
|
|
+2.2.7 on. If larger buffers are reasonable for your scanner, set the
|
|
<BR>
|
|
+environment variable
|
|
<BR>
|
|
+.B SANE_SG_BUFFERSIZE
|
|
<BR>
|
|
+to the desired buffer size in bytes. It is not recommended to use more
|
|
<BR>
|
|
+than 1 MB, because for large values the probablility increases that the
|
|
<BR>
|
|
+SG driver cannot allocate the necessary buffer(s). For ISA cards, even
|
|
<BR>
|
|
+1 MB might be a too large value. For a detailed discussion of memory
|
|
<BR>
|
|
+issues of the SG driver, see http::/www.torque.net/sg.
|
|
<BR>
|
|
+.PP
|
|
<BR>
|
|
A common issue with SCSI scanners is what to do when you booted
|
|
<BR>
|
|
the system while the scanner was turned off? In such a case, the
|
|
<BR>
|
|
scanner won't be recognized by the kernel and SANE won't be able
|
|
<BR>
|
|
<P>
|
|
<BR><P>
|
|
--- sanei_scsi.c.orig Sun Jan 30 13:30:25 2000
|
|
<BR>
|
|
+++ sanei_scsi.c Sat Feb 5 00:24:41 2000
|
|
<BR>
|
|
@@ -1248,10 +1248,10 @@
|
|
<BR>
|
|
sanei_scsi_open (const char *dev, int *fdp,
|
|
<BR>
|
|
SANEI_SCSI_Sense_Handler handler, void *handler_arg)
|
|
<BR>
|
|
{
|
|
<BR>
|
|
- int i = 0;
|
|
<BR>
|
|
+ int i = 0, fd, len;
|
|
<BR>
|
|
int wanted_buffersize = SCSIBUFFERSIZE, real_buffersize;
|
|
<BR>
|
|
SANE_Status res;
|
|
<BR>
|
|
- char *cc, *cc1;
|
|
<BR>
|
|
+ char *cc, *cc1, buf[32];
|
|
<BR>
|
|
|
|
<BR>
|
|
cc = getenv("SANE_SG_BUFFERSIZE");
|
|
<BR>
|
|
if (cc)
|
|
<BR>
|
|
@@ -1261,6 +1261,40 @@
|
|
<BR>
|
|
wanted_buffersize = i;
|
|
<BR>
|
|
}
|
|
<BR>
|
|
|
|
<BR>
|
|
+ /* wanted_buffersize might be too big, if we have the old SG driver.
|
|
<BR>
|
|
+ Therefore, check the driver version, and reduce wante_buffersize,
|
|
<BR>
|
|
+ if necessary. Otherwise, sanei_scsi_open_extended will fail.
|
|
<BR>
|
|
+ */
|
|
<BR>
|
|
+ fd = open(dev, O_RDWR);
|
|
<BR>
|
|
+ if (fd < 0)
|
|
<BR>
|
|
+ {
|
|
<BR>
|
|
+ res = SANE_STATUS_INVAL;
|
|
<BR>
|
|
+ if (errno == EACCES)
|
|
<BR>
|
|
+ res = SANE_STATUS_ACCESS_DENIED;
|
|
<BR>
|
|
+ DBG(1, "sanei_scsi_open: open of `%s' failed: %s",
|
|
<BR>
|
|
+ dev, strerror(errno));
|
|
<BR>
|
|
+ return res;
|
|
<BR>
|
|
+ }
|
|
<BR>
|
|
+
|
|
<BR>
|
|
+ i = ioctl(fd, SG_GET_VERSION_NUM, &i);
|
|
<BR>
|
|
+ close(fd);
|
|
<BR>
|
|
+ if (i < 0)
|
|
<BR>
|
|
+ {
|
|
<BR>
|
|
+ /* we have the old driver */
|
|
<BR>
|
|
+ fd = open("proc/sys/kernel/sg-big-buff", O_RDONLY);
|
|
<BR>
|
|
+ if (fd > 0 && (len = read (fd, buf, sizeof (buf) - 1)) > 0)
|
|
<BR>
|
|
+ {
|
|
<BR>
|
|
+ buf[len] = '\0';
|
|
<BR>
|
|
+ i = atoi (buf);
|
|
<BR>
|
|
+ if (wanted_buffersize > i)
|
|
<BR>
|
|
+ wanted_buffersize = i;
|
|
<BR>
|
|
+ close(fd);
|
|
<BR>
|
|
+ }
|
|
<BR>
|
|
+ else
|
|
<BR>
|
|
+ if (wanted_buffersize > SG_BIG_BUFF)
|
|
<BR>
|
|
+ wanted_buffersize = SG_BIG_BUFF;
|
|
<BR>
|
|
+ }
|
|
<BR>
|
|
+
|
|
<BR>
|
|
real_buffersize = wanted_buffersize;
|
|
<BR>
|
|
res = sanei_scsi_open_extended(dev, fdp, handler, handler_arg,
|
|
<BR>
|
|
&real_buffersize);
|
|
<BR>
|
|
<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:%20SG_BIG_BUFF%20setting%20in%20Problems%20incorrect&In-Reply-To=<389B712F.6CB9D7F6@satzbau-gmbh.de>">majordomo@mostang.com</A>
|
|
</PRE>
|
|
<P><!-- body="end" -->
|
|
<HR NOSHADE>
|
|
<UL>
|
|
<!-- next="start" -->
|
|
<LI><STRONG>Next message:</STRONG> <A HREF="0046.html">Oliver Rauch: "scsi buffer size handling for backends"</A>
|
|
<LI><STRONG>Previous message:</STRONG> <A HREF="0044.html">Doug Alcorn: "Re: lunatic listserver"</A>
|
|
<LI><STRONG>In reply to:</STRONG> <A HREF="0035.html">abel deuring: "Re: SG_BIG_BUFF setting in Problems incorrect"</A>
|
|
<!-- nextthread="start" -->
|
|
<!-- reply="end" -->
|
|
<LI><STRONG>Messages sorted by:</STRONG>
|
|
<A HREF="date.html#45">[ date ]</A>
|
|
<A HREF="index.html#45">[ thread ]</A>
|
|
<A HREF="subject.html#45">[ subject ]</A>
|
|
<A HREF="author.html#45">[ 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>Fri Feb 04 2000 - 16:58:12 PST</EM>
|
|
</EM>
|
|
</SMALL>
|
|
</BODY>
|
|
</HTML>
|