Hi Felipe,
I am in fact a newbie in USB OTG device mode.
The configfs is really convenient.
It works like a charm.
I applied this configuration below and can see on the host the different
mass storage.
This configuration can be set in boot init script file.
But what is the best choice to apply this configuration at boot up ? (I
am currently using yocto.)
Thank you so much for your help
Benoit
root@samx8xqxp-hds:~# cd /sys/kernel/config/
root@samx8xqxp-hds:/sys/kernel/config# ls
usb_gadget
root@samx8xqxp-hds:/sys/kernel/config# cd usb_gadget/
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget# mkdir g1
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget# ls g1
UDC bDeviceProtocol bMaxPacketSize0 bcdUSB
functions idVendor strings
bDeviceClass bDeviceSubClass bcdDevice configs
idProduct os_desc
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget# cd g1
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g1# mkdir configs/c.1
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g1# mkdir
functions/mass_storage.0
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g1# dd if=/dev/zero
of=/tmp/big1 bs=1024 count=200000
200000+0 records in
200000+0 records out
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g1# dd if=/dev/zero
of=/tmp/big2 bs=1024 count=200000
200000+0 records in
200000+0 records out
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g1#
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g1# ls
UDC bDeviceProtocol bMaxPacketSize0 bcdUSB
functions idVendor strings
bDeviceClass bDeviceSubClass bcdDevice configs
idProduct os_desc
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g1# echo /tmp/big1 >
functions/mass_storage.0/lun.0/file
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g1# mkdir strings/0x409
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g1# mkdir
configs/c.1/strings/0x409
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g1# echo 0xa4a2 >
idProduct
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g1# echo 0x0525 >
idVendor
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g1# echo 000000001 >
strings/0x409/serialnumber
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g1# echo COMPANY >
strings/0x409/manufacturer
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g1# echo "Mass
Storage Gadget 1" > strings/0x409/product
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g1# echo "Conf 1" >
configs/c.1/strings/0x409/configuration
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g1# ln -s
functions/mass_storage.0 configs/c.1
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g1# echo
"5b110000.usb3" > UDC
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g1# cd ..
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget# ls
g1
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget# cd ..
root@samx8xqxp-hds:/sys/kernel/config# mkdir usb_gadget/g2
root@samx8xqxp-hds:/sys/kernel/config# cd usb_gadget/g2/
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g2# mkdir configs/c.2
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g2# mkdir
functions/mass_storage.0
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g2# echo /tmp/big2 >
functions/mass_storage.0/lun.0/file
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g2# mkdir strings/0x409
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g2# mkdir
configs/c.2/strings/0x409
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g2# echo 0xa4a2 >
idProduct
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g2# echo 0x0525 >
idVendor
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g2# echo 000000002 >
strings/0x409/serialnumber
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g2# echo COMPANY >
strings/0x409/manufacturer
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g2# echo "Mass
Storage Gadget 2" > strings/0x409/product
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g2# echo "Conf 2" >
configs/c.2/strings/0x409/configuration
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g2# ln -s
functions/mass_storage.0 configs/c.2
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g2# ls /sys/class/udc/
5b110000.usb3 ci_hdrc.0
root@samx8xqxp-hds:/sys/kernel/config/usb_gadget/g2# echo "ci_hdrc.0"
> UDC
On 02/07/2020 20:12, Felipe Balbi wrote:
Hi,
On Thu, Jul 2, 2020 at 4:08 PM Benoit <benoit.sansoni@xxxxxxxxx> wrote:
Hello Felipe,
I contact you because I used the perl script to check out which is the
maintainer of the gadget drivers.
I am working on a project using NXP imx8 processor which has two USB OTG
controller.
Both support device mode.
I am using kernel release 4.19.35.
I tried to use the g_mass_storage driver using different "file="
paramter to each of them without success.
I dig into the Documentation folder, but did not find the way to do that.
Question:
Is it possible to run at the same time the g_mass_storage driver on two
different USB OTG device controller?
yes, look at the configfs interface for the gadget framework