On Thu, 20 Apr 2017, Andreas Hartmann wrote:

> >> Apr 19 19:25:39 notebook2 kernel: scsi host6: scsi scan: INQUIRY result 
> >> too short (5), using 36
> >
> > But that is wrong!  Even though it's for a working test.  It means the
> > usb_stor_set_xfer_buf() subroutine isn't doing what it should.
> >
> > Please apply the following debugging patch (on top of the previous one)
> > and let's see what it prints in the kernel log.
> 
> 
> These are the log entries. I'm not sure if they contain what you expected:

No, they don't.  But they do indicate where the problem lies.

> ok 1
> 
> Apr 20 22:24:53 notebook2 kernel: usb 1-1.1: new high-speed USB device number 
> 3 using ehci-pci
> Apr 20 22:24:53 notebook2 kernel: usb 1-1.1: New USB device found, 
> idVendor=0cf2, idProduct=6250
> Apr 20 22:24:53 notebook2 kernel: usb 1-1.1: New USB device strings: Mfr=1, 
> Product=2, SerialNumber=4
> Apr 20 22:24:53 notebook2 kernel: usb 1-1.1: Product: UB6250
> Apr 20 22:24:53 notebook2 kernel: usb 1-1.1: Manufacturer: ENE Flash
> Apr 20 22:24:53 notebook2 kernel: usb 1-1.1: SerialNumber: 606569746801
> Apr 20 22:24:53 notebook2 mtp-probe[2246]: checking bus 1, device 3: 
> "/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1"
> Apr 20 22:24:53 notebook2 mtp-probe[2246]: bus: 1, device: 3 was not an MTP 
> device
> Apr 20 22:24:54 notebook2 kernel: usbcore: registered new interface driver 
> usb-storage
> Apr 20 22:24:54 notebook2 kernel: usbcore: registered new interface driver uas
> Apr 20 22:24:54 notebook2 kernel: ums_eneub6250 1-1.1:1.0: USB Mass Storage 
> device detected
> Apr 20 22:24:54 notebook2 kernel: scsi host6: usb-storage 1-1.1:1.0
> Apr 20 22:24:54 notebook2 kernel: usbcore: registered new interface driver 
> ums_eneub6250
> Apr 20 22:24:55 notebook2 kernel: usb 1-1.1: direct-loading 
> ene-ub6250/sd_init1.bin
> Apr 20 22:24:56 notebook2 kernel: usb 1-1.1: direct-loading 
> ene-ub6250/sd_init2.bin
> Apr 20 22:24:56 notebook2 kernel: scsi 6:0:0:0: Direct-Access                 
>                    PQ: 0 ANSI: 0

We should have seen a pair of "set_xfer_buf" lines before this.

> ok 2
> 
> Apr 20 22:25:51 notebook2 kernel: usb 1-1.1: new high-speed USB device number 
> 4 using ehci-pci
> Apr 20 22:25:51 notebook2 kernel: usb 1-1.1: New USB device found, 
> idVendor=0cf2, idProduct=6250
> Apr 20 22:25:51 notebook2 kernel: usb 1-1.1: New USB device strings: Mfr=1, 
> Product=2, SerialNumber=4
> Apr 20 22:25:51 notebook2 kernel: usb 1-1.1: Product: UB6250
> Apr 20 22:25:51 notebook2 kernel: usb 1-1.1: Manufacturer: ENE Flash
> Apr 20 22:25:51 notebook2 kernel: usb 1-1.1: SerialNumber: 606569746801
> Apr 20 22:25:51 notebook2 kernel: ums_eneub6250 1-1.1:1.0: USB Mass Storage 
> device detected
> Apr 20 22:25:51 notebook2 kernel: scsi host6: usb-storage 1-1.1:1.0
> Apr 20 22:25:51 notebook2 mtp-probe[2293]: checking bus 1, device 4: 
> "/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1"
> Apr 20 22:25:51 notebook2 mtp-probe[2293]: bus: 1, device: 4 was not an MTP 
> device
> Apr 20 22:25:52 notebook2 kernel: usb 1-1.1: direct-loading 
> ene-ub6250/sd_init1.bin
> Apr 20 22:25:53 notebook2 kernel: usb 1-1.1: direct-loading 
> ene-ub6250/sd_init2.bin
> Apr 20 22:25:53 notebook2 kernel: scsi host6: scsi scan: INQUIRY result too 
> short (5), using 36
> Apr 20 22:25:53 notebook2 kernel: scsi 6:0:0:0: Direct-Access                 
>                    PQ: 0 ANSI: 0

Same here.  So the reason usb_stor_set_xfer_buf() wasn't working is 
because it never got called!

Knowing that, it's easy to see where the bug is.  It's a completely 
different issue from the bad DMA problem.  In fact, I'm surprised that 
this driver ever worked at all.

Please try the patch below.  (You can remove the usb_stor_set_xfer_buf 
patch.)

Alan Stern



Index: usb-4.x/drivers/usb/storage/ene_ub6250.c
===================================================================
--- usb-4.x.orig/drivers/usb/storage/ene_ub6250.c
+++ usb-4.x/drivers/usb/storage/ene_ub6250.c
@@ -2295,21 +2295,22 @@ static int ms_scsi_irp(struct us_data *u
 
 static int ene_transport(struct scsi_cmnd *srb, struct us_data *us)
 {
-       int result = 0;
+       int result = USB_STOR_XFER_GOOD;
        struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra);
 
        /*US_DEBUG(usb_stor_show_command(us, srb)); */
        scsi_set_resid(srb, 0);
-       if (unlikely(!(info->SD_Status.Ready || info->MS_Status.Ready))) {
+       if (unlikely(!(info->SD_Status.Ready || info->MS_Status.Ready)))
                result = ene_init(us);
-       } else {
+       if (result == USB_STOR_XFER_GOOD) {
+               result = USB_STOR_TRANSPORT_ERROR;
                if (info->SD_Status.Ready)
                        result = sd_scsi_irp(us, srb);
 
                if (info->MS_Status.Ready)
                        result = ms_scsi_irp(us, srb);
        }
-       return 0;
+       return result;
 }
 
 static struct scsi_host_template ene_ub6250_host_template;

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to