ChangeSet 1.2181.4.63, 2005/03/24 15:14:10-08:00, [EMAIL PROTECTED]

        [PATCH] USB Storage: remove RW_DETECT from being a config option
        
        This patch started life as as454b from Alan Stern.  It has been rediffed
        against the tip, including updates for the way unusual_devs flags are
        defined.
        
        This patch removes the Kconfig option USB_STORAGE_RW_DETECT.  That 
option
        was used to enable/supress the attempt to detect if a device was write
        protected.
        
        It seems that the vast majority of devices properly respond to the 
latest
        algorithm for making that determination.  So now we move to excluding 
only
        those devices that can't handle it.  We accomplish this via the
        unusual_devs.h list.
        
        Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
        Signed-off-by: Matthew Dharm <[EMAIL PROTECTED]>
        Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>



 Kconfig        |   22 ----------------------
 scsiglue.c     |   18 ++++++++++--------
 unusual_devs.h |    9 ++++++++-
 usb.h          |    2 ++
 4 files changed, 20 insertions(+), 31 deletions(-)


diff -Nru a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
--- a/drivers/usb/storage/Kconfig       2005-03-30 15:17:32 -08:00
+++ b/drivers/usb/storage/Kconfig       2005-03-30 15:17:32 -08:00
@@ -31,28 +31,6 @@
          Say Y here in order to have the USB Mass Storage code generate
          verbose debugging messages.
 
-config USB_STORAGE_RW_DETECT
-       bool "USB Mass Storage Write-Protected Media Detection (EXPERIMENTAL)"
-       depends on USB_STORAGE && EXPERIMENTAL
-       help
-         Say Y here in order to have the USB Mass Storage code indicate to
-         the SCSI layer that using MODE SENSE(6) and MODE SENSE(10) to
-         determine if the media is write-protected is a good thing to do.
-
-         Many devices have historically had trouble with these commands,
-         hence the default 2.6.x behavior has been to suppress their use.
-         2.4.x used these commands with (at best) mixed results, often
-         crashing the firmware of the device.  However, the SCSI layer now
-         issues these commands in a manner more consistent with other
-         "popular" OSes, in an attempt to improve compatibility.
-
-         Saying Y here allows these commands to be sent to a USB device.
-         If you find a device this doesn't work for, switch to N and let
-         us know at <[EMAIL PROTECTED]>
-
-         If you say N here, the kernel will assume that all disk-like USB
-         devices are write-enabled.
-
 config USB_STORAGE_DATAFAB
        bool "Datafab Compact Flash Reader support (EXPERIMENTAL)"
        depends on USB_STORAGE && EXPERIMENTAL
diff -Nru a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
--- a/drivers/usb/storage/scsiglue.c    2005-03-30 15:17:32 -08:00
+++ b/drivers/usb/storage/scsiglue.c    2005-03-30 15:17:32 -08:00
@@ -136,17 +136,19 @@
                 * 192 bytes (that's what Windows uses). */
                sdev->use_192_bytes_for_3f = 1;
 
+               /* Some devices don't like MODE SENSE with page=0x3f,
+                * which is the command used for checking if a device
+                * is write-protected.  Now that we tell the sd driver
+                * to do a 192-byte transfer with this command the
+                * majority of devices work fine, but a few still can't
+                * handle it.  The sd driver will simply assume those
+                * devices are write-enabled. */
+               if (us->flags & US_FL_NO_WP_DETECT)
+                       sdev->skip_ms_page_3f = 1;
+
                /* A number of devices have problems with MODE SENSE for
                 * page x08, so we will skip it. */
                sdev->skip_ms_page_8 = 1;
-
-#ifndef CONFIG_USB_STORAGE_RW_DETECT
-               /* Some devices may not like MODE SENSE with page=0x3f.
-                * Now that we're using 192-byte transfers this may no
-                * longer be a problem.  So this will be a configuration
-                * option. */
-               sdev->skip_ms_page_3f = 1;
-#endif
 
                /* Some disks return the total number of blocks in response
                 * to READ CAPACITY rather than the highest block number.
diff -Nru a/drivers/usb/storage/unusual_devs.h 
b/drivers/usb/storage/unusual_devs.h
--- a/drivers/usb/storage/unusual_devs.h        2005-03-30 15:17:32 -08:00
+++ b/drivers/usb/storage/unusual_devs.h        2005-03-30 15:17:32 -08:00
@@ -349,7 +349,7 @@
                "Sony",
                "DSC-S30/S70/S75/505V/F505/F707/F717/P8", 
                US_SC_SCSI, US_PR_DEVICE, NULL,
-               US_FL_SINGLE_LUN | US_FL_NOT_LOCKABLE ),
+               US_FL_SINGLE_LUN | US_FL_NOT_LOCKABLE | US_FL_NO_WP_DETECT ),
 
 /* This entry is needed because the device reports Sub=ff */
 UNUSUAL_DEV(  0x054c, 0x0010, 0x0500, 0x0500, 
@@ -953,6 +953,13 @@
                "Flash Disk",
                US_SC_DEVICE, US_PR_DEVICE, NULL,
                US_FL_IGNORE_RESIDUE ),
+
+/* Reported by Michael Stattmann <[EMAIL PROTECTED]> */
+UNUSUAL_DEV(  0x0fce, 0xd008, 0x0000, 0x0000,
+               "Sony Ericsson",
+               "V800-Vodafone 802",
+               US_SC_DEVICE, US_PR_DEVICE, NULL,
+               US_FL_NO_WP_DETECT ),
 
 /* Reported by Kevin Cernekee <[EMAIL PROTECTED]>
  * Tested on hardware version 1.10.
diff -Nru a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
--- a/drivers/usb/storage/usb.h 2005-03-30 15:17:32 -08:00
+++ b/drivers/usb/storage/usb.h 2005-03-30 15:17:32 -08:00
@@ -89,6 +89,8 @@
                /* PREVENT/ALLOW not supported */               \
        US_FLAG(GO_SLOW,        0x00000100)                     \
                /* Need delay after Command phase */            \
+       US_FLAG(NO_WP_DETECT,   0x00000200)                     \
+               /* Don't check for write-protect */             \
 
 #define US_FLAG(name, value)   US_FL_##name = value ,
 enum { US_DO_ALL_FLAGS };
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to