This is patch as356, regenerated against a current tree.

This patch allows usb-storage to ignore the reported residue values when
required by some devices.  A few devices are included... I know more are
waiting to be merged into unusual_devs.h

In case anyone is curious... yes, these are broken devices.

Greg, please apply.

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



# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/09/26 12:58:02-07:00 [EMAIL PROTECTED] 
#   as359
# 
# drivers/usb/storage/usb.h
#   2004/09/26 12:57:42-07:00 [EMAIL PROTECTED] +1 -0
#   as359
# 
# drivers/usb/storage/unusual_devs.h
#   2004/09/26 12:57:42-07:00 [EMAIL PROTECTED] +22 -1
#   as359
# 
# drivers/usb/storage/transport.c
#   2004/09/26 12:57:42-07:00 [EMAIL PROTECTED] +7 -2
#   as359
# 
diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c   Sun Sep 26 12:59:06 2004
+++ b/drivers/usb/storage/transport.c   Sun Sep 26 12:59:06 2004
@@ -1055,8 +1055,13 @@
 
        /* try to compute the actual residue, based on how much data
         * was really transferred and what the device tells us */
-       residue = min(residue, transfer_length);
-       srb->resid = max(srb->resid, (int) residue);
+       if (residue) {
+               if (!(us->flags & US_FL_IGNORE_RESIDUE) ||
+                               srb->sc_data_direction == DMA_TO_DEVICE) {
+                       residue = min(residue, transfer_length);
+                       srb->resid = max(srb->resid, (int) residue);
+               }
+       }
 
        /* based on the status code, we report good or bad */
        switch (bcs->Status) {
diff -Nru a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
--- a/drivers/usb/storage/unusual_devs.h        Sun Sep 26 12:59:06 2004
+++ b/drivers/usb/storage/unusual_devs.h        Sun Sep 26 12:59:06 2004
@@ -268,6 +268,13 @@
                US_SC_8070, US_PR_BULK, NULL,
                US_FL_FIX_INQUIRY ),
 
+/* Reported by Iacopo Spalletti <[EMAIL PROTECTED]> */
+UNUSUAL_DEV(  0x052b, 0x1807, 0x0100, 0x0100,
+               "Tekom Technologies, Inc",
+               "300_CAMERA",
+               US_SC_DEVICE, US_PR_DEVICE, NULL,
+               US_FL_IGNORE_RESIDUE ),
+
 /* This entry is needed because the device reports Sub=ff */
 UNUSUAL_DEV(  0x054c, 0x0010, 0x0106, 0x0450, 
                "Sony",
@@ -811,7 +818,14 @@
                "Solid state disk",
                US_SC_DEVICE, US_PR_DEVICE, NULL,
                US_FL_FIX_INQUIRY ),
-               
+
+/* Reported by Rastislav Stanik <[EMAIL PROTECTED]> */
+UNUSUAL_DEV(  0x0ea0, 0x6828, 0x0110, 0x0110,
+               "USB",
+               "Flash Disk",
+               US_SC_DEVICE, US_PR_DEVICE, NULL,
+               US_FL_IGNORE_RESIDUE ),
+
 /* Reported by Kevin Cernekee <[EMAIL PROTECTED]>
  * Tested on hardware version 1.10.
  * Entry is needed only for the initializer function override.
@@ -832,6 +846,13 @@
                "EasyDisk Portable Device",
                US_SC_DEVICE, US_PR_DEVICE, NULL,
                US_FL_MODE_XLATE ),
+
+/* Reported by Kotrla Vitezslav <[EMAIL PROTECTED]> */
+UNUSUAL_DEV(  0x1370, 0x6828, 0x0110, 0x0110,
+               "SWISSBIT",
+               "Black Silver",
+               US_SC_DEVICE, US_PR_DEVICE, NULL,
+               US_FL_IGNORE_RESIDUE ),
 
 #ifdef CONFIG_USB_STORAGE_SDDR55
 UNUSUAL_DEV(  0x55aa, 0xa103, 0x0000, 0x9999, 
diff -Nru a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
--- a/drivers/usb/storage/usb.h Sun Sep 26 12:59:06 2004
+++ b/drivers/usb/storage/usb.h Sun Sep 26 12:59:06 2004
@@ -73,6 +73,7 @@
 #define US_FL_SCM_MULT_TARG   0x00000020 /* supports multiple targets      */
 #define US_FL_FIX_INQUIRY     0x00000040 /* INQUIRY response needs faking   */
 #define US_FL_FIX_CAPACITY    0x00000080 /* READ CAPACITY response too big  */
+#define US_FL_IGNORE_RESIDUE  0x00000100 /* reported residue is wrong      */
 
 /* Dynamic flag definitions: used in set_bit() etc. */
 #define US_FLIDX_URB_ACTIVE    18  /* 0x00040000  current_urb is in use  */

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

I could always suspend a few hundred accounts and watch what happens.
                                        -- Tanya
User Friendly, 7/31/1998

Attachment: pgpKLSs1KuTis.pgp
Description: PGP signature

Reply via email to