]> git.hungrycats.org Git - linux/commit
[PATCH] USB storage: Issue CBI clear_halt and fix BBB residue
authorAlan Stern <stern@rowland.harvard.edu>
Fri, 5 Dec 2003 03:06:53 +0000 (19:06 -0800)
committerGreg Kroah-Hartman <greg@kroah.com>
Fri, 5 Dec 2003 03:06:53 +0000 (19:06 -0800)
commitaf62566fe1293f03b7847d30d350491d8c43f8c2
tree5a0796cc17791e6edf54f0bd0424f58a8665e970
parent78dd3042258c73c096ff214be6865cb3a373de78
[PATCH] USB storage: Issue CBI clear_halt and fix BBB residue

This patch does 2 things (bad, I know -- but they're both pretty small
and pretty obscure).

The CBI specification states in section 2.4.3.1.3 that

... the host shall also issue Clear Feature for Endpoint Halt
to the Bulk In pipe if the device reports that the Data In
command block has Failed.

along with a note in section 2.5.3 that Data Out commands should work
analogously.  This patch does that, along with cleaning up the status
detection logic a little.

For Bulk-only transfers we currently ignore the dResidue field in the CSW,
except for reporting it (without byte-swapping!) in a debug message.  The
patch uses it to compute the residue value returned to the SCSI layer.
Note that the Bulk-only spec allows devices to transfer more data than
they actually use (i.e., they may add padding or ignore stuff) and then
inform the host of this by means of the dResidue value.  The logic used is
simple: our reported residue is the larger of what the device claims and
what we didn't transfer, except that it can't be larger than the total
transfer length.
drivers/usb/storage/transport.c