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

125 wiersze
4.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: Problem in sanei_scsi.c</TITLE>
<META NAME="Author" CONTENT="Simon Munton (simon@munton.demon.co.uk)">
<META NAME="Subject" CONTENT="Problem in sanei_scsi.c">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Problem in sanei_scsi.c</H1>
<!-- received="Thu May 25 11:10:27 2000" -->
<!-- isoreceived="20000525181027" -->
<!-- sent="Thu, 25 May 2000 19:14:19 +0100" -->
<!-- isosent="20000525181419" -->
<!-- name="Simon Munton" -->
<!-- email="simon@munton.demon.co.uk" -->
<!-- subject="Problem in sanei_scsi.c" -->
<!-- id="000f01bfc675$1015ca40$7a53dec2@simon" -->
<STRONG>From:</STRONG> Simon Munton (<A HREF="mailto:simon@munton.demon.co.uk?Subject=Re:%20Problem%20in%20sanei_scsi.c&In-Reply-To=&lt;000f01bfc675$1015ca40$7a53dec2@simon&gt;"><EM>simon@munton.demon.co.uk</EM></A>)<BR>
<STRONG>Date:</STRONG> Thu May 25 2000 - 11:14:19 PDT
<P>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0164.html">William (Andy) Smith: "Re: Correct Network Scanner Syntax? (a question)"</A>
<UL>
<LI><STRONG>Previous message:</STRONG> <A HREF="0162.html">John Fremlin: "Re: Microtek ScanMaker E3 -&gt; crashes the computer"</A>
<!-- nextthread="start" -->
<LI><STRONG>Next in thread:</STRONG> <A HREF="0167.html">Douglas Gilbert: "Re: Problem in sanei_scsi.c"</A>
<LI><STRONG>Reply:</STRONG> <A HREF="0167.html">Douglas Gilbert: "Re: Problem in sanei_scsi.c"</A>
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#163">[ date ]</A>
<A HREF="index.html#163">[ thread ]</A>
<A HREF="subject.html#163">[ subject ]</A>
<A HREF="author.html#163">[ author ]</A>
</UL>
<HR NOSHADE><P>
<!-- body="start" -->
<P>
Hi,
<BR>
<P>I've found a problem in the issue() function in sanei_scsi.c, that results
<BR>
in the queue in sg filling up, and prevents any more scsi commands being
<BR>
issued until the device is closed.
<BR>
<P>There is a test on line 1690 which can erroneously try to reissue a scsi
<BR>
command:
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;if (rp == fdp-&gt;sane_qhead &amp;&amp; errno == EAGAIN)
<BR>
<P>The first time through the enclosing while loop, rp == fdp-&gt;sane_qhead. But
<BR>
if the write() call issuing the command was successful, errno is left
<BR>
unchanged, and if errno happens to contain EAGAIN, then the command is
<BR>
issued again, and again... until the command queue in sg is full.
<BR>
<P>One solution would be to set errno to 0 at the start of the while loop:
<BR>
<P>$ diff -c sanei_scsi.c.orig sanei_scsi.c
<BR>
*** sanei_scsi.c.orig Sun Mar 05 13:45:20 2000
<BR>
--- sanei_scsi.c Thu May 18 19:18:44 2000
<BR>
***************
<BR>
*** 1636,1641 ****
<BR>
--- 1636,1642 ----
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;retries = 20;
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while (retries)
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
<BR>
+ errno = 0;
<BR>
&nbsp;&nbsp;#ifdef SG_IO
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (sg_version &lt; 30000)
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
<BR>
<P><P>Regards
<BR>
<P>Simon Munton
<BR>
<P><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:%20Problem%20in%20sanei_scsi.c&In-Reply-To=&lt;000f01bfc675$1015ca40$7a53dec2@simon&gt;">majordomo@mostang.com</A>
</PRE>
<P><!-- body="end" -->
<HR NOSHADE>
<UL>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0164.html">William (Andy) Smith: "Re: Correct Network Scanner Syntax? (a question)"</A>
<LI><STRONG>Previous message:</STRONG> <A HREF="0162.html">John Fremlin: "Re: Microtek ScanMaker E3 -&gt; crashes the computer"</A>
<!-- nextthread="start" -->
<LI><STRONG>Next in thread:</STRONG> <A HREF="0167.html">Douglas Gilbert: "Re: Problem in sanei_scsi.c"</A>
<LI><STRONG>Reply:</STRONG> <A HREF="0167.html">Douglas Gilbert: "Re: Problem in sanei_scsi.c"</A>
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#163">[ date ]</A>
<A HREF="index.html#163">[ thread ]</A>
<A HREF="subject.html#163">[ subject ]</A>
<A HREF="author.html#163">[ 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 May 25 2000 - 11:11:15 PDT</EM>
</EM>
</SMALL>
</BODY>
</HTML>