aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2008-12-18 16:41:49 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-01-07 13:00:12 -0500
commita81a81a25d3ecdab777abca87c5ddf484056103d (patch)
tree16cce845ef4737f0d0ce2d71981bb3e61dadb9a9
parentc838ea4626d6e982489ff519f9ecf5e1649ca90b (diff)
USB: storage: set CAPACITY_HEURISTICS flag for bad vendors
This patch (as1194) makes usb-storage set the CAPACITY_HEURISTICS flag for all devices made by Nokia, Nikon, or Motorola. These companies seem to include the READ CAPACITY bug in all of their devices. Since cell phones and digital cameras rely on flash storage, which always has an even number of sectors, setting CAPACITY_HEURISTICS shouldn't cause any problems. Not even if the companies wise up and start making devices without the bug. A large number of unusual_devs entries are now unnecessary, so the patch removes them. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/storage/scsiglue.c23
-rw-r--r--drivers/usb/storage/unusual_devs.h155
2 files changed, 23 insertions, 155 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). */
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 035bbc5d8231..a7f9513fa19d 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -174,42 +174,6 @@ UNUSUAL_DEV( 0x0421, 0x0019, 0x0592, 0x0592,
174 US_SC_DEVICE, US_PR_DEVICE, NULL, 174 US_SC_DEVICE, US_PR_DEVICE, NULL,
175 US_FL_MAX_SECTORS_64 ), 175 US_FL_MAX_SECTORS_64 ),
176 176
177/* Reported by Filip Joelsson <filip@blueturtle.nu> */
178UNUSUAL_DEV( 0x0421, 0x005d, 0x0001, 0x0600,
179 "Nokia",
180 "Nokia 3110c",
181 US_SC_DEVICE, US_PR_DEVICE, NULL,
182 US_FL_FIX_CAPACITY ),
183
184/* Reported by Ozan Sener <themgzzy@gmail.com> */
185UNUSUAL_DEV( 0x0421, 0x0060, 0x0551, 0x0551,
186 "Nokia",
187 "3500c",
188 US_SC_DEVICE, US_PR_DEVICE, NULL,
189 US_FL_FIX_CAPACITY ),
190
191/* Reported by CSECSY Laszlo <boobaa@frugalware.org> */
192UNUSUAL_DEV( 0x0421, 0x0063, 0x0001, 0x0601,
193 "Nokia",
194 "Nokia 3109c",
195 US_SC_DEVICE, US_PR_DEVICE, NULL,
196 US_FL_FIX_CAPACITY ),
197
198/* Patch for Nokia 5310 capacity */
199UNUSUAL_DEV( 0x0421, 0x006a, 0x0000, 0x0701,
200 "Nokia",
201 "5310",
202 US_SC_DEVICE, US_PR_DEVICE, NULL,
203 US_FL_FIX_CAPACITY ),
204
205/* Submitted by Ricky Wong Yung Fei <evilbladewarrior@gmail.com> */
206/* Nokia 7610 Supernova - Too many sectors reported in usb storage mode */
207UNUSUAL_DEV( 0x0421, 0x00f5, 0x0000, 0x0470,
208 "Nokia",
209 "7610 Supernova",
210 US_SC_DEVICE, US_PR_DEVICE, NULL,
211 US_FL_FIX_CAPACITY ),
212
213/* Reported by Mario Rettig <mariorettig@web.de> */ 177/* Reported by Mario Rettig <mariorettig@web.de> */
214UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100, 178UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100,
215 "Nokia", 179 "Nokia",
@@ -275,27 +239,6 @@ UNUSUAL_DEV( 0x0421, 0x0495, 0x0370, 0x0370,
275 US_SC_DEVICE, US_PR_DEVICE, NULL, 239 US_SC_DEVICE, US_PR_DEVICE, NULL,
276 US_FL_MAX_SECTORS_64 ), 240 US_FL_MAX_SECTORS_64 ),
277 241
278/* Reported by Cedric Godin <cedric@belbone.be> */
279UNUSUAL_DEV( 0x0421, 0x04b9, 0x0500, 0x0551,
280 "Nokia",
281 "5300",
282 US_SC_DEVICE, US_PR_DEVICE, NULL,
283 US_FL_FIX_CAPACITY ),
284
285/* Reported by Paulo Fessel <pfessel@gmail.com> */
286UNUSUAL_DEV( 0x0421, 0x04bd, 0x0000, 0x9999,
287 "Nokia",
288 "5200",
289 US_SC_DEVICE, US_PR_DEVICE, NULL,
290 US_FL_FIX_CAPACITY ),
291
292/* Reported by Richard Nauber <RichardNauber@web.de> */
293UNUSUAL_DEV( 0x0421, 0x04fa, 0x0550, 0x0660,
294 "Nokia",
295 "6300",
296 US_SC_DEVICE, US_PR_DEVICE, NULL,
297 US_FL_FIX_CAPACITY ),
298
299/* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */ 242/* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */
300UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210, 243UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210,
301 "SMSC", 244 "SMSC",
@@ -425,83 +368,6 @@ UNUSUAL_DEV( 0x04b0, 0x0301, 0x0010, 0x0010,
425 US_SC_DEVICE, US_PR_DEVICE,NULL, 368 US_SC_DEVICE, US_PR_DEVICE,NULL,
426 US_FL_NOT_LOCKABLE ), 369 US_FL_NOT_LOCKABLE ),
427 370
428/* Reported by Stefan de Konink <skinkie@xs4all.nl> */
429UNUSUAL_DEV( 0x04b0, 0x0401, 0x0200, 0x0200,
430 "NIKON",
431 "NIKON DSC D100",
432 US_SC_DEVICE, US_PR_DEVICE, NULL,
433 US_FL_FIX_CAPACITY),
434
435/* Reported by Tobias Kunze Briseno <t-linux@fictive.com> */
436UNUSUAL_DEV( 0x04b0, 0x0403, 0x0200, 0x0200,
437 "NIKON",
438 "NIKON DSC D2H",
439 US_SC_DEVICE, US_PR_DEVICE, NULL,
440 US_FL_FIX_CAPACITY),
441
442/* Reported by Milinevsky Dmitry <niam.niam@gmail.com> */
443UNUSUAL_DEV( 0x04b0, 0x0409, 0x0100, 0x0100,
444 "NIKON",
445 "NIKON DSC D50",
446 US_SC_DEVICE, US_PR_DEVICE, NULL,
447 US_FL_FIX_CAPACITY),
448
449/* Reported by Andreas Bockhold <andreas@bockionline.de> */
450UNUSUAL_DEV( 0x04b0, 0x0405, 0x0100, 0x0100,
451 "NIKON",
452 "NIKON DSC D70",
453 US_SC_DEVICE, US_PR_DEVICE, NULL,
454 US_FL_FIX_CAPACITY),
455
456/* Reported by Jamie Kitson <jamie@staberinde.fsnet.co.uk> */
457UNUSUAL_DEV( 0x04b0, 0x040d, 0x0100, 0x0100,
458 "NIKON",
459 "NIKON DSC D70s",
460 US_SC_DEVICE, US_PR_DEVICE, NULL,
461 US_FL_FIX_CAPACITY),
462
463/* Reported by Graber and Mike Pagano <mpagano-kernel@mpagano.com> */
464UNUSUAL_DEV( 0x04b0, 0x040f, 0x0100, 0x0200,
465 "NIKON",
466 "NIKON DSC D200",
467 US_SC_DEVICE, US_PR_DEVICE, NULL,
468 US_FL_FIX_CAPACITY),
469
470/* Reported by Emil Larsson <emil@swip.net> */
471UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0111,
472 "NIKON",
473 "NIKON DSC D80",
474 US_SC_DEVICE, US_PR_DEVICE, NULL,
475 US_FL_FIX_CAPACITY),
476
477/* Reported by Ortwin Glueck <odi@odi.ch> */
478UNUSUAL_DEV( 0x04b0, 0x0413, 0x0110, 0x0111,
479 "NIKON",
480 "NIKON DSC D40",
481 US_SC_DEVICE, US_PR_DEVICE, NULL,
482 US_FL_FIX_CAPACITY),
483
484/* Reported by Paul Check <paul@openstreet.com> */
485UNUSUAL_DEV( 0x04b0, 0x0415, 0x0100, 0x0100,
486 "NIKON",
487 "NIKON DSC D2Xs",
488 US_SC_DEVICE, US_PR_DEVICE, NULL,
489 US_FL_FIX_CAPACITY),
490
491/* Reported by Shan Destromp (shansan@gmail.com) */
492UNUSUAL_DEV( 0x04b0, 0x0417, 0x0100, 0x0100,
493 "NIKON",
494 "NIKON DSC D40X",
495 US_SC_DEVICE, US_PR_DEVICE, NULL,
496 US_FL_FIX_CAPACITY),
497
498/* Reported by paul ready <lxtwin@homecall.co.uk> */
499UNUSUAL_DEV( 0x04b0, 0x0419, 0x0100, 0x0200,
500 "NIKON",
501 "NIKON DSC D300",
502 US_SC_DEVICE, US_PR_DEVICE, NULL,
503 US_FL_FIX_CAPACITY),
504
505/* Reported by Doug Maxey (dwm@austin.ibm.com) */ 371/* Reported by Doug Maxey (dwm@austin.ibm.com) */
506UNUSUAL_DEV( 0x04b3, 0x4001, 0x0110, 0x0110, 372UNUSUAL_DEV( 0x04b3, 0x4001, 0x0110, 0x0110,
507 "IBM", 373 "IBM",
@@ -2185,27 +2051,6 @@ UNUSUAL_DEV( 0x22b8, 0x3010, 0x0001, 0x0001,
2185 US_FL_FIX_CAPACITY | US_FL_IGNORE_RESIDUE ), 2051 US_FL_FIX_CAPACITY | US_FL_IGNORE_RESIDUE ),
2186 2052
2187/* 2053/*
2188 * Patch by Pete Zaitcev <zaitcev@redhat.com>
2189 * Report by Mark Patton. Red Hat bz#208928.
2190 * Added support for rev 0x0002 (Motorola ROKR W5)
2191 * by Javier Smaldone <javier@smaldone.com.ar>
2192 */
2193UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x0002,
2194 "Motorola",
2195 "RAZR V3i/ROKR W5",
2196 US_SC_DEVICE, US_PR_DEVICE, NULL,
2197 US_FL_FIX_CAPACITY),
2198
2199/*
2200 * Patch by Jost Diederichs <jost@qdusa.com>
2201 */
2202UNUSUAL_DEV(0x22b8, 0x6410, 0x0001, 0x9999,
2203 "Motorola Inc.",
2204 "Motorola Phone (RAZRV3xx)",
2205 US_SC_DEVICE, US_PR_DEVICE, NULL,
2206 US_FL_FIX_CAPACITY),
2207
2208/*
2209 * Patch by Constantin Baranov <const@tltsu.ru> 2054 * Patch by Constantin Baranov <const@tltsu.ru>
2210 * Report by Andreas Koenecke. 2055 * Report by Andreas Koenecke.
2211 * Motorola ROKR Z6. 2056 * Motorola ROKR Z6.