[sane-devel] Problem with empty sense buffer in sanei_scsi (linux+hpusbscsi+vuescan)?

abel deuring a.deuring@satzbau-gmbh.de
Sat, 06 Oct 2001 21:35:27 +0200

Jose Paulo Moitinho de Almeida wrote:

> I now have the log, using the original sg driver, which is attached and
> states:
> a) "sanei_scsi_open: using new SG header structure";
> b) "sense buffer: 68 22 42 08 ff ff ff ff 00 00 00 00 00 00 00 00"
> After reading Abel's message, rereading the code and looking at the log I
> think it is safe to say that the problem is here:
>      if (   ((req->sgdata.sg3.hdr.info & SG_INFO_CHECK) != 0)
>              || (req->sgdata.sg3.hdr.sb_len_wr > 0 &&
>               ((req->sgdata.sg3.sense_buffer[0] & 0x7f) != 0)))

The problem is not exactly here, I think, but a few lines below. This
"if" simply checks, if anything went wrong with a SCSI command. While
the sense buffer contains obviously nonsense, this does not matter,
because sb_len_wr is zero, as your printk's show, hence sg3.hdr.info
must be non-zero for the "if" block to be executed. This fits with
"target status: 10 host status: 0007 driver status: 0000" from the debug
output from sanei_scsi.c. target_status==10 means "intermediate good",
but host_status==7 means "internal error", so something went wrong. But
there is indeed no point in calling the sense handler. The attached
patch to sanei_scsi.c should avoid this call. But I'm not sure, if this
patch will fix all problems have; now sanei_scsi_req_wait will return

> So hrd.info ands with SG_INFO_CHECK and the sense buffer is sent to the
> handler.
> This dump lead me to the conclusion that the error was downstream, but
> perhaps I am wrong.
> Should sg.c be modified, so that when SG_INFO_CHECK is set, the
> initialisation of the sense_buffer is done?

Well, for version 3 of the SG driver, my should fix the mess with the
sense handler and the sense buffer, but I'm not sure, how the old
interface of the SG driver will work... You can force the usage of the
old interface by temporarily replacing the "#ifdef SG_IO" with "#ifdef