usb/gadget_configfs.txt

/sxr2130_Pre-CS/kernel/msm-4.19/Documentation/usb/gadget_configfs.txt2 3 4 5 Linux USB gadget configured through configfs6 7 8 25th April 20139 10 11 12 13 Overview14 ========15 16 A USB Linux Gadget is a device which has a UDC (
摘要由CSDN通过智能技术生成

/sxr2130_Pre-CS/kernel/msm-4.19/Documentation/usb/gadget_configfs.txt

2 
3 
4 
5 		Linux USB gadget configured through configfs
6 
7 
8 			     25th April 2013
9 
10 
11 
12 
13 Overview
14 ========
15 
16 A USB Linux Gadget is a device which has a UDC (USB Device Controller) and can
17 be connected to a USB Host to extend it with additional functions like a serial
18 port or a mass storage capability.
19 
20 A gadget is seen by its host as a set of configurations, each of which contains
21 a number of interfaces which, from the gadget's perspective, are known as
22 functions, each function representing e.g. a serial connection or a SCSI disk.
23 
24 Linux provides a number of functions for gadgets to use.
25 
26 Creating a gadget means deciding what configurations there will be
27 and which functions each configuration will provide.
28 
29 Configfs (please see Documentation/filesystems/configfs/*) lends itself nicely
30 for the purpose of telling the kernel about the above mentioned decision.
31 This document is about how to do it.
32 
33 It also describes how configfs integration into gadget is designed.
34 
35 
36 
37 
38 Requirements
39 ============
40 
41 In order for this to work configfs must be available, so CONFIGFS_FS must be
42 'y' or 'm' in .config. As of this writing USB_LIBCOMPOSITE selects CONFIGFS_FS.
43 
44 
45 
46 
47 Usage
48 =====
49 
50 (The original post describing the first function
51 made available through configfs can be seen here:
52 http://www.spinics.net/lists/linux-usb/msg76388.html)
53 
54 $ modprobe libcomposite
55 $ mount none $CONFIGFS_HOME -t configfs
56 
57 where CONFIGFS_HOME is the mount point for configfs
58 
59 1. Creating the gadgets
60 -----------------------
61 
62 For each gadget to be created its corresponding directory must be created:
63 
64 $ mkdir $CONFIGFS_HOME/usb_gadget/<gadget name>
65 
66 e.g.:
67 
68 $ mkdir $CONFIGFS_HOME/usb_gadget/g1
69 
70 ...
71 ...
72 ...
73 
74 $ cd $CONFIGFS_HOME/usb_gadget/g1
75 
76 Each gadget needs to have its vendor id <VID> and product id <PID> specified:
77 
78 $ echo <VID> > idVendor
79 $ echo <PID> > idProduct
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值