Hi, Alan & All:

The 2.6.20-rc2 tree carries this patch (equivalent, actually):

> --- linux-2.6.18-1.2769.el5/drivers/usb/storage/scsiglue.c    2006-09-19 
> 20:42:06.000000000 -0700
> +++ linux-2.6.18-1.2769.el5-ufi/drivers/usb/storage/scsiglue.c        
> 2007-01-02 21:47:24.000000000 -0800
> @@ -72,12 +72,27 @@ static const char* host_info(struct Scsi
>  
>  static int slave_alloc (struct scsi_device *sdev)
>  {
> +     struct us_data *us = host_to_us(sdev->host);
> +
>       /*
>        * Set the INQUIRY transfer length to 36.  We don't use any of
>        * the extra data and many devices choke if asked for more or
>        * less than 36 bytes.
>        */
>       sdev->inquiry_len = 36;
> +
> +     /*
> +      * The UFI spec treates the Peripheral Qualifier bits in an
> +      * INQUIRY result as reserved and requires devices to set them
> +      * to 0.  However the SCSI spec requires these bits to be set
> +      * to 3 to indicate when a LUN is not present.
> +      *
> +      * Let the scanning code know if this target merely sets
> +      * Peripheral Device Type to 0x1f to indicate no LUN.
> +      */
> +     if (us->subclass == US_SC_UFI)
> +             sdev->sdev_target->pdt_1f_for_no_lun = 1;
> +
>       return 0;
>  }
>  

But it seems that I found a case when this does not work. It happens
with Sun's virtual floppy, which returns a seemingly normal INQUIRY
data (this is CBI, LUN set to 1, and device simply ignores it, most
likely):

ffff81003f5575c0 1779789944 S Co:004:00 s 21 00 0000 0000 000c 12 = 12200000 
24000000 00000000
ffff81003f5575c0 1779792226 C Co:004:00 0 12 >
ffff8100374c2980 1779792240 S Bi:004:01 -115 36 <
ffff8100374c2980 1779795215 C Bi:004:01 0 36 = 00800001 1f000000 414d4920 
20202020 56697274 75616c20 466c6f70 70792020
ffff81003f5575c0 1779795226 S Ii:004:03 -115 2 <
ffff81003f5575c0 1779821221 C Ii:004:03 0 2 = 0000

So this got me wondering, why do we use such curiously complicated
way of trimming LUNs instead of something like this:

--- linux-2.6.18-1.2769.el5/drivers/usb/storage/usb.c   2006-09-19 
20:42:06.000000000 -0700
+++ linux-2.6.18-1.2769.el5-ufi/drivers/usb/storage/usb.c       2007-01-03 
17:57:24.000000000 -0800
@@ -692,6 +692,7 @@ static int get_protocol(struct us_data *
        case US_SC_UFI:
                us->protocol_name = "Uniform Floppy Interface (UFI)";
                us->proto_handler = usb_stor_ufi_command;
+               us->max_lun = 0;
                break;
 
 #ifdef CONFIG_USB_STORAGE_ISD200

I verified this to work and solve my problem, whereas backporting the
code from 2.6.20-rc2 did not work.

Have anyone ever seen a multi-headed USB floppy?

-- Pete

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to