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 Wed, Jun 17, 2015 at 10:28:26AM +0800, Xuebing Wang wrote:
> 
> 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".

Look at Windows' disk utility, or whatever it's called. You might have
to initialize the disk or something. I'm not sure if Win7 still supports
vfat properly, I thought they had already moved on to exfat.

In any case, you might want to run your current setup through USB20CV
and USB30CV MSC test cases, while at that, also run Chapter 9 from both
tools. If they both work fine, then the problem is more likely to be on
Windows, then on Linux.

Also, enable debugging messages, capture and send full serial console
logs of what's going on (remember to run 'echo 9 >
/proc/sysrq-trigger').  Preferrably starting from boot, so we can see
all steps necessary to reproduce the problem.

cheers

-- 
balbi

Attachment: signature.asc
Description: Digital signature


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

  Powered by Linux