Re: [linux-usb] how to pass parameters to mass storage kernel module for best host compatibility

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 16 Jun 2015, Xuebing Wang wrote:

> Hi Alan and community,
> 
> I am using mass storage kernel module of v4.0.1 for Freescale i.MX6SL 
> for a commercial product. As this is commercial product, thus USB host 
> compatibility is important.
> 
> 1) It seems that Windows 7 host can *not* auto-mount if I pass 
> parameters as below:
> modprobe g_mass_storage file=/dev/mmcblk0p4 iSerialNumber=abcdefgh nofua=1

Have you read this sentence from the USB Mass Storage Class Bulk-Only 
Transport specification (section 4.1.1 Serial Number)?

	The serial number shall contain at least 12 valid digits, 
	represented as a UNICODE string.

I don't know if Windows pays any attention to the length of the serial 
number string, but it might.  Also, take a look at section 4.1.2 Valid 
Serial Number characters: It lists '0' - '9' and 'A' - 'F' but not 'a' 
and certainly not 'g' or 'h'.

> 2) Windows 7 can auto-mount, if I pass pass parameters as below (with 
> removable=1)
> modprobe g_mass_storage file=/dev/mmcblk0p4 iSerialNumber=abcdefgh 
> nofua=1 removable=1
> 
> But, there is a problem. If I eject the removable disk from Win7, 
> disconnect USB cable, and re-connect the USB cable, the removable disk 
> can NOT be auto-mounted on Win7.

Well, sure.  The same thing happens with real USB storage devices.  
For example, if you eject a CDROM from a USB CD player, the removable
CD can't be auto-mounted until you put a CDROM back into the player.  
Unplugging and re-connecting the USB cable won't help.

> It seems this makes sense, because Documentation/usb/mass-storage.txt 
> says below:
> ------
> If this option (removable=1) is set for a logical unit, gadget will 
> accept an
> “eject” SCSI request (Start/Stop Unit).  When it is sent, the
> backing file will be closed to simulate ejection and the logical
> unit will not be mountable by the host until a new backing file is
> specified by userspace on the device (see “sysfs entries”
> section).
> ------
> 
> Would you please advise what is the best way to pass parameters to 
> g_mass_storage considering host compatibility?

This has nothing to do with parameters.  If you want the storage to be 
auto-mounted, don't eject it!  Use the "Safely remove hardware" button 
in Windows instead.

Also, what happens if you specify a _valid_ serial number and leave out 
the "removable=1" parameter?

Alan Stern

--
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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux