-
Alan Stern authored
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.
af62566f