diff options
author | Oliver Neukum <oneukum@suse.de> | 2007-02-08 03:04:48 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-02-16 18:32:19 -0500 |
commit | 61bf54b71d5abf767ee46284be19965d7253ddbf (patch) | |
tree | 04bda12e495bc19be2712dff9da35f5e3271691a /drivers/scsi | |
parent | 5b06470816fb5e658e81db2a55b530ff2ba711c9 (diff) |
USB Storage: indistinguishable devices with broken and unbroken firmware
there's a USB mass storage device which exists in two version. One
reports the correct size and the other does not. Apart from that they
are identical and cannot be told apart. Here's a heuristic based on the
empirical finding that drives have even sizes.
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/sd.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 3f048bd6326d..5a8f55fea5ff 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -1269,9 +1269,18 @@ repeat: | |||
1269 | 1269 | ||
1270 | /* Some devices return the total number of sectors, not the | 1270 | /* Some devices return the total number of sectors, not the |
1271 | * highest sector number. Make the necessary adjustment. */ | 1271 | * highest sector number. Make the necessary adjustment. */ |
1272 | if (sdp->fix_capacity) | 1272 | if (sdp->fix_capacity) { |
1273 | --sdkp->capacity; | 1273 | --sdkp->capacity; |
1274 | 1274 | ||
1275 | /* Some devices have version which report the correct sizes | ||
1276 | * and others which do not. We guess size according to a heuristic | ||
1277 | * and err on the side of lowering the capacity. */ | ||
1278 | } else { | ||
1279 | if (sdp->guess_capacity) | ||
1280 | if (sdkp->capacity & 0x01) /* odd sizes are odd */ | ||
1281 | --sdkp->capacity; | ||
1282 | } | ||
1283 | |||
1275 | got_data: | 1284 | got_data: |
1276 | if (sector_size == 0) { | 1285 | if (sector_size == 0) { |
1277 | sector_size = 512; | 1286 | sector_size = 512; |