在哪儿linux内核配置usb,linux usb gadget kernel配置

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

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)

c504a496f7c4de8900c48ce072287868.png

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.

7e17265bd19fc5ddb8aa15818567eb36.png

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

e6e97c8064cbcc91e7588e2dd6c7d4ed.png

choose serial gadget

您可能感兴趣的与本文相关内容

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值