Hi,

could you please test this with your storage device. It tries to implement
a heuristics which will work with both versions of the firmware.

        Regards
                Oliver
----

--- a/drivers/usb/storage/unusual_devs.h        2007-01-31 14:48:08.000000000 
+0100
+++ b/drivers/usb/storage/unusual_devs.h        2007-01-31 15:37:40.000000000 
+0100
@@ -1323,7 +1323,7 @@
                "DataStor",
                "USB4500 FW1.04",
                US_SC_DEVICE, US_PR_DEVICE, NULL,
-               US_FL_FIX_CAPACITY),
+               US_FL_CAPACITY_HEURISTICS),
 
 /* Control/Bulk transport for all SubClass values */
 USUAL_DEV(US_SC_RBC, US_PR_CB, USB_US_TYPE_STOR),
--- a/drivers/usb/storage/scsiglue.c    2007-01-31 14:56:36.000000000 +0100
+++ b/drivers/usb/storage/scsiglue.c    2007-01-31 15:37:35.000000000 +0100
@@ -155,6 +155,12 @@
                if (us->flags & US_FL_FIX_CAPACITY)
                        sdev->fix_capacity = 1;
 
+               /* A few disks have two indistinguishable version, one of
+                * which reports the correct capacity and the other does not.
+                * The sd driver has to guess which is the case. */
+               if (us->flags & US_FL_CAPACITY_HEURISTICS)
+                       sdev->guess_capacity = 1;
+
                /* Some devices report a SCSI revision level above 2 but are
                 * unable to handle the REPORT LUNS command (for which
                 * support is mandatory at level 3).  Since we already have
--- a/drivers/scsi/sd.c 2007-01-31 15:33:57.000000000 +0100
+++ b/drivers/scsi/sd.c 2007-01-31 15:37:52.000000000 +0100
@@ -1274,6 +1274,13 @@
        if (sdp->fix_capacity)
                --sdkp->capacity;
 
+       /* Some devices have version which report the correct sizes
+        * and others which do not. We guess size according toa heuristic
+        * and err on the side of lowering the capacity. */
+       if (sdp->guess_capacity)
+               if (sdkp->capacity % 63 || sdkp->capacity % 255)
+                       --sdkp->capacity;
+
 got_data:
        if (sector_size == 0) {
                sector_size = 512;
--- a/include/linux/usb_usual.h 2007-01-31 14:49:55.000000000 +0100
+++ b/include/linux/usb_usual.h 2007-01-31 15:37:49.000000000 +0100
@@ -46,7 +46,9 @@
        US_FLAG(MAX_SECTORS_64, 0x00000400)                     \
                /* Sets max_sectors to 64    */                 \
        US_FLAG(IGNORE_DEVICE,  0x00000800)                     \
-               /* Don't claim device */
+               /* Don't claim device */                        \
+       US_FLAG(CAPACITY_HEURISTICS,    0x00001000)             \
+               /* sometimes sizes is too big */
 
 #define US_FLAG(name, value)   US_FL_##name = value ,
 enum { US_DO_ALL_FLAGS };

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to