On Mon, 17 May 2004 [EMAIL PROTECTED] wrote:

> Thank you for your response. Do you have the same usb-pen device 
> (Ritek)? As I post in http://qa.mandrakesoft.com/show_bug.cgi?id=9716 I 
> have two different usb-pen devices but I only have problems with one of 
> them (the Ritek one), and only with kernel >= 2.6.5. I am usually 
> running kernel 2.6.3 and this usb device works. I tested it with kernel 
> 2.6.4 and it works too. It seems to be that something is changed after 
> kernel 2.6.5 and this device seems to block something in the usb 
> subsystem (after plugging the drive, if I type 'cat 
> /proc/bus/usb/devices', the command hangs).
> I applied your patch to drivers/scsi/sd.c and drivers/scsi/scsi_scan.c, 
> recompiled and installed the kernel. After rebooting, I plugged the 
> device. Please find attached the new report. I hope it will help, but 
> anyway, please let me know if I can do something to help solving this 
> problem. Thank you.
> 
> Oscar.

The log you sent helped, and I think I've found the reason this is
happening.  There's a built-in SCSI blacklist entry for vendor="Generic"  
that is overriding the settings you need.

Here's a different patch for you to try instead of the other one.  I think
this will prevent things from going wrong.

Matt, this is as226d, an update to a patch I sent out earlier.  This also 
includes the Genesys max_sector change.

Alan Stern



===== drivers/usb/storage/scsiglue.c 1.74 vs edited =====
--- 1.74/drivers/usb/storage/scsiglue.c Sat Apr 24 22:25:50 2004
+++ edited/drivers/usb/storage/scsiglue.c       Mon May 17 16:21:56 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,28 @@
         * 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.
+        * Don't try to use more than 36 bytes for INQUIRY. */
+       sdev->sdev_bflags = (BLIST_USE_10_BYTE_MS |
+                       BLIST_MS_192_BYTES_FOR_3F |
+                       BLIST_MS_SKIP_PAGE_08 |
+                       BLIST_INQUIRY_36);
+
+       /* Maybe add an unusual_devs flag for BLIST_MS_SKIP_PAGE_3F if
+        * too many devices fail to support it. */
+
+       /* We don't want these entries to be overridden by scsi devinfo
+        * entries, so we'll set them again in a more secure form.  (This
+        * makes most of the entries above unnecessary.)  Some of these
+        * may be changed in slave_configure() below. */
+       sdev->use_10_for_ms = 1;
+       sdev->use_192_bytes_for_3f = 1;
+       sdev->skip_ms_page_8 = 1;
+
        return 0;
 }
 
@@ -95,11 +116,30 @@
         * 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 */
+               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: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

Reply via email to