All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benoit <benoit.sansoni@gmail.com>
To: Felipe Balbi <balbi@kernel.org>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: gadget mass storage with two USB OTG device controller
Date: Thu, 2 Jul 2020 21:32:58 +0200	[thread overview]
Message-ID: <391a537e-108d-210b-01be-c20dd9d0e68e@gmail.com> (raw)
In-Reply-To: <CAH8TKc9gaebqZOpv0OFxG-Dq+Tj+FdgJamQ=eP4SMJ-eYBrkOA@mail.gmail.com>

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@gmail.com> 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
>


  reply	other threads:[~2020-07-02 19:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8f870ba5-5dec-e362-51dd-65311315f6f2@gmail.com>
2020-07-02 18:12 ` gadget mass storage with two USB OTG device controller Felipe Balbi
2020-07-02 19:32   ` Benoit [this message]
2020-07-09  6:39     ` Felipe Balbi
2020-07-09  7:23       ` Peter Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=391a537e-108d-210b-01be-c20dd9d0e68e@gmail.com \
    --to=benoit.sansoni@gmail.com \
    --cc=balbi@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.