ChangeSet 1.1939.1.51, 2004/09/29 11:42:55-07:00, [EMAIL PROTECTED] [PATCH] USB Storage: ignore bogus residue values
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. 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 | 9 +++++++-- drivers/usb/storage/unusual_devs.h | 23 ++++++++++++++++++++++- drivers/usb/storage/usb.h | 1 + 3 files changed, 30 insertions(+), 3 deletions(-) diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c --- a/drivers/usb/storage/transport.c 2004-10-19 08:09:06 -07:00 +++ b/drivers/usb/storage/transport.c 2004-10-19 08:09:06 -07:00 @@ -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 2004-10-19 08:09:06 -07:00 +++ b/drivers/usb/storage/unusual_devs.h 2004-10-19 08:09:06 -07:00 @@ -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 2004-10-19 08:09:06 -07:00 +++ b/drivers/usb/storage/usb.h 2004-10-19 08:09:06 -07:00 @@ -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 */ ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel