Re: g_mass_storage emulation of flash drive - difficulties with passing vendor/product ID

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

 



On Fri, 7 Jul 2017, Alan Robertson wrote:

> Sorry to return to this topic & appreciate it might be either specific
> to either the Pi or the system(s) I'm connecting it to, but have now
> had time to try a few more combinations out and would appreciate any
> thoughts from the experts here.
> 
> To give some extra background - I've got the Pi configured to
> automatically overwrite the mass storage device filestore upon boot,
> so it is always presenting a fresh filesystem.  Each system below is
> made by a different manufacturer and is a closed system, so I have no
> ability to perform any diagnostics at that end.
> 
> System 1 - Always works
> System 2 - Shows no USB stick connected
> System 3 - Gives error when trying to save (memory error)
> System 4 - Says unidentified USB
> (Windows PC - Always works)
> (Linux PC - Always works)
> 
> At first I thought this was due to minor subtleties of how the
> g_mass_storage device was being presented as a standard Sandisk USB
> memory stick works fine in all systems.
> 
> However I then started to notice some unusual behaviour, if rather
> than doing a reboot (and wiping it fresh), I kept the power running
> and moved it between machines.
> 
> If I started with System 1 first, then systems 2, 3, 4 would all
> recognise/write to it OK.
> 
> I then copied a backup of the filesystem after it had been in System 1
> - however that still didn't seem to solve the problem after a reboot.
> What I did then notice though was that if I powered the Pi up and then
> first connected it to a Windows system it then worked fine when
> plugged in to the others.  To be clear I didn't read/write any files
> to the device, just started it up, then plugged it into Windows, saw
> the home directory on the USB open, then unplugged it and plugged it
> into one of the other systems - they all now recognised it.
> 
> I tried starting/stopping g_mass_storage but that in itself didn't
> seem to do it.

Sorry, this is unclear.  

     1. By starting/stopping g_mass_storage, do you mean doing:

		rmmod g_mass_storage
		modprobe g_mass_storage file=...

     2. Did you start/stop g_mass_storage after plugging the device 
	into a Windows system or System 1?  Or did you do this after
	booting the device but not plugging it into anything?

     3. By "that in itself didn't seem to do it", do you mean that 
	starting/stopping g_mass_storage resulted in no change to the
	behavior?  Or did it always lead to a failure when the device
	was attached to systems 2 - 4, even if it had been plugged into
	System 1 before the start/stop?

> To be honest I'm now a bit flummoxed!  It is clearly able to work with
> all 4 systems (I've been able to save files from them), but it seems
> to want to be plugged into either a PC or System 1 first before then
> working with the others.  Can anyone think of anything that is
> happening when I do this?  Unfortunately the idea of doing it this way
> is just not workable for what I'm wanting to do.  Ideally I would have
> 1 Pi for each system, plugged into it just by the one USB data/power
> cable such that when the system powered on the Pi booted and then the
> USB was available to it to read/write.

Did you try enabling verbose debugging in g_mass_storage?  This
requires setting CONFIG_USB_GADGET_DEBUG and CONFIG_USB_GADGET_VERBOSE
in the kernel configuration and then rebuilding g_mass_storage.ko.  
And at runtime you may need to enable dynamic debugging by doing

	echo 'module g_mass_storage =p' >/sys/kernel/dynamic_debug/control

before plugging the device into anything.  Then compare the contents of
the dmesg log for the different scenarios.  In particular, look for
differences between plugging it into System 2 (say) right after boot
vs. after plugging it into System 1.

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