Re: Linux sg and sense codes

Douglas Gilbert (dgilbert@interlog.com)
Fri, 17 Dec 1999 08:57:15 -0500

Matto Marjanovic wrote:
>
> Hiya, given all the new development in the Linux scsi architecture, I
> figured I'd ask about an old thorn in my side (which seems to have
> started poking me again recently).
>
> Older Microtek scanners, despite setting the "valid" bit of the first
> byte of the sense buffer, return sense codes which bear no relation
> to the SCSI-2 standard. A couple of years ago I figured out that
> this tended to really confuse the scsi system, which would sometimes
> retry commands on its own, and would inevitably *not* return the
> sense data to the backend without munging it up in some way.
>
> This is a real nuisance because some scanners try and need to report
> that they are busy in certain circumstances, but the message is
> always lost. The fact that the scsi system retries the commands on
> its own volition just compounds the problem.
>
> Do you know if anything has changed in this regard, or if there are
> any ways to circumvent this snag?

Garbage in, surprises out. Have things changed? Well as
I found out recently this is a relatively complex question
in the case of the linux scsi sub-system. The answer
depends on which of the 2 error processing regimes
available that your adapter driver uses.

If the newer regime is used ("eh_code") then the request
by the sg driver for no retries is almost always honoured.
So there shouldn't be any retries, resets, etc

If the older regime is used then the situation described
above occurs. [If the ".h" or the ".c" file of your
adapter source contains something like:
use_new_eh_code: 1
then this is the newer regime. If not, it is using the older
regime.]

Unfortunately, a large majority of linux scsi adapter drivers
(including aic7xxx) use the older regime. The maintainer of
the scsi mid level, Eric Youngdale, has renewed his push
for the adapter driver maintainers to upgrade to the newer
regime. The nature of open software development makes it
difficult to force such an issue too hard but things are
changing slowly.

Sorry the answer couldn't be a bit more positive.

On a brighter note, the 2.3 linux kernel developmemt tree
contains a usb_scsi pseudo adapter driver. This opens
up the possibility of using SANE on USB scanners that
uses a scsi command set. Does anyone know of USB scanner
models that use a scsi command set? [Oliver Rauch told me
yesterday that he thinks the Umax 2200 falls into this
group.]

Doug Gilbert

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com