This patch tightens up the conditions under which an auto-sense will be
cleared.  It also fixes the comment associated with the code.

Greg, please apply.

Matt

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/02/22 00:14:51-08:00 [EMAIL PROTECTED] 
#   Tighten the sense-clearing code.  Fix the comment associated with that code.
# 
# drivers/usb/storage/transport.c
#   2004/02/22 00:14:36-08:00 [EMAIL PROTECTED] +7 -3
#   Tighten the sense-clearing code.  Fix the comment associated with that code.
# 
diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c   Sun Feb 22 00:21:34 2004
+++ b/drivers/usb/storage/transport.c   Sun Feb 22 00:21:34 2004
@@ -563,9 +563,9 @@
 
        /*
         * If we're running the CB transport, which is incapable
-        * of determining status on its own, we need to auto-sense
+        * of determining status on its own, we will auto-sense
         * unless the operation involved a data-in transfer.  Devices
-        * can signal data-in errors by stalling the bulk-in pipe.
+        * can signal most data-in errors by stalling the bulk-in pipe.
         */
        if ((us->protocol == US_PR_CB || us->protocol == US_PR_DPCM_USB) &&
                        srb->sc_data_direction != SCSI_DATA_READ) {
@@ -698,7 +698,11 @@
                 * out the sense buffer so the higher layers won't realize
                 * we did an unsolicited auto-sense. */
                if (result == USB_STOR_TRANSPORT_GOOD &&
-                               (srb->sense_buffer[2] & 0xf) == 0x0) {
+                       /* Filemark 0, ignore EOM, ILI 0, no sense */
+                               (srb->sense_buffer[2] & 0xaf) == 0 &&
+                       /* No ASC or ASCQ */
+                               srb->sense_buffer[12] == 0 &&
+                               srb->sense_buffer[13] == 0) {
                        srb->result = SAM_STAT_GOOD;
                        srb->sense_buffer[0] = 0x0;
                }

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

What, are you one of those Microsoft-bashing Linux freaks?
                                        -- Customer to Greg
User Friendly, 2/10/1999

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to