reference:
https://www.linux4sam.org/bin/view/Linux4SAM/USBGadgetConfig
there are TWO kind of gadget configuration
1) USB Gadget functions configurable through configfs(config it in userspace)
2) USB Gadget precomposed configurations(config it in kernel)

1. USB Gadget functions configurable through configfs
A Linux USB "gadget" can be set up through configfs.
If this is the case, the USB functions (which from the host's
perspective are seen as interfaces) and configurations are
specified simply by creating appropriate directories in configfs.
Associating functions with configurations is done by creating
appropriate symbolic links.
For more information see Documentation/usb/gadget_configfs.txt.
USB Gadget ConfigFS is an interface that allows definition of arbitrary functions and configurations to define an application specific USB composite device from userspace.

2. USB Gadget precomposed configurations
A Linux "Gadget Driver" talks to the USB Peripheral Controller
driver through the abstract "gadget" API. Some other operating
systems call these "client" drivers, of which "class drivers"
are a subset (implementing a USB device class specification).
A gadget driver implements one or more USB functions using
the peripheral hardware.
Gadget drivers are hardware-neutral, or "platform independent",
except that they sometimes must understand quirks or limitations
of the particular controllers they work with. For example, when
a controller doesn't support alternate configurations or provide
enough of the right types of endpoints, the gadget driver might
not be able work with that controller, or might need to implement
a less common variant of a device class protocol.
The available choices each represent a single precomposed USB
gadget configuration. In the device model, each option contains
both the device instantiation as a child for a USB gadget
controller, and the relevant drivers for each function declared
by the device.
once we insmod gadget driver we can use it!!
This option configures the gadget directly from the kernel config using precomposed configuration. The are multiple options here from simple devices like CDC ACM, Mass storgae, RNDIS, etc. to composite devices like Ethernet + ACM

choose serial gadget
本文介绍了Linux系统中USB Gadget的两种配置方式:通过configfs进行用户空间配置及内核预组合配置。前者允许用户定义任意功能和配置来创建特定应用的复合设备,后者则是直接从内核配置中选择预定义的USB Gadget配置。
1252

被折叠的 条评论
为什么被折叠?



