Ian Morgan wrote:
I had a similar problem with different hardware see "smartcard reader kills usb hub on 2.6.5+, OK on 2.6.4" thread.On Wed, 23 Jun 2004, Ian E. Morgan wrote:
The only immediate thing that stands out to me is that in 2.4 the INQUIRY is
'12 00 00 00 FF 00' (Allocation length 255), while in 2.6 it is '12 00 00 00 24 00' (Allocation length 36 (makes sense)).
The attached Matthew Dharm patch (which should probably be in 2.6.8 per Alan Stern) fixed the problem for 2.6.5, 2.6.6 and all 2.6.7 varieties. There were no problems with 2.6.4.
The patch seems to make the MODE_SENSE command (try to) transfer 192 bytes rather than 4 bytes - results in "babble" since actual transfer length seems to be 8. After the data overrun, various combinations of [khubd], [usb-storage], and [scsi_eh_?] deadlock and the hub is effectively dead; attempted resets don't work.
Sorry I don't know enough to understand what's going on -- I'm learning.
Phil
diff -Nru a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig --- a/drivers/usb/storage/Kconfig Sun Jun 13 15:24:10 2004 +++ b/drivers/usb/storage/Kconfig Sun Jun 13 15:24:10 2004 @@ -23,6 +23,28 @@ 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 Sun Jun 13 15:24:10 2004 +++ b/drivers/usb/storage/scsiglue.c Sun Jun 13 15:24:10 2004 @@ -48,13 +48,13 @@ #include "usb.h" #include "debug.h" #include "transport.h" +#include "protocol.h" #include <linux/slab.h> #include <linux/module.h> #include <scsi/scsi_devinfo.h> #include <scsi/scsi_host.h> - /*********************************************************************** * Host functions ***********************************************************************/ @@ -68,10 +68,13 @@ { /* * Set default bflags. These can be overridden for individual - * models and vendors via the scsi devinfo mechanism. + * models and vendors via the scsi devinfo mechanism. The only + * flag we need is to force 36-byte INQUIRYs; we don't use any + * of the extra data and many devices choke if asked for more or + * less than 36 bytes. */ - sdev->sdev_bflags = (BLIST_MS_SKIP_PAGE_08 | BLIST_MS_SKIP_PAGE_3F | - BLIST_USE_10_BYTE_MS); + sdev->sdev_bflags = BLIST_INQUIRY_36; + return 0; } @@ -95,11 +98,48 @@ * reduce the maximum transfer size to 64 KB = 128 sectors. */ #define USB_VENDOR_ID_GENESYS 0x05e3 // Needs a standard location + if (us->pusb_dev->descriptor.idVendor == USB_VENDOR_ID_GENESYS && - us->pusb_dev->speed == USB_SPEED_HIGH) + us->pusb_dev->speed == USB_SPEED_HIGH && + sdev->request_queue->max_sectors > 128) 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, otherwise they use + * MODE SENSE(10). */ + if (us->subclass != US_SC_SCSI) + sdev->use_10_for_ms = 1; + + /* Many disks only accept MODE SENSE transfer lengths of + * 192 bytes (that's what Windows uses). */ + sdev->use_192_bytes_for_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 + + } else { + + /* Non-disk-type devices don't need to blacklist any pages + * or to force 192-byte transfer lengths for MODE SENSE. + * But they do need to use MODE SENSE(10). */ + sdev->use_10_for_ms = 1; + } + + /* this is to satisfy the compiler, tho I don't think the * return code is ever checked anywhere. */ return 0; }