Running multiple gadgets in mass storage mode?

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

 



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





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

  Powered by Linux