Commit a81a81a2 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

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: default avatarAlan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent c838ea46
...@@ -59,6 +59,13 @@ ...@@ -59,6 +59,13 @@
#include "transport.h" #include "transport.h"
#include "protocol.h" #include "protocol.h"
/* Vendor IDs for companies that seem to include the READ CAPACITY bug
* in all their devices
*/
#define VENDOR_ID_NOKIA 0x0421
#define VENDOR_ID_NIKON 0x04b0
#define VENDOR_ID_MOTOROLA 0x22b8
/*********************************************************************** /***********************************************************************
* Host functions * Host functions
***********************************************************************/ ***********************************************************************/
...@@ -142,6 +149,22 @@ static int slave_configure(struct scsi_device *sdev) ...@@ -142,6 +149,22 @@ static int slave_configure(struct scsi_device *sdev)
* settings can't be overridden via the scsi devinfo mechanism. */ * settings can't be overridden via the scsi devinfo mechanism. */
if (sdev->type == TYPE_DISK) { if (sdev->type == TYPE_DISK) {
/* Some vendors seem to put the READ CAPACITY bug into
* all their devices -- primarily makers of cell phones
* and digital cameras. Since these devices always use
* flash media and can be expected to have an even number
* of sectors, we will always enable the CAPACITY_HEURISTICS
* flag unless told otherwise. */
switch (le16_to_cpu(us->pusb_dev->descriptor.idVendor)) {
case VENDOR_ID_NOKIA:
case VENDOR_ID_NIKON:
case VENDOR_ID_MOTOROLA:
if (!(us->fflags & (US_FL_FIX_CAPACITY |
US_FL_CAPACITY_OK)))
us->fflags |= US_FL_CAPACITY_HEURISTICS;
break;
}
/* Disk-type devices use MODE SENSE(6) if the protocol /* Disk-type devices use MODE SENSE(6) if the protocol
* (SubClass) is Transparent SCSI, otherwise they use * (SubClass) is Transparent SCSI, otherwise they use
* MODE SENSE(10). */ * MODE SENSE(10). */
......
...@@ -174,42 +174,6 @@ UNUSUAL_DEV( 0x0421, 0x0019, 0x0592, 0x0592, ...@@ -174,42 +174,6 @@ UNUSUAL_DEV( 0x0421, 0x0019, 0x0592, 0x0592,
US_SC_DEVICE, US_PR_DEVICE, NULL, US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_MAX_SECTORS_64 ), US_FL_MAX_SECTORS_64 ),
/* Reported by Filip Joelsson <filip@blueturtle.nu> */
UNUSUAL_DEV( 0x0421, 0x005d, 0x0001, 0x0600,
"Nokia",
"Nokia 3110c",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY ),
/* Reported by Ozan Sener <themgzzy@gmail.com> */
UNUSUAL_DEV( 0x0421, 0x0060, 0x0551, 0x0551,
"Nokia",
"3500c",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY ),
/* Reported by CSECSY Laszlo <boobaa@frugalware.org> */
UNUSUAL_DEV( 0x0421, 0x0063, 0x0001, 0x0601,
"Nokia",
"Nokia 3109c",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY ),
/* Patch for Nokia 5310 capacity */
UNUSUAL_DEV( 0x0421, 0x006a, 0x0000, 0x0701,
"Nokia",
"5310",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY ),
/* Submitted by Ricky Wong Yung Fei <evilbladewarrior@gmail.com> */
/* Nokia 7610 Supernova - Too many sectors reported in usb storage mode */
UNUSUAL_DEV( 0x0421, 0x00f5, 0x0000, 0x0470,
"Nokia",
"7610 Supernova",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY ),
/* Reported by Mario Rettig <mariorettig@web.de> */ /* Reported by Mario Rettig <mariorettig@web.de> */
UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100, UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100,
"Nokia", "Nokia",
...@@ -275,27 +239,6 @@ UNUSUAL_DEV( 0x0421, 0x0495, 0x0370, 0x0370, ...@@ -275,27 +239,6 @@ UNUSUAL_DEV( 0x0421, 0x0495, 0x0370, 0x0370,
US_SC_DEVICE, US_PR_DEVICE, NULL, US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_MAX_SECTORS_64 ), US_FL_MAX_SECTORS_64 ),
/* Reported by Cedric Godin <cedric@belbone.be> */
UNUSUAL_DEV( 0x0421, 0x04b9, 0x0500, 0x0551,
"Nokia",
"5300",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY ),
/* Reported by Paulo Fessel <pfessel@gmail.com> */
UNUSUAL_DEV( 0x0421, 0x04bd, 0x0000, 0x9999,
"Nokia",
"5200",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY ),
/* Reported by Richard Nauber <RichardNauber@web.de> */
UNUSUAL_DEV( 0x0421, 0x04fa, 0x0550, 0x0660,
"Nokia",
"6300",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY ),
/* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */ /* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */
UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210, UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210,
"SMSC", "SMSC",
...@@ -425,83 +368,6 @@ UNUSUAL_DEV( 0x04b0, 0x0301, 0x0010, 0x0010, ...@@ -425,83 +368,6 @@ UNUSUAL_DEV( 0x04b0, 0x0301, 0x0010, 0x0010,
US_SC_DEVICE, US_PR_DEVICE,NULL, US_SC_DEVICE, US_PR_DEVICE,NULL,
US_FL_NOT_LOCKABLE ), US_FL_NOT_LOCKABLE ),
/* Reported by Stefan de Konink <skinkie@xs4all.nl> */
UNUSUAL_DEV( 0x04b0, 0x0401, 0x0200, 0x0200,
"NIKON",
"NIKON DSC D100",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY),
/* Reported by Tobias Kunze Briseno <t-linux@fictive.com> */
UNUSUAL_DEV( 0x04b0, 0x0403, 0x0200, 0x0200,
"NIKON",
"NIKON DSC D2H",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY),
/* Reported by Milinevsky Dmitry <niam.niam@gmail.com> */
UNUSUAL_DEV( 0x04b0, 0x0409, 0x0100, 0x0100,
"NIKON",
"NIKON DSC D50",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY),
/* Reported by Andreas Bockhold <andreas@bockionline.de> */
UNUSUAL_DEV( 0x04b0, 0x0405, 0x0100, 0x0100,
"NIKON",
"NIKON DSC D70",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY),
/* Reported by Jamie Kitson <jamie@staberinde.fsnet.co.uk> */
UNUSUAL_DEV( 0x04b0, 0x040d, 0x0100, 0x0100,
"NIKON",
"NIKON DSC D70s",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY),
/* Reported by Graber and Mike Pagano <mpagano-kernel@mpagano.com> */
UNUSUAL_DEV( 0x04b0, 0x040f, 0x0100, 0x0200,
"NIKON",
"NIKON DSC D200",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY),
/* Reported by Emil Larsson <emil@swip.net> */
UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0111,
"NIKON",
"NIKON DSC D80",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY),
/* Reported by Ortwin Glueck <odi@odi.ch> */
UNUSUAL_DEV( 0x04b0, 0x0413, 0x0110, 0x0111,
"NIKON",
"NIKON DSC D40",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY),
/* Reported by Paul Check <paul@openstreet.com> */
UNUSUAL_DEV( 0x04b0, 0x0415, 0x0100, 0x0100,
"NIKON",
"NIKON DSC D2Xs",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY),
/* Reported by Shan Destromp (shansan@gmail.com) */
UNUSUAL_DEV( 0x04b0, 0x0417, 0x0100, 0x0100,
"NIKON",
"NIKON DSC D40X",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY),
/* Reported by paul ready <lxtwin@homecall.co.uk> */
UNUSUAL_DEV( 0x04b0, 0x0419, 0x0100, 0x0200,
"NIKON",
"NIKON DSC D300",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY),
/* Reported by Doug Maxey (dwm@austin.ibm.com) */ /* Reported by Doug Maxey (dwm@austin.ibm.com) */
UNUSUAL_DEV( 0x04b3, 0x4001, 0x0110, 0x0110, UNUSUAL_DEV( 0x04b3, 0x4001, 0x0110, 0x0110,
"IBM", "IBM",
...@@ -2184,27 +2050,6 @@ UNUSUAL_DEV( 0x22b8, 0x3010, 0x0001, 0x0001, ...@@ -2184,27 +2050,6 @@ UNUSUAL_DEV( 0x22b8, 0x3010, 0x0001, 0x0001,
US_SC_DEVICE, US_PR_DEVICE, NULL, US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY | US_FL_IGNORE_RESIDUE ), US_FL_FIX_CAPACITY | US_FL_IGNORE_RESIDUE ),
/*
* Patch by Pete Zaitcev <zaitcev@redhat.com>
* Report by Mark Patton. Red Hat bz#208928.
* Added support for rev 0x0002 (Motorola ROKR W5)
* by Javier Smaldone <javier@smaldone.com.ar>
*/
UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x0002,
"Motorola",
"RAZR V3i/ROKR W5",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY),
/*
* Patch by Jost Diederichs <jost@qdusa.com>
*/
UNUSUAL_DEV(0x22b8, 0x6410, 0x0001, 0x9999,
"Motorola Inc.",
"Motorola Phone (RAZRV3xx)",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY),
/* /*
* Patch by Constantin Baranov <const@tltsu.ru> * Patch by Constantin Baranov <const@tltsu.ru>
* Report by Andreas Koenecke. * Report by Andreas Koenecke.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment