ChangeSet 1.1760.26.16, 2004/06/24 11:16:26-07:00, [EMAIL PROTECTED]

[PATCH] USB: Patch to signal underflow in usb-storage driver

This patch causes the usb-storage driver to return an error indication
(DID_ERROR together with SUGGEST_RETRY) when the amount transferred by a
SCSI command is smaller than the "underflow" amount.  Some devices, like
the iRiver H100 series, occasionally transfer 0 bytes with GOOD status.
This change will make the sd driver aware that something unexpected has
happened so it can retry the command.



Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
Signed-off-by: Matthew Dharm <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>


 drivers/usb/storage/transport.c |    6 ++++++
 1 files changed, 6 insertions(+)


diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c   2004-06-29 16:25:33 -07:00
+++ b/drivers/usb/storage/transport.c   2004-06-29 16:25:33 -07:00
@@ -708,6 +708,12 @@
                        srb->sense_buffer[0] = 0x0;
                }
        }
+
+       /* Did we transfer less than the minimum amount required? */
+       if (srb->result == SAM_STAT_GOOD &&
+                       srb->request_bufflen - srb->resid < srb->underflow)
+               srb->result = (DID_ERROR << 16) | (SUGGEST_RETRY << 24);
+
        return;
 
        /* abort processing: the bulk-only transport requires a reset



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to