public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* Running multiple gadgets in mass storage mode?
@ 2020-06-15 23:06 Arpad Kun
  2020-06-16 11:06 ` Peter Chen
  0 siblings, 1 reply; 2+ messages in thread
From: Arpad Kun @ 2020-06-15 23:06 UTC (permalink / raw)
  To: linux-usb

Hi Everyone,

Seeking advice please on:   if it was possible to run multiple USB devices within the same Linux system in device mode and use g_mass_storage to emulate different "volumes" through each.

This is how far I got:
	- Have two  USB3380-EVB  boards hooked up in a Linux machine (x86)
	- I see both of them via `lspci`, net2280 module runs them.

		# lspci -nn |grep 3380
		04:00.0 USB controller [0c03]: PLX Technology, Inc. Device [10b5:3380] (rev ab)
		65:00.0 USB controller [0c03]: PLX Technology, Inc. Device [10b5:3380] (rev ab)


	- Loading the `g_mass_storage` to allow me to "insert" an image to to emulate:

		# modprobe g_mass_storage removable=y stall=0 nofua=1
		# find /sys/ -name "*gadget*" 
		[...]
		/sys/devices/pci0000:64/0000:64:00.0/0000:65:00.0/gadget
		/sys/devices/pci0000:00/0000:00:1c.5/0000:04:00.0/gadget


	- But when I look at sysfs, only one of them has `lun0/file` that I can echo into:

		# ls -1 /sys/devices/pci0000:00/0000:00:1c.5/0000:04:00.0/gadget
		lun0   <--- lun0 is here, looks good
		power
		suspended
		uevent

		# ls -1 /sys/devices/pci0000:64/0000:64:00.0/0000:65:00.0/gadget
		power
		uevent
		<-- lun0 is missing :(

	- The following works for one image, but I am trying to insert an another image to through the other controller:

		echo "/home/test.img" > /sys/devices/pci0000:00/0000:00:1c.5/0000:04:00.0/gadget/lun0/file


In the kernel documentation I found the following in the USB Controller Driver section:  "The controller driver can support any number of different gadget drivers, but only one of them can be used at a time."
It was not clear whether it means one driver at a time or one controller at a time.  (https://www.kernel.org/doc/html/latest/driver-api/usb/gadget.html)

Questions please:
- Is there something I missed or oversee?
- Would you have any suggestions how to make it work? Is it possible?
- Any advice on cards I could use in x86 machines other than this? I haven't found any other than the 3380, which is end of life now.

Really appreciate advice and direction.

Regards,
Arpad


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-16 11:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-15 23:06 Running multiple gadgets in mass storage mode? Arpad Kun
2020-06-16 11:06 ` Peter Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox