aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/scsiglue.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/storage/scsiglue.c')
-rw-r--r--drivers/usb/storage/scsiglue.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 8d78084abf9f..2a42b862aa9f 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -59,6 +59,13 @@
59#include "transport.h" 59#include "transport.h"
60#include "protocol.h" 60#include "protocol.h"
61 61
62/* Vendor IDs for companies that seem to include the READ CAPACITY bug
63 * in all their devices
64 */
65#define VENDOR_ID_NOKIA 0x0421
66#define VENDOR_ID_NIKON 0x04b0
67#define VENDOR_ID_MOTOROLA 0x22b8
68
62/*********************************************************************** 69/***********************************************************************
63 * Host functions 70 * Host functions
64 ***********************************************************************/ 71 ***********************************************************************/
@@ -142,6 +149,22 @@ static int slave_configure(struct scsi_device *sdev)
142 * settings can't be overridden via the scsi devinfo mechanism. */ 149 * settings can't be overridden via the scsi devinfo mechanism. */
143 if (sdev->type == TYPE_DISK) { 150 if (sdev->type == TYPE_DISK) {
144 151
152 /* Some vendors seem to put the READ CAPACITY bug into
153 * all their devices -- primarily makers of cell phones
154 * and digital cameras. Since these devices always use
155 * flash media and can be expected to have an even number
156 * of sectors, we will always enable the CAPACITY_HEURISTICS
157 * flag unless told otherwise. */
158 switch (le16_to_cpu(us->pusb_dev->descriptor.idVendor)) {
159 case VENDOR_ID_NOKIA:
160 case VENDOR_ID_NIKON:
161 case VENDOR_ID_MOTOROLA:
162 if (!(us->fflags & (US_FL_FIX_CAPACITY |
163 US_FL_CAPACITY_OK)))
164 us->fflags |= US_FL_CAPACITY_HEURISTICS;
165 break;
166 }
167
145 /* Disk-type devices use MODE SENSE(6) if the protocol 168 /* Disk-type devices use MODE SENSE(6) if the protocol
146 * (SubClass) is Transparent SCSI, otherwise they use 169 * (SubClass) is Transparent SCSI, otherwise they use
147 * MODE SENSE(10). */ 170 * MODE SENSE(10). */