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

Jose Paulo Moitinho de Almeida moitinho@civil.ist.utl.pt
Thu, 4 Oct 2001 13:59:13 +0100


Hello

First the good news: I have managed to make my Minolta Scan Dual II work with 
vuescan under linux using the hpusbscsi driver in the ac series.

The not so good news is that I had to introduce  an hack in drivers/scsi/sg.c 
to achieve this. I think that the problem is related to sanei_scsi, which is 
used by vuescan.

The problem happens because sometimes there is junk in the sense buffer (not 
initialised) but sb_len_wr is zero, so the junk should not be accessed. I 
checked this by tracing the variables on drivers/scsi/sg.h and had no 
problems when I forced the initialisation of the sense buffer in the outgoing 
structure.

<Pardon>
Until yesterday I had never opened sanei_scsi.c so forgive me for the 
mistakes...
</Pardon>

Ed Hamrick says that "VueScan uses the sanei_scsi routines to do scsi i/o on 
Linux, and the SANEI_SCSI_Sense_Handler routine doesn't have an argument
that contains the length of the sense buffer." 

So I assume that the handler is being called when sb_len_wr is zero. In the 
version of sanei_scsi distributed with 1.0.5 I see an #ifdef SG_IO in 
sanei_scsi_req_wait which decides how to check for errors and, in certain 
conditions, uses sb_len_wr. 

Can someone point me in which direction I should look? I just noticed that I 
should attach a dump (I have one at home....) but I have also noticed that 
the debug messages are similar on both portions of the code.

Thanks

Ze Paulo

I used vuescan 7.1.14, which uses sane-backends-CVS-2001-06-17/sanei/, kernel 
2.4.9 and the hpusbscsi in 2.4.9-ac12 (only this driver).