The use of the Linux 3.0 new USB Gadget CONFIGFS.C driver is as follows:
Mount the Configfs file system:
# mount-t Configfs None/sys/kernel/config
# Cd/sys/kernel/config
# ls
Usb_gadget
# CD Usb_gadget
Create the G1 directory and instantiate a new gadget template:
# mkdir G1
# CD G1
# ls
UDC bdeviceprotocol bMaxPacketSize0 Bcdusb functions Idvendor
Bdeviceclass bdevicesubclass bcddevice configs idproduct strings
Define the VendorID and ProductID of the product
# echo "0XABCD" > Idvendor
# echo "0x1234" > Idproduct
Instantiate English ID:
# mkdir strings/0x409
# ls strings/0x409
Manufacturer Product SerialNumber
Write the developer, product, and serial number string to the kernel:
# echo "0123456789ABCDEF" > Strings/0x409/serialnumber
# echo "Master" > Strings/0x409/manufacturer
# echo "Demo" > Strings/0x409/product
To create a feature instance, it is important to note that if there are multiple instances of a function, the extension must be numbered numerically:
# mkdir FUNCTIONS/ACM. GS0
# mkdir FUNCTIONS/ACM. GS1
# mkdir Functions/ecm.usb0
Create a USB configuration instance:
# mkdir Configs/c.1
# ls Configs/c.1
Maxpower bmattributes Strings
Defines the string used by the configuration descriptor
# mkdir configs/c.1/string/0x409
# ls configs/c.1/strings/0x409/
Configuration
# echo "2XACM+ECM" > Configfs/c.1/strings/0x409/configuration
Bundle feature instances to configuration C.1
# ln-s FUNCTIONS/ACM. GS0 Configs/c.1
# ln-s FUNCTIONS/ACM. GS1 Configs/c.1
# ln-s Functions/ecm.usb0 configs/c.1
Find the available UDC instances for this machine
# ls/sys/class/udc/
Msm_hsusb
Register the gadget driver on a UDC, plug it into a USB cable, and the computer will enumerate the USB devices.
# echo "Msm_hsusb" > UDC