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 06/17/2015 10:19 AM, Felipe Balbi wrote:
On Wed, Jun 17, 2015 at 07:33:37AM +0800, Xuebing Wang wrote:
On 06/16/2015 10:32 PM, Alan Stern wrote:
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,

Thank you very much for your help. Using a valid serial number like below
(and without removable=1) can NOT get Win7 to auto-mount it.
modprobe g_mass_storage file=/dev/mmcblk0p4 iSerialNumber=123456789012
nofua=1

Will mass storage gadget driver convert from ASCII serial number to UNICODE?

Any ideas? Thanks again.
what's the error on Win7 ? Sure there's a valid filesystem on
/dev/mmcblk0p4 ? Which file system would that be ?

Felipe, thanks for chiming in.

There is no error on Win7, it's just that Win7 does not auto-mount it.

Yes, there is a valid filesystem on /dev/mmcblk0p4, it is formatted by "mkfs.fat -F 32 -n volumename /dev/mmcblk0p4".

Thanks again.
--
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