[sane-devel] SCSI Scanner attached to USB Port via Microtech
Mark Bucciarelli
mark at easymailings.com
Tue Oct 22 02:04:41 BST 2002
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=255
> >>export SANE_DEBUG_HP=255
> >>export SANE_DEBUG_DLL=255
> >>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 [hp]
> > 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 by
> 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 == 8 is an error is wrong -- it simply 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 correct
> (and work only with SG drivers version 3.x, which you are using), but it's
> worth a try, I think ;) Line 2191 of a recent CVS checkout of sanei_scsi.c
> look as follows:
>
> if ( req->sgdata.sg3.hdr.host_status ==
> SG_ERR_DID_NO_CONNECT
>
> || req->sgdata.sg3.hdr.host_status ==
> || SG_ERR_DID_BUS_BUSY
> || req->sgdata.sg3.hdr.host_status ==
> || SG_ERR_DID_TIME_OUT
> || req->sgdata.sg3.hdr.driver_status == DRIVER_BUSY
> || req->sgdata.sg3.hdr.masked_status == 0x04) /* BUSY
> || */
>
> status = 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 = (*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) == 0)
> && (req->sgdata.sg3.hdr.host_status ==
> SG_ERR_DID_OK) && (req->sgdata.sg3.hdr.driver_status == SG_ERR_DRIVER_OK))
> status = SANE_STATUS_GOOD;
> else
> status = SANE_STATUS_IO_ERROR;
> }
>
> This should be changed to:
>
> if ( req->sgdata.sg3.hdr.host_status ==
> SG_ERR_DID_NO_CONNECT
>
> || req->sgdata.sg3.hdr.host_status ==
> || SG_ERR_DID_BUS_BUSY
> || req->sgdata.sg3.hdr.host_status ==
> || SG_ERR_DID_TIME_OUT
> || req->sgdata.sg3.hdr.driver_status == DRIVER_BUSY
> || req->sgdata.sg3.hdr.masked_status == 0x04) /* BUSY
> || */
>
> status = 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 = (*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) == 0)
> && (req->sgdata.sg3.hdr.host_status ==
> SG_ERR_DID_OK) && ((req->sgdata.sg3.hdr.driver_status == SG_ERR_DRIVER_OK)
>
> || (req->sgdata.sg3.hdr.driver_status == SG_ERR_DRIVER_SENSE)))
>
> status = SANE_STATUS_GOOD;
> else
> status = 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;)
More information about the sane-devel
mailing list