sane-project-website/old-archive/1999-12/0025.html

99 wiersze
4.8 KiB
HTML

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

<!-- received="Thu Dec 2 19:01:35 1999 PST" -->
<!-- sent="Thu, 02 Dec 1999 22:10:28 -0500" -->
<!-- name="Douglas Gilbert" -->
<!-- email="dgilbert@interlog.com" -->
<!-- subject="Re: Problem with SANE and SCSI scanner" -->
<!-- id="" -->
<!-- inreplyto="Problem with SANE and SCSI scanner" -->
<title>sane-devel: Re: Problem with SANE and SCSI scanner</title>
<h1>Re: Problem with SANE and SCSI scanner</h1>
<b>Douglas Gilbert</b> (<a href="mailto:dgilbert@interlog.com"><i>dgilbert@interlog.com</i></a>)<br>
<i>Thu, 02 Dec 1999 22:10:28 -0500</i>
<p>
<ul>
<li> <b>Messages sorted by:</b> <a href="date.html#25">[ date ]</a><a href="index.html#25">[ thread ]</a><a href="subject.html#25">[ subject ]</a><a href="author.html#25">[ author ]</a>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0026.html">Petter Reinholdtsen: "Cross platform GUI toolkit"</a>
<li> <b>Previous message:</b> <a href="0024.html">Petter Reinholdtsen: "Re: SANE Net backend suggestion..."</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>
<!-- body="start" -->
Manuel Panea wrote:<br>
<i>&gt; </i><br>
<i>&gt; [snip]</i><br>
<i>&gt; &gt; The failure (EIO) on the sg device handle (4 in this case)</i><br>
<i>&gt; &gt; indicates the buffer passed to sg's write() was too small.</i><br>
<i>&gt; &gt; A length of 42 implies a maximum SCSI command length of 6</i><br>
<i>&gt; &gt; bytes (because the accompanying sg_header structure is 36</i><br>
<i>&gt; &gt; bytes long). Digging around the canon backend code in</i><br>
<i>&gt; &gt; sane-1.0.1, it seems to be sending an opcode of 0xd5</i><br>
<i>&gt; &gt; for "GET SCAN MODE". Such an opcode can only be 10 bytes</i><br>
<i>&gt; &gt; long (12 bytes if another flag was set but I can see above</i><br>
<i>&gt; &gt; it is not).</i><br>
<i>&gt; &gt;</i><br>
<i>&gt; &gt; Doug Gilbert</i><br>
<i>&gt; &gt; Linux sg maintainer</i><br>
<i>&gt; </i><br>
<i>&gt; Aha! So *you* are the sg maintainer. If you have read my last answer to</i><br>
<i>&gt; Laura, you know that you are right: sg and sane get confused about the</i><br>
<i>&gt; SCSI command sizes.</i><br>
<p>
The maintainers of various parts of the Linux kernel <br>
and associated drivers are listed in<br>
/usr/src/linux/MAINTAINERS . The maintainers are asked to<br>
monitor relevant newsgroups and let it be known once<br>
in a while. There may well be maintainers of other free OSes<br>
also monitoring this group.<br>
<p>
<i>&gt; Now why is this so? I was (fortunately) told about this problem by a canon</i><br>
<i>&gt; backend user who described it as a bug in sg, but now you talk as if it</i><br>
<i>&gt; were sane's fault. So is it sg's fault or is it sane's fault? (I don't</i><br>
<i>&gt; think it can be the backend's fault, all I do is try to send the scanner a</i><br>
<i>&gt; perfectly valid SCSI command.) What should be changed to not have to tell</i><br>
<i>&gt; the users to "go patch /usr/src/linux/drivers/scsi/sg.c"?</i><br>
<p>
Manuel,<br>
<p>
The Linux sg driver has been around since 1992 with its<br>
awkward "sg_header" based interface. It makes many <br>
assumptions, one of which is that SCSI commands with<br>
opcodes &gt;= 0xc0 can only be 10 or 12 bytes long. Obviously<br>
this is why the Canon driver needs or needed that patch.<br>
<p>
Things are gradually being improved. From and including<br>
lk 2.2.10 there is an ioctl() in sg called SG_NEXT_CMD_LEN<br>
that sets the length of the next SCSI command. That solves<br>
your immediate problem. The sg version number can be found <br>
with the ioctl() SG_GET_VERSION_NUM. There is an additional<br>
interface structure called sg_io_hdr that is being added <br>
to the sg driver in the linux 2.3 development tree. Abel<br>
Deuring &lt;<a href="mailto:a.deuring@satzbau-gmbh.de">a.deuring@satzbau-gmbh.de</a>&gt; has developed a Mustek <br>
backend using it. More information about sg can be found<br>
at <a href="http://www.torque.net/sg">http://www.torque.net/sg</a> .<br>
<p>
Returning to Laura's strace output from yesterday. The<br>
strace output indicated that a write() called failed<br>
with an EIO error yet the Sane error message was:<br>
"open of device canon:/dev/sga failed: Invalid argument".<br>
With accurate error information and a document like<br>
/usr/src/linux/Documentation/scsi-generic.txt perhaps<br>
this problem could have been diagnosed earlier.<br>
<p>
Doug Gilbert<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">majordomo@mostang.com</a>
</pre>
<!-- body="end" -->
<p>
<ul>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0026.html">Petter Reinholdtsen: "Cross platform GUI toolkit"</a>
<li> <b>Previous message:</b> <a href="0024.html">Petter Reinholdtsen: "Re: SANE Net backend suggestion..."</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>