Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Jun 2012 17:36:46 +0200
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        Alexander Motin <mav@freebsd.org>
Cc:        freebsd-usb@freebsd.org
Subject:   Re: [usb] Kingston 8Gb is not usable
Message-ID:  <201206271736.46305.hselasky@c2i.net>
In-Reply-To: <4FEB27D9.9030408@FreeBSD.org>
References:  <4FE9AB28.3070704@passap.ru> <201206271731.08298.hselasky@c2i.net> <4FEB27D9.9030408@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 27 June 2012 17:33:45 Alexander Motin wrote:
> On 06/27/12 18:31, Hans Petter Selasky wrote:
> > On Wednesday 27 June 2012 17:28:30 Alexander Motin wrote:
> >> On 06/27/12 18:17, Hans Petter Selasky wrote:
> >>> On Wednesday 27 June 2012 17:08:29 Alexander Motin wrote:
> >>>> umass problem
> >>> 
> >>> Hi,
> >>> 
> >>> Are you verifying the received data length for the SCSI commands
> >>> reading out various data?
> >> 
> >> Mentioned revision beyond others adds check for the sense data length in
> >> case of error. It won't even look into the sense data if reported amount
> >> (sense_len - sense_resid) is zero or less then needed. I have no idea
> >> how USB calculates resid, but it may be a problem in this case. I think
> >> it could be useful to get USB packets trace to see whether it is device
> >> doesn't return any sense data, or umass improperly interprets them in
> >> this case for some reason.
> > 
> > Hi,
> > 
> > The residue is part of the 13 status bytes in the SCSI BOT protocol. If
> > this field is zero, the umass driver will compute the residue from the
> > actual data transferred as a workaround.
> 
> Can't there be an opposite bug -- residue field is equal to the transfer
> size in which case CAM will think there is no sense data?

Hi,

Then you need to check using "usbdump -i usbusX -s 65536 -vvvv" what is 
actually going on there.

Usually the USB device does not zero-pad any SCSI data.

Code looks like this:

                residue = UGETDW(sc->csw.dCSWDataResidue);

                if ((!residue) || (sc->sc_quirks & IGNORE_RESIDUE)) {
                        residue = (sc->sc_transfer.data_len -
                            sc->sc_transfer.actlen);
                }
                if (residue > sc->sc_transfer.data_len) {
                        DPRINTF(sc, UDMASS_BBB, "truncating residue from %d "
                            "to %d bytes\n", residue, sc-
>sc_transfer.data_len);
                        residue = sc->sc_transfer.data_len;
                }

--HPS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206271736.46305.hselasky>