On Fri, Aug 31, 2012 at 12:08 AM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote: > > On Thu, 30 Aug 2012, Alon Bar-Lev wrote: > > > I was trying to figure out if there can be automatic workaround based > > on USB vendor:product... If these exposed at this point then a patch > > can be written to effect only this device. > > > > I never traced the scsi module, but scsi_device does contain vendor, > > model and rev, maybe these can be mapped to the JMicron 20337 device > > and apply the workaround. > > Such a patch can be written. It would be more complicated than the > one I sent you, though, and I wanted to try the easier patch first. > > Alan Stern > I modified the patch to the following to make sure my main disk is unaffected: --- --- drivers/scsi/sd.c 2012-07-21 23:58:29.000000000 +0300 +++ drivers/scsi/sd.c.new 2012-08-31 19:47:15.822632952 +0300 @@ -1899,13 +1899,17 @@ static int sd_try_rc16_first(struct scsi { if (sdp->host->max_cmd_len < 16) return 0; - if (sdp->try_rc_10_first) - return 0; + if (sdp->try_rc_10_first) { + printk("@ALON: apply workaround 1"); + /*return 0;*/ + } if (sdp->scsi_level > SCSI_SPC_2) return 1; if (scsi_device_protection(sdp)) return 1; - return 0; + printk("@ALON: apply workaround 2"); + /*return 0;*/ + return 1; } /* --- This is what I get now, I guess detection is good now, but something in the IO is wrong, when plugged to computer's sata it works correctly. --- Sep 2 11:42:55 localhost kernel: Initializing USB Mass Storage driver... Sep 2 11:42:55 localhost kernel: scsi6 : usb-storage 2-1.1:1.0 Sep 2 11:42:55 localhost kernel: usbcore: registered new interface driver usb-storage Sep 2 11:42:55 localhost kernel: USB Mass Storage support registered. Sep 2 11:42:56 localhost kernel: scsi 6:0:0:0: Direct-Access WDC WD30 EZRX-00MMMB0 PQ: 0 ANSI: 5 Sep 2 11:42:56 localhost kernel: sd 6:0:0:0: Attached scsi generic sg2 type 0 Sep 2 11:42:56 localhost kernel: @ALON: apply workaround 1 Sep 2 11:42:56 localhost kernel: sd 6:0:0:0: [sdb] 5860533168 512-byte logical blocks: (3.00 TB/2.72 TiB) Sep 2 11:42:56 localhost kernel: sd 6:0:0:0: [sdb] Write Protect is off Sep 2 11:42:56 localhost kernel: sd 6:0:0:0: [sdb] Mode Sense: 28 00 00 00 Sep 2 11:42:56 localhost kernel: sd 6:0:0:0: [sdb] No Caching mode page present Sep 2 11:42:56 localhost kernel: sd 6:0:0:0: [sdb] Assuming drive cache: write through Sep 2 11:42:56 localhost kernel: @ALON: apply workaround 1 Sep 2 11:42:56 localhost kernel: sd 6:0:0:0: [sdb] No Caching mode page present Sep 2 11:42:56 localhost kernel: sd 6:0:0:0: [sdb] Assuming drive cache: write through Sep 2 11:42:56 localhost kernel: usb 2-1.1: reset high-speed USB device number 7 using ehci_hcd Sep 2 11:42:56 localhost kernel: usb 2-1.1: reset high-speed USB device number 7 using ehci_hcd Sep 2 11:42:56 localhost kernel: usb 2-1.1: reset high-speed USB device number 7 using ehci_hcd Sep 2 11:42:57 localhost kernel: usb 2-1.1: reset high-speed USB device number 7 using ehci_hcd Sep 2 11:42:57 localhost kernel: usb 2-1.1: reset high-speed USB device number 7 using ehci_hcd Sep 2 11:42:57 localhost kernel: sd 6:0:0:0: [sdb] Unhandled error code Sep 2 11:42:57 localhost kernel: sd 6:0:0:0: [sdb] Sep 2 11:42:57 localhost kernel: Result: hostbyte=0x07 driverbyte=0x00 Sep 2 11:42:57 localhost kernel: sd 6:0:0:0: [sdb] CDB: Sep 2 11:42:57 localhost kernel: cdb[0]=0x28: 28 00 00 00 00 00 00 00 08 00 Sep 2 11:42:57 localhost kernel: end_request: I/O error, dev sdb, sector 0 Sep 2 11:42:57 localhost kernel: Buffer I/O error on device sdb, logical block 0 Sep 2 11:42:57 localhost kernel: usb 2-1.1: reset high-speed USB device number 7 using ehci_hcd Sep 2 11:42:57 localhost kernel: usb 2-1.1: reset high-speed USB device number 7 using ehci_hcd Sep 2 11:42:57 localhost kernel: usb 2-1.1: reset high-speed USB device number 7 using ehci_hcd Sep 2 11:42:58 localhost kernel: usb 2-1.1: reset high-speed USB device number 7 using ehci_hcd Sep 2 11:42:58 localhost kernel: usb 2-1.1: reset high-speed USB device number 7 using ehci_hcd Sep 2 11:42:58 localhost kernel: usb 2-1.1: reset high-speed USB device number 7 using ehci_hcd Sep 2 11:42:58 localhost kernel: sd 6:0:0:0: [sdb] Unhandled error code Sep 2 11:42:58 localhost kernel: sd 6:0:0:0: [sdb] Sep 2 11:42:58 localhost kernel: Result: hostbyte=0x07 driverbyte=0x00 Sep 2 11:42:58 localhost kernel: sd 6:0:0:0: [sdb] CDB: Sep 2 11:42:58 localhost kernel: cdb[0]=0x28: 28 00 00 00 00 00 00 00 08 00 Sep 2 11:42:58 localhost kernel: end_request: I/O error, dev sdb, sector 0 Sep 2 11:42:58 localhost kernel: Buffer I/O error on device sdb, logical block 0 <continue in a loop different blocks> --- Alon -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html