On Tue, Nov 04, 2014 at 01:01:00PM +0000, Mark Knibbs wrote: > > This patch does two things for SCM eUSCSI USB-SCSI converters: > > 1. SCM eUSCSI bridge devices are hard-wired to use SCSI ID 7. On connecting > the converter, access to that ID is attempted during the bus scan. Asking > the converter to issue INQUIRY commands to itself isn't very polite and > wastes time. Set this_id to 7 so __scsi_scan_target() skips it in the scan. > > 2. Enable multi-LUN support. eUSCSI devices don't support Get Max LUN > requests, returning an error (-32). [Different targets could have different > numbers of LUNs, so it wouldn't make sense to return a particular value in > response to Get Max LUN.] > > usb_stor_scan_dwork() does this: > /* For bulk-only devices, determine the max LUN value */ > if (us->protocol == USB_PR_BULK && !(us->fflags & US_FL_SINGLE_LUN)) { > mutex_lock(&us->dev_mutex); > us->max_lun = usb_stor_Bulk_max_lun(us); > mutex_unlock(&us->dev_mutex); > > It avoids calling usb_stor_Bulk_max_lun() if US_FL_SINGLE_LUN, but not for > US_FL_SCM_MULT_TARG. Since usb_stor_Bulk_max_lun() returns 0 in the error > case, us->max_lun was always set to 0. > > [If the user doesn't want multi-LUN support (perhaps there are SCSI devices > which respond to commands on all LUNs?), the US_FL_SINGLE_LUN quirk can be > specified on the kernel command line.] > > > Signed-off-by: Mark Knibbs <markk@xxxxxxxxxxx> > > --- > diff -up linux-3.17/drivers/usb/storage/usb.c.orig linux-3.17/drivers/usb/storage/usb.c > --- linux-3.17/drivers/usb/storage/usb.c.orig 2014-10-05 20:23:04.000000000 +0100 > +++ linux-3.17/drivers/usb/storage/usb.c 2014-10-16 22:11:31.000000000 +0100 > @@ -877,7 +877,9 @@ static void usb_stor_scan_dwork(struct w > dev_dbg(dev, "starting scan\n"); > > /* For bulk-only devices, determine the max LUN value */ > - if (us->protocol == USB_PR_BULK && !(us->fflags & US_FL_SINGLE_LUN)) { > + if (us->protocol == USB_PR_BULK && > + !(us->fflags & US_FL_SINGLE_LUN) && > + !(us->fflags & US_FL_SCM_MULT_TARG)) { > mutex_lock(&us->dev_mutex); > us->max_lun = usb_stor_Bulk_max_lun(us); > mutex_unlock(&us->dev_mutex); > @@ -976,13 +978,24 @@ int usb_stor_probe2(struct us_data *us) > usb_stor_dbg(us, "Transport: %s\n", us->transport_name); > usb_stor_dbg(us, "Protocol: %s\n", us->protocol_name); > > + if (us->fflags & US_FL_SCM_MULT_TARG) { > + /* > + * SCM eUSCSI bridge devices can have different numbers > + * of LUNs on different targets; allow all to be probed. > + */ > + us->max_lun = 7; > + /* The eUSCSI itself has ID 7, so avoid scanning that */ > + us_to_host(us)->this_id = 7; > + /* max_id is 8 initially, so no need to set it here */ > + } else { > + /* In the normal case there is only a single target */ > + us_to_host(us)->max_id = 1; > + } > + > /* fix for single-lun devices */ > if (us->fflags & US_FL_SINGLE_LUN) > us->max_lun = 0; > > - if (!(us->fflags & US_FL_SCM_MULT_TARG)) > - us_to_host(us)->max_id = 1; > - > /* Find the endpoints and calculate pipe values */ > result = get_pipes(us); > if (result) This too doesn't apply, can you please refresh it and resend? thanks, greg k-h -- 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