On Mon, Jan 06, 2003 at 05:23:22PM -0500, Doug Ledford wrote:
> On Mon, Jan 06, 2003 at 11:22:59AM -0800, Matthew Dharm wrote:
> > 
> > The first case:  If the additional length indicates < 36 bytes, we should
> > never issue the second request (which is where this device choked).  This
> > should be a sanity check in scsi_scan.c, and it works for reasons I've
> > previously outlined.
> 
> No, this should be fixed in usb code.  It's a hack, I know, but it's a 
> hack to work around the fact that usb devices are broken by and large much 
> more so than non-usb scsi devices.  Basically, the usb code has the 
> ability to tell that 36 bytes were actually transferred, so the usb code 
> should set the length byte in the return to max(actual_transfer - 5, 
> current_length_byte);  In actuality, other scsi HBAs that know how many 
> bytes were transferred by devices could do this as well, but they don't 
> need to because their SCSI devices aren't so braindead....

Okay, so what about sbp2, where this sort of thing is also common?  Why not
just fix it at the SCSI layer?

> > The second case:  This is a bad device.  A classic off-by-one error.  But
> > what can usb-storage do?  We don't know that the device is bad.  But,
> > focusing on this case, what happens?  Short data is returned... if the
> > resid field is set to indicate this, then scsi_scan.c should be able to do
> > something sane here.
> 
> Yep, as my previous email, scsi_scan.c should simply ignore the extra byte 
> because we don't care about it in the least.
> 
> > Perhaps the "best" fix here is to simply make scsi_scan.c only send 36 byte
> > inquiry requests if the bus is 'emulated'.  That would solve a world of
> > problems....
> 
> Except that if a device *does* transfer 36 bytes and then lies and says it 
> only transferred 5 then we are missing information that might actually be 
> usefull, hence the reason to set the transfer length up to the real amount 
> transferred (and BTW, I would only do this for INQUIRY responses, for 
> anything else the device is simply too buggy to live if it lies about the 
> transfer length).

First, I think this is a bogus situation.  If we reqest 36, get X, and
indicate a total of 5, then we should look at the X we got.  And that has
to be indicated by resid.

The argument that many HBAs don't set resid just doesn't hold water with
me.  Just because other drivers are broken, we should break more things
instead of fixing the problem?

Matt

-- 
Matthew Dharm                              Home: [EMAIL PROTECTED] 
Maintainer, Linux USB Mass Storage Driver

Da.  Am thinkink of carbonated borscht for lonk nights of coding.
                                        -- Pitr
User Friendly, 7/24/1998

Attachment: msg10435/pgp00000.pgp
Description: PGP signature

Reply via email to