On Tue, 24 Aug 2004, Kotrla Vitezslav wrote:

> > By the way, can you send that usb-storage debugging log I asked about
> > earlier, showing what happens when you write a small file 
> > (less than 512
> > bytes) to the device?  I want to see if the drive reports incorrect
> > residue values for WRITEs as well as for READs.
> 
> No problem, here it comes, see below. I hope it is what you wanted.
> 
> Regards,
> 
> Vitezslav Kotrla

That was good, thanks.

Can the three of you try out this patch below, instead of the previous
one?  It's different in that it ignores the bad residue sent by the device
for READs but it uses the residue for WRITEs.  That's a safer way of
operating, since there are other ways the device can indicate a READ error
whereas there aren't so many options for indicating a WRITE error.

Make sure you try using the patch with both reading and writing.  If it 
works, I'll submit it for inclusion in the official kernel.

Alan Stern


===== drivers/usb/storage/transport.c 1.145 vs edited =====
--- 1.145/drivers/usb/storage/transport.c       Tue Aug  3 10:17:59 2004
+++ edited/drivers/usb/storage/transport.c      Tue Aug 24 12:05:30 2004
@@ -1054,8 +1054,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) {
===== drivers/usb/storage/unusual_devs.h 1.144 vs edited =====
--- 1.144/drivers/usb/storage/unusual_devs.h    Fri Aug  6 03:59:29 2004
+++ edited/drivers/usb/storage/unusual_devs.h   Tue Aug 24 11:59:50 2004
@@ -265,6 +265,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",
@@ -801,7 +808,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.
@@ -822,6 +836,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, 
===== drivers/usb/storage/usb.h 1.60 vs edited =====
--- 1.60/drivers/usb/storage/usb.h      Tue Jul 20 19:30:35 2004
+++ edited/drivers/usb/storage/usb.h    Tue Aug 24 11:59:50 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  */



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to