blob: f117e5c84a1ebf0fc1206ff3b802247ba336b343 [file] [log] [blame]
Andrzej Pietrasiewicze38eb2c2014-12-16 14:56:25 +01001This file summarizes information on basic testing of USB functions
2provided by gadgets.
3
41. ACM function
Andrzej Pietrasiewiczd5862ca2014-12-16 14:56:26 +010052. ECM function
Andrzej Pietrasiewicz7bfbc6e2014-12-16 14:56:27 +010063. ECM subset function
Andrzej Pietrasiewicz4ca560a2014-12-16 14:56:28 +010074. EEM function
Andrzej Pietrasiewicz2c0f62f2014-12-16 14:56:29 +010085. FFS function
Andrzej Pietrasiewiczf7e3c3c2014-12-16 14:56:30 +010096. HID function
Andrzej Pietrasiewicze38eb2c2014-12-16 14:56:25 +010010
11
121. ACM function
13===============
14
15The function is provided by usb_f_acm.ko module.
16
17Function-specific configfs interface
18------------------------------------
19
20The function name to use when creating the function directory is "acm".
21The ACM function provides just one attribute in its function directory:
22
23 port_num
24
25The attribute is read-only.
26
27There can be at most 4 ACM/generic serial/OBEX ports in the system.
28
29
30Testing the ACM function
31------------------------
32
33On the host: cat > /dev/ttyACM<X>
34On the device : cat /dev/ttyGS<Y>
35
36then the other way round
37
38On the device: cat > /dev/ttyGS<Y>
39On the host: cat /dev/ttyACM<X>
Andrzej Pietrasiewiczd5862ca2014-12-16 14:56:26 +010040
412. ECM function
42===============
43
44The function is provided by usb_f_ecm.ko module.
45
46Function-specific configfs interface
47------------------------------------
48
49The function name to use when creating the function directory is "ecm".
50The ECM function provides these attributes in its function directory:
51
52 ifname - network device interface name associated with this
53 function instance
54 qmult - queue length multiplier for high and super speed
55 host_addr - MAC address of host's end of this
56 Ethernet over USB link
57 dev_addr - MAC address of device's end of this
58 Ethernet over USB link
59
60and after creating the functions/ecm.<instance name> they contain default
61values: qmult is 5, dev_addr and host_addr are randomly selected.
62Except for ifname they can be written to until the function is linked to a
63configuration. The ifname is read-only and contains the name of the interface
64which was assigned by the net core, e. g. usb0.
65
66Testing the ECM function
67------------------------
68
69Configure IP addresses of the device and the host. Then:
70
71On the device: ping <host's IP>
72On the host: ping <device's IP>
Andrzej Pietrasiewicz7bfbc6e2014-12-16 14:56:27 +010073
743. ECM subset function
75======================
76
77The function is provided by usb_f_ecm_subset.ko module.
78
79Function-specific configfs interface
80------------------------------------
81
82The function name to use when creating the function directory is "geth".
83The ECM subset function provides these attributes in its function directory:
84
85 ifname - network device interface name associated with this
86 function instance
87 qmult - queue length multiplier for high and super speed
88 host_addr - MAC address of host's end of this
89 Ethernet over USB link
90 dev_addr - MAC address of device's end of this
91 Ethernet over USB link
92
93and after creating the functions/ecm.<instance name> they contain default
94values: qmult is 5, dev_addr and host_addr are randomly selected.
95Except for ifname they can be written to until the function is linked to a
96configuration. The ifname is read-only and contains the name of the interface
97which was assigned by the net core, e. g. usb0.
98
99Testing the ECM subset function
100-------------------------------
101
102Configure IP addresses of the device and the host. Then:
103
104On the device: ping <host's IP>
105On the host: ping <device's IP>
Andrzej Pietrasiewicz4ca560a2014-12-16 14:56:28 +0100106
1074. EEM function
108===============
109
110The function is provided by usb_f_eem.ko module.
111
112Function-specific configfs interface
113------------------------------------
114
115The function name to use when creating the function directory is "eem".
116The EEM function provides these attributes in its function directory:
117
118 ifname - network device interface name associated with this
119 function instance
120 qmult - queue length multiplier for high and super speed
121 host_addr - MAC address of host's end of this
122 Ethernet over USB link
123 dev_addr - MAC address of device's end of this
124 Ethernet over USB link
125
126and after creating the functions/eem.<instance name> they contain default
127values: qmult is 5, dev_addr and host_addr are randomly selected.
128Except for ifname they can be written to until the function is linked to a
129configuration. The ifname is read-only and contains the name of the interface
130which was assigned by the net core, e. g. usb0.
131
132Testing the EEM function
133------------------------
134
135Configure IP addresses of the device and the host. Then:
136
137On the device: ping <host's IP>
138On the host: ping <device's IP>
Andrzej Pietrasiewicz2c0f62f2014-12-16 14:56:29 +0100139
1405. FFS function
141===============
142
143The function is provided by usb_f_fs.ko module.
144
145Function-specific configfs interface
146------------------------------------
147
148The function name to use when creating the function directory is "ffs".
149The function directory is intentionally empty and not modifiable.
150
151After creating the directory there is a new instance (a "device") of FunctionFS
152available in the system. Once a "device" is available, the user should follow
153the standard procedure for using FunctionFS (mount it, run the userspace
154process which implements the function proper). The gadget should be enabled
155by writing a suitable string to usb_gadget/<gadget>/UDC.
156
157Testing the FFS function
158------------------------
159
160On the device: start the function's userspace daemon, enable the gadget
161On the host: use the USB function provided by the device
Andrzej Pietrasiewiczf7e3c3c2014-12-16 14:56:30 +0100162
1636. HID function
164===============
165
166The function is provided by usb_f_hid.ko module.
167
168Function-specific configfs interface
169------------------------------------
170
171The function name to use when creating the function directory is "hid".
172The HID function provides these attributes in its function directory:
173
174 protocol - HID protocol to use
175 report_desc - data to be used in HID reports, except data
176 passed with /dev/hidg<X>
177 report_length - HID report length
178 subclass - HID subclass to use
179
180For a keyboard the protocol and the subclass are 1, the report_length is 8,
181while the report_desc is:
182
183$ hd my_report_desc
18400000000 05 01 09 06 a1 01 05 07 19 e0 29 e7 15 00 25 01 |..........)...%.|
18500000010 75 01 95 08 81 02 95 01 75 08 81 03 95 05 75 01 |u.......u.....u.|
18600000020 05 08 19 01 29 05 91 02 95 01 75 03 91 03 95 06 |....).....u.....|
18700000030 75 08 15 00 25 65 05 07 19 00 29 65 81 00 c0 |u...%e....)e...|
1880000003f
189
190Such a sequence of bytes can be stored to the attribute with echo:
191
192$ echo -ne \\x05\\x01\\x09\\x06\\xa1.....
193
194Testing the HID function
195------------------------
196
197Device:
198- create the gadget
199- connect the gadget to a host, preferably not the one used
200to control the gadget
201- run a program which writes to /dev/hidg<N>, e.g.
202a userspace program found in Documentation/usb/gadget_hid.txt:
203
204$ ./hid_gadget_test /dev/hidg0 keyboard
205
206Host:
207- observe the keystrokes from the gadget