All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: gadget mass storage with two USB OTG device controller
       [not found] <8f870ba5-5dec-e362-51dd-65311315f6f2@gmail.com>
@ 2020-07-02 18:12 ` Felipe Balbi
  2020-07-02 19:32   ` Benoit
  0 siblings, 1 reply; 4+ messages in thread
From: Felipe Balbi @ 2020-07-02 18:12 UTC (permalink / raw)
  To: Benoit; +Cc: linux-usb

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

-- 
balbi

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

* Re: gadget mass storage with two USB OTG device controller
  2020-07-02 18:12 ` gadget mass storage with two USB OTG device controller Felipe Balbi
@ 2020-07-02 19:32   ` Benoit
  2020-07-09  6:39     ` Felipe Balbi
  0 siblings, 1 reply; 4+ messages in thread
From: Benoit @ 2020-07-02 19:32 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: linux-usb

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
>


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

* Re: gadget mass storage with two USB OTG device controller
  2020-07-02 19:32   ` Benoit
@ 2020-07-09  6:39     ` Felipe Balbi
  2020-07-09  7:23       ` Peter Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Felipe Balbi @ 2020-07-09  6:39 UTC (permalink / raw)
  To: Benoit; +Cc: linux-usb

[-- Attachment #1: Type: text/plain, Size: 512 bytes --]


Hi,

Benoit <benoit.sansoni@gmail.com> writes:
> 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.)

no idea about yocto, sorry. Perhaps ask on the yocto mailing list?a

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* RE: gadget mass storage with two USB OTG device controller
  2020-07-09  6:39     ` Felipe Balbi
@ 2020-07-09  7:23       ` Peter Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Chen @ 2020-07-09  7:23 UTC (permalink / raw)
  To: Felipe Balbi, Benoit; +Cc: linux-usb

 
> 
> Benoit <benoit.sansoni@gmail.com> writes:
> > 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.)
>

Try at:

/etc/rc.local

Peter
 

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

end of thread, other threads:[~2020-07-09  7:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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
2020-07-09  6:39     ` Felipe Balbi
2020-07-09  7:23       ` Peter Chen

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.