The patch below adds support to the usb-storage driver for detecting when
a USB disk is write-protected. This support was removed several kernel
generations ago because several devices reacted badly to it. Now I would
like to add it back in, this time doing it the same way that Windows does
so that it should be acceptable to the devices.
Before this is merged into the kernel, though, we need to know that it
won't cause just as many problems as the old code used to. So I'm asking
for volunteers to test the patch with their USB disk drives and verify
that it doesn't mess anything up. The patch ought to apply cleanly to
2.6.6-mm or vanilla 2.6.6.
Thanks for your help!
Alan Stern
===== drivers/usb/storage/scsiglue.c 1.73 vs edited =====
--- 1.73/drivers/usb/storage/scsiglue.c Wed Apr 14 13:12:47 2004
+++ edited/drivers/usb/storage/scsiglue.c Mon Apr 26 11:50:21 2004
@@ -48,6 +48,7 @@
#include "usb.h"
#include "debug.h"
#include "transport.h"
+#include "protocol.h"
#include <linux/slab.h>
#include <linux/module.h>
@@ -70,8 +71,17 @@
* Set default bflags. These can be overridden for individual
* models and vendors via the scsi devinfo mechanism.
*/
- sdev->sdev_bflags = (BLIST_MS_SKIP_PAGE_08 | BLIST_MS_SKIP_PAGE_3F |
- BLIST_USE_10_BYTE_MS);
+
+ /* By default, USB mass storage devices use MODE SENSE(10).
+ * By default, use 192 byte transfers for MODE SENSE with page=x3f.
+ * We don't know how reliable MODE SENSE page x08 is, so for
+ * now skip it by default.
+ sdev->sdev_bflags = (BLIST_USE_10_BYTE_MS |
+ BLIST_MS_192_BYTES_FOR_3F |
+ BLIST_MS_SKIP_PAGE_08);
+ /* Maybe add an unusual_devs flag for BLIST_MS_SKIP_PAGE_3F if
+ * too many devices fail to support it. */
+
return 0;
}
@@ -99,7 +109,24 @@
us->pusb_dev->speed == USB_SPEED_HIGH)
blk_queue_max_sectors(sdev->request_queue, 128);
- /* this is to satisify the compiler, tho I don't think the
+ /* We can't put these settings in slave_alloc() because that gets
+ * called before the device type is known. Consequently these
+ * settings can't be overridden via the scsi devinfo mechanism. */
+ if (sdev->type == TYPE_DISK) {
+
+ /* Disk-type devices use MODE SENSE(6) if the protocol
+ * (SubClass) is Transparent SCSI */
+ if (us->subclass == US_SC_SCSI)
+ sdev->use_10_for_ms = 0;
+ } else {
+
+ /* Non-disk-type devices don't need to blacklist page x08
+ * or to force 192 byte transfer lengths for MODE SENSE. */
+ sdev->skip_ms_page_8 = 0;
+ sdev->use_192_bytes_for_3f = 0;
+ }
+
+ /* this is to satisfy the compiler, tho I don't think the
* return code is ever checked anywhere. */
return 0;
}
-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users