Creating a Linux Gadget USB Composite Device for i.MX28

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Creating a Linux Gadget USB Composite Device for i.MX28

8,344 Views
JayWilliamStubb
Contributor II

Does anyone know if I can create a Linux Gadget USB composite device? I am trying to create a device that can be both Mass Storage and a serial device at the same time. When I try to create a serial port when I already am using the OTG port for Mass Storage, I get a device busy message. I see that there is an option for "Multifunction Composite Gadget (EXPERIMENTAL)" under "USB Gadget Support" in the LTIB configuration. If I choose this option, how do I select/configure/use the Mass Storage and Serial option?

 

Here are the screen shot of the problem I'm talking about:

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

root@freescale ~$ modprobe g_file_storage file=/fsg.block stall=0

g_file_storage gadget: File-backed Storage Gadget, version: 20 November 2008

g_file_storage gadget: Number of LUNs=1

g_file_storage gadget-lun0: ro=0, file: /fsg.block fsl-usb2-udc: bind to driver g_file_storage

root@freescale ~$ g_file_storage gadget: high speed config #1

g_file_storage gadget: high speed config #1

g_file_storage gadget: high speed config #1

 

root@freescale ~$ modprobe g_serial

modprobe: failed to load module g_serial (/lib/modules/2.6.35.3-571-gcca29a0/ker nel/drivers/usb/gadget/g_serial.ko): Device or resource busy

rroot@freescale ~$ rnmod g_file_storage

unregistered gadget driver 'g_file_storage'

 root@freescale ~$ modprobe g_serial

g_serial gadget: Gadget Serial v2.4

g_serial gadget: g_serial ready

fsl-usb2-udc: bind to driver g_serial

root@freescale ~$

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 Kudos
1 Reply

1,874 Views
JayWilliamStubb
Contributor II

Ok, I found some answers. I chose the option for "Multifunction Composite Gadget (EXPERIMENTAL)" under "USB Gadget Support" in the LTIB configuration. and rebuilt the kernel. There is a "g_multi" that appears in the directory "/lib/modules/2.6.35.3-571-gcca29a0/kernel/drivers/usb/gadget". Below is the scrren shot of what appeared to work:

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

root@freescale ~$ modprobe g_multi file=/fsg.block stall=0

g_multi gadget: using random self ethernet address

g_multi gadget: using random host ethernet address

usb0: MAC 56:8f:6d:16:0c:a5

usb0: HOST MAC 46:bf:7b:10:39:4e

g_multi gadget: Mass Storage Function, version: 2009/09/11

g_multi gadget: Number of LUNs=1

 lun0: LUN: removable file: /fsg.block

g_multi gadget: Multifunction Composite Gadget, version: 2009/07/21

g_multi gadget: g_multi ready

fsl-usb2-udc: bind to driver g_multi

root@freescale ~$ g_multi gadget: high speed config #1: Multifunction Composite (CDC + MS + ACM)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I had previously created "fsg.block" as a 16 M RAM Disk as follows:

root@freescale ~$ dd if=/dev/zero of=/fsg.block bs=1M count=16

 

I was able to see my Mass Storage Device (I had to format it, of course).

I also was able to send text from the EVK board's serial ("/dev/ttyGS0") to the Linux host's serial (/dev/ttyACM0) via the following commands:

From EVK: root@freescale ~$ echo "Test from EVK" > /dev/ttyGS0

On Linux Host: user1@ubuntu:~$ cat /dev/ttyACM0

Test from EVK

------------------------------------------------------------------------------------------------------------------------------------

I didn't use the Ethernet. Anyone know what I need for the Driver on Windows? It shows up as a "Multifunction Composite Gadget".

 

0 Kudos