[sane-devel] SCSI Scanner attached to USB Port via Microtech

Mark Bucciarelli mark@easymailings.com
Mon, 21 Oct 2002 21:04:41 -0400


Abel,

After applying the patch below, my scanner now works!  Thank you so much.

Mark

On Thursday 17 October 2002 06:05 pm, abel deuring wrote:
> Mark Bucciarelli wrote:
> > On Thursday 17 October 2002 12:01 pm, abel deuring wrote:
> > [...]
> >
> >>2) try alternatively
> >>
> >>export SANE_DEBUG_SANEI_SCSI=3D255
> >>export SANE_DEBUG_HP=3D255
> >>export SANE_DEBUG_DLL=3D255
> >>scanimge -L 2> logfile
> >
> > I commented out all lines in dll.conf except for hp and ran the above
> > four commands.  The resulting log is attached, and it does include [h=
p]
> > lines. Here's a few I thought were interesting:
> >
> > [hp] scl_inq: read failed (Error during device I/O)
> > [hp] scl_errcheck: Can't read SCL error stack: Error during device I/=
O
> > [hp] sanei_hp_device_new: SCL reset failed
>
> Mark,
>
> I think you are right. The problem is similar to the the one reported b=
y
> Ray Curtis and others for the combination Buslogic driver / Linux 2.4.x
> kernbel / HP scanners, only this time the bug is in sanei_scsi.c The
> assumption that driver status =3D=3D 8 is an error is wrong -- it simpl=
y means
> that the low level SCSI driver has sense data available (but the sense =
data
> does not show an error)
>
> I am quite tired, so I am not 100% sure, if the following patch is corr=
ect
> (and work only with SG drivers version 3.x, which you are using), but i=
t's
> worth a try, I think ;) Line 2191 of a recent CVS checkout of sanei_scs=
i.c
> look as follows:
>
>                   if (   req->sgdata.sg3.hdr.host_status =3D=3D
> SG_ERR_DID_NO_CONNECT
>
>                       || req->sgdata.sg3.hdr.host_status =3D=3D
>                       || SG_ERR_DID_BUS_BUSY
>                       || req->sgdata.sg3.hdr.host_status =3D=3D
>                       || SG_ERR_DID_TIME_OUT
>                       || req->sgdata.sg3.hdr.driver_status =3D=3D DRIVE=
R_BUSY
>                       || req->sgdata.sg3.hdr.masked_status =3D=3D 0x04)=
 /* BUSY
>                       || */
>
>                     status =3D SANE_STATUS_DEVICE_BUSY;
>                   else if (handler && req->sgdata.sg3.hdr.sb_len_wr)
>                     /* sense handler should return SANE_STATUS_GOOD if =
it
>                        decided all was ok afterall */
>                     status =3D (*handler) (req->fd,
> req->sgdata.sg3.sense_buffer, arg);
>
>                   /* status bits INTERMEDIATE and CONDITION MET should =
not
>                      result in an error; neither should reserved bits
>                   */
>                   else if (   ((req->sgdata.sg3.hdr.status & 0x2a) =3D=3D=
 0)
>                            && (req->sgdata.sg3.hdr.host_status =3D=3D
> SG_ERR_DID_OK) && (req->sgdata.sg3.hdr.driver_status =3D=3D SG_ERR_DRIV=
ER_OK))
> status =3D SANE_STATUS_GOOD;
>                   else
>                     status =3D SANE_STATUS_IO_ERROR;
>                 }
>
> This should be changed to:
>
>                   if (   req->sgdata.sg3.hdr.host_status =3D=3D
> SG_ERR_DID_NO_CONNECT
>
>                       || req->sgdata.sg3.hdr.host_status =3D=3D
>                       || SG_ERR_DID_BUS_BUSY
>                       || req->sgdata.sg3.hdr.host_status =3D=3D
>                       || SG_ERR_DID_TIME_OUT
>                       || req->sgdata.sg3.hdr.driver_status =3D=3D DRIVE=
R_BUSY
>                       || req->sgdata.sg3.hdr.masked_status =3D=3D 0x04)=
 /* BUSY
>                       || */
>
>                     status =3D SANE_STATUS_DEVICE_BUSY;
>                   else if (handler && req->sgdata.sg3.hdr.sb_len_wr)
>                     /* sense handler should return SANE_STATUS_GOOD if =
it
>                        decided all was ok afterall */
>                     status =3D (*handler) (req->fd,
> req->sgdata.sg3.sense_buffer, arg);
>
>                   /* status bits INTERMEDIATE and CONDITION MET should =
not
>                      result in an error; neither should reserved bits
>                   */
>                   else if (   ((req->sgdata.sg3.hdr.status & 0x2a) =3D=3D=
 0)
>                            && (req->sgdata.sg3.hdr.host_status =3D=3D
> SG_ERR_DID_OK) && ((req->sgdata.sg3.hdr.driver_status =3D=3D SG_ERR_DRI=
VER_OK)
>
> =09=09=09   || (req->sgdata.sg3.hdr.driver_status =3D=3D SG_ERR_DRIVER_=
SENSE)))
>
>                     status =3D SANE_STATUS_GOOD;
>                   else
>                     status =3D SANE_STATUS_IO_ERROR;
>                 }
>
>
> Abel
>
> PS: If you have problems compiling and installing Sane from source, let=
 me
> know (or post to the Sane mailing list;)