^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) ==============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) Gadget Testing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) ==============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) This file summarizes information on basic testing of USB functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) provided by gadgets.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) .. contents
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 1. ACM function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 2. ECM function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 3. ECM subset function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 4. EEM function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 5. FFS function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 6. HID function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 7. LOOPBACK function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 8. MASS STORAGE function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 9. MIDI function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 10. NCM function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 11. OBEX function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 12. PHONET function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 13. RNDIS function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 14. SERIAL function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 15. SOURCESINK function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 16. UAC1 function (legacy implementation)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 17. UAC2 function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 18. UVC function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 19. PRINTER function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 20. UAC1 function (new API)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 1. ACM function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) ===============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) The function is provided by usb_f_acm.ko module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) Function-specific configfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) The function name to use when creating the function directory is "acm".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) The ACM function provides just one attribute in its function directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) port_num
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) The attribute is read-only.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) There can be at most 4 ACM/generic serial/OBEX ports in the system.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) Testing the ACM function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) ------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) On the host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) cat > /dev/ttyACM<X>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) On the device::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) cat /dev/ttyGS<Y>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) then the other way round
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) On the device::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) cat > /dev/ttyGS<Y>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) On the host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) cat /dev/ttyACM<X>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 2. ECM function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) ===============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) The function is provided by usb_f_ecm.ko module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) Function-specific configfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) The function name to use when creating the function directory is "ecm".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) The ECM function provides these attributes in its function directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) =============== ==================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) ifname network device interface name associated with this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) function instance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) qmult queue length multiplier for high and super speed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) host_addr MAC address of host's end of this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) Ethernet over USB link
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) dev_addr MAC address of device's end of this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) Ethernet over USB link
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) =============== ==================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) and after creating the functions/ecm.<instance name> they contain default
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) values: qmult is 5, dev_addr and host_addr are randomly selected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) The ifname can be written to if the function is not bound. A write must be an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) interface pattern such as "usb%d", which will cause the net core to choose the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) next free usbX interface. By default, it is set to "usb%d".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) Testing the ECM function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) ------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) Configure IP addresses of the device and the host. Then:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) On the device::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) ping <host's IP>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) On the host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) ping <device's IP>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 3. ECM subset function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) ======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) The function is provided by usb_f_ecm_subset.ko module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) Function-specific configfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) The function name to use when creating the function directory is "geth".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) The ECM subset function provides these attributes in its function directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) =============== ==================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) ifname network device interface name associated with this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) function instance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) qmult queue length multiplier for high and super speed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) host_addr MAC address of host's end of this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) Ethernet over USB link
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) dev_addr MAC address of device's end of this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) Ethernet over USB link
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) =============== ==================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) and after creating the functions/ecm.<instance name> they contain default
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) values: qmult is 5, dev_addr and host_addr are randomly selected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) The ifname can be written to if the function is not bound. A write must be an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) interface pattern such as "usb%d", which will cause the net core to choose the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) next free usbX interface. By default, it is set to "usb%d".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) Testing the ECM subset function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) -------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) Configure IP addresses of the device and the host. Then:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) On the device::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) ping <host's IP>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) On the host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) ping <device's IP>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 4. EEM function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) ===============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) The function is provided by usb_f_eem.ko module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) Function-specific configfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) The function name to use when creating the function directory is "eem".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) The EEM function provides these attributes in its function directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) =============== ==================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) ifname network device interface name associated with this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) function instance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) qmult queue length multiplier for high and super speed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) host_addr MAC address of host's end of this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) Ethernet over USB link
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) dev_addr MAC address of device's end of this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) Ethernet over USB link
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) =============== ==================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) and after creating the functions/eem.<instance name> they contain default
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) values: qmult is 5, dev_addr and host_addr are randomly selected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) The ifname can be written to if the function is not bound. A write must be an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) interface pattern such as "usb%d", which will cause the net core to choose the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) next free usbX interface. By default, it is set to "usb%d".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) Testing the EEM function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) ------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) Configure IP addresses of the device and the host. Then:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) On the device::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) ping <host's IP>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) On the host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) ping <device's IP>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 5. FFS function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) ===============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) The function is provided by usb_f_fs.ko module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) Function-specific configfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) The function name to use when creating the function directory is "ffs".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) The function directory is intentionally empty and not modifiable.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) After creating the directory there is a new instance (a "device") of FunctionFS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) available in the system. Once a "device" is available, the user should follow
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) the standard procedure for using FunctionFS (mount it, run the userspace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) process which implements the function proper). The gadget should be enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) by writing a suitable string to usb_gadget/<gadget>/UDC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) Testing the FFS function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) ------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) On the device: start the function's userspace daemon, enable the gadget
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) On the host: use the USB function provided by the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 6. HID function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) ===============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) The function is provided by usb_f_hid.ko module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) Function-specific configfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) The function name to use when creating the function directory is "hid".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) The HID function provides these attributes in its function directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) =============== ===========================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) protocol HID protocol to use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) report_desc data to be used in HID reports, except data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) passed with /dev/hidg<X>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) report_length HID report length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) subclass HID subclass to use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) =============== ===========================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) For a keyboard the protocol and the subclass are 1, the report_length is 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) while the report_desc is::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) $ hd my_report_desc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 00000000 05 01 09 06 a1 01 05 07 19 e0 29 e7 15 00 25 01 |..........)...%.|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 00000010 75 01 95 08 81 02 95 01 75 08 81 03 95 05 75 01 |u.......u.....u.|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 00000020 05 08 19 01 29 05 91 02 95 01 75 03 91 03 95 06 |....).....u.....|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 00000030 75 08 15 00 25 65 05 07 19 00 29 65 81 00 c0 |u...%e....)e...|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 0000003f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) Such a sequence of bytes can be stored to the attribute with echo::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) $ echo -ne \\x05\\x01\\x09\\x06\\xa1.....
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) Testing the HID function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) ------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) Device:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) - create the gadget
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) - connect the gadget to a host, preferably not the one used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) to control the gadget
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) - run a program which writes to /dev/hidg<N>, e.g.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) a userspace program found in Documentation/usb/gadget_hid.rst::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) $ ./hid_gadget_test /dev/hidg0 keyboard
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) Host:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) - observe the keystrokes from the gadget
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 7. LOOPBACK function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) ====================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) The function is provided by usb_f_ss_lb.ko module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) Function-specific configfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) The function name to use when creating the function directory is "Loopback".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) The LOOPBACK function provides these attributes in its function directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) =============== =======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) qlen depth of loopback queue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) bulk_buflen buffer length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) =============== =======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) Testing the LOOPBACK function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) -----------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) device: run the gadget
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) host: test-usb (tools/usb/testusb.c)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 8. MASS STORAGE function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) ========================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) The function is provided by usb_f_mass_storage.ko module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) Function-specific configfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) The function name to use when creating the function directory is "mass_storage".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) The MASS STORAGE function provides these attributes in its directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) files:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) =============== ==============================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) stall Set to permit function to halt bulk endpoints.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) Disabled on some USB devices known not to work
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) correctly. You should set it to true.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) num_buffers Number of pipeline buffers. Valid numbers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) are 2..4. Available only if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) CONFIG_USB_GADGET_DEBUG_FILES is set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) =============== ==============================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) and a default lun.0 directory corresponding to SCSI LUN #0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) A new lun can be added with mkdir::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) $ mkdir functions/mass_storage.0/partition.5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) Lun numbering does not have to be continuous, except for lun #0 which is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) created by default. A maximum of 8 luns can be specified and they all must be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) named following the <name>.<number> scheme. The numbers can be 0..8.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) Probably a good convention is to name the luns "lun.<number>",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) although it is not mandatory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) In each lun directory there are the following attribute files:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) =============== ==============================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) file The path to the backing file for the LUN.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) Required if LUN is not marked as removable.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) ro Flag specifying access to the LUN shall be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) read-only. This is implied if CD-ROM emulation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) is enabled as well as when it was impossible
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) to open "filename" in R/W mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) removable Flag specifying that LUN shall be indicated as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) being removable.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) cdrom Flag specifying that LUN shall be reported as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) being a CD-ROM.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) nofua Flag specifying that FUA flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) in SCSI WRITE(10,12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) =============== ==============================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) Testing the MASS STORAGE function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) ---------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) device: connect the gadget, enable it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) host: dmesg, see the USB drives appear (if system configured to automatically
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) mount)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 9. MIDI function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) ================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) The function is provided by usb_f_midi.ko module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) Function-specific configfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) The function name to use when creating the function directory is "midi".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) The MIDI function provides these attributes in its function directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) =============== ====================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) buflen MIDI buffer length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) id ID string for the USB MIDI adapter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) in_ports number of MIDI input ports
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) index index value for the USB MIDI adapter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) out_ports number of MIDI output ports
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) qlen USB read request queue length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) =============== ====================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) Testing the MIDI function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) -------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) There are two cases: playing a mid from the gadget to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) the host and playing a mid from the host to the gadget.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 1) Playing a mid from the gadget to the host:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) $ arecordmidi -l
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) Port Client name Port name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 14:0 Midi Through Midi Through Port-0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 24:0 MIDI Gadget MIDI Gadget MIDI 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) $ arecordmidi -p 24:0 from_gadget.mid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) gadget::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) $ aplaymidi -l
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) Port Client name Port name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 20:0 f_midi f_midi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) $ aplaymidi -p 20:0 to_host.mid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 2) Playing a mid from the host to the gadget
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) gadget::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) $ arecordmidi -l
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) Port Client name Port name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 20:0 f_midi f_midi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) $ arecordmidi -p 20:0 from_host.mid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) $ aplaymidi -l
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) Port Client name Port name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 14:0 Midi Through Midi Through Port-0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 24:0 MIDI Gadget MIDI Gadget MIDI 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) $ aplaymidi -p24:0 to_gadget.mid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) The from_gadget.mid should sound identical to the to_host.mid.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) The from_host.id should sound identical to the to_gadget.mid.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) MIDI files can be played to speakers/headphones with e.g. timidity installed::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) $ aplaymidi -l
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) Port Client name Port name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 14:0 Midi Through Midi Through Port-0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 24:0 MIDI Gadget MIDI Gadget MIDI 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 128:0 TiMidity TiMidity port 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 128:1 TiMidity TiMidity port 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 128:2 TiMidity TiMidity port 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 128:3 TiMidity TiMidity port 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) $ aplaymidi -p 128:0 file.mid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) MIDI ports can be logically connected using the aconnect utility, e.g.::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) $ aconnect 24:0 128:0 # try it on the host
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) After the gadget's MIDI port is connected to timidity's MIDI port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) whatever is played at the gadget side with aplaymidi -l is audible
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) in host's speakers/headphones.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 10. NCM function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) ================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) The function is provided by usb_f_ncm.ko module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) Function-specific configfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) The function name to use when creating the function directory is "ncm".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) The NCM function provides these attributes in its function directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) =============== ==================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) ifname network device interface name associated with this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) function instance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) qmult queue length multiplier for high and super speed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) host_addr MAC address of host's end of this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) Ethernet over USB link
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) dev_addr MAC address of device's end of this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) Ethernet over USB link
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) =============== ==================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) and after creating the functions/ncm.<instance name> they contain default
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) values: qmult is 5, dev_addr and host_addr are randomly selected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) The ifname can be written to if the function is not bound. A write must be an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) interface pattern such as "usb%d", which will cause the net core to choose the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) next free usbX interface. By default, it is set to "usb%d".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) Testing the NCM function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) ------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) Configure IP addresses of the device and the host. Then:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) On the device::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) ping <host's IP>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) On the host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) ping <device's IP>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) 11. OBEX function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) =================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) The function is provided by usb_f_obex.ko module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) Function-specific configfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) The function name to use when creating the function directory is "obex".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) The OBEX function provides just one attribute in its function directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) port_num
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) The attribute is read-only.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) There can be at most 4 ACM/generic serial/OBEX ports in the system.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) Testing the OBEX function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) -------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) On device::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) seriald -f /dev/ttyGS<Y> -s 1024
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) On host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) serialc -v <vendorID> -p <productID> -i<interface#> -a1 -s1024 \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) -t<out endpoint addr> -r<in endpoint addr>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) where seriald and serialc are Felipe's utilities found here:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) https://github.com/felipebalbi/usb-tools.git master
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) 12. PHONET function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) ===================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) The function is provided by usb_f_phonet.ko module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) Function-specific configfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) The function name to use when creating the function directory is "phonet".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) The PHONET function provides just one attribute in its function directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) =============== ==================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) ifname network device interface name associated with this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) function instance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) =============== ==================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) Testing the PHONET function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) ---------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) It is not possible to test the SOCK_STREAM protocol without a specific piece
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) of hardware, so only SOCK_DGRAM has been tested. For the latter to work,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) in the past I had to apply the patch mentioned here:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) http://www.spinics.net/lists/linux-usb/msg85689.html
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) These tools are required:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) git://git.gitorious.org/meego-cellular/phonet-utils.git
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) On the host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) $ ./phonet -a 0x10 -i usbpn0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) $ ./pnroute add 0x6c usbpn0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) $./pnroute add 0x10 usbpn0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) $ ifconfig usbpn0 up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) On the device::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) $ ./phonet -a 0x6c -i upnlink0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) $ ./pnroute add 0x10 upnlink0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) $ ifconfig upnlink0 up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) Then a test program can be used::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) http://www.spinics.net/lists/linux-usb/msg85690.html
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) On the device::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) $ ./pnxmit -a 0x6c -r
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) On the host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) $ ./pnxmit -a 0x10 -s 0x6c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) As a result some data should be sent from host to device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) Then the other way round:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) On the host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) $ ./pnxmit -a 0x10 -r
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) On the device::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) $ ./pnxmit -a 0x6c -s 0x10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) 13. RNDIS function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) ==================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) The function is provided by usb_f_rndis.ko module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) Function-specific configfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) The function name to use when creating the function directory is "rndis".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) The RNDIS function provides these attributes in its function directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) =============== ==================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) ifname network device interface name associated with this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) function instance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) qmult queue length multiplier for high and super speed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) host_addr MAC address of host's end of this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) Ethernet over USB link
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) dev_addr MAC address of device's end of this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) Ethernet over USB link
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) =============== ==================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) and after creating the functions/rndis.<instance name> they contain default
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) values: qmult is 5, dev_addr and host_addr are randomly selected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) The ifname can be written to if the function is not bound. A write must be an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) interface pattern such as "usb%d", which will cause the net core to choose the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) next free usbX interface. By default, it is set to "usb%d".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) Testing the RNDIS function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) --------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) Configure IP addresses of the device and the host. Then:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) On the device::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) ping <host's IP>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) On the host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) ping <device's IP>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) 14. SERIAL function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) ===================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) The function is provided by usb_f_gser.ko module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) Function-specific configfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) The function name to use when creating the function directory is "gser".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) The SERIAL function provides just one attribute in its function directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) port_num
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) The attribute is read-only.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) There can be at most 4 ACM/generic serial/OBEX ports in the system.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) Testing the SERIAL function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) ---------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) On host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) insmod usbserial
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) echo VID PID >/sys/bus/usb-serial/drivers/generic/new_id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) On host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) cat > /dev/ttyUSB<X>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) On target::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) cat /dev/ttyGS<Y>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) then the other way round
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) On target::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) cat > /dev/ttyGS<Y>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) On host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) cat /dev/ttyUSB<X>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) 15. SOURCESINK function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) =======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) The function is provided by usb_f_ss_lb.ko module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) Function-specific configfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) The function name to use when creating the function directory is "SourceSink".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) The SOURCESINK function provides these attributes in its function directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) =============== ==================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) pattern 0 (all zeros), 1 (mod63), 2 (none)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) isoc_interval 1..16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) isoc_maxpacket 0 - 1023 (fs), 0 - 1024 (hs/ss)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) isoc_mult 0..2 (hs/ss only)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) isoc_maxburst 0..15 (ss only)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) bulk_buflen buffer length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) bulk_qlen depth of queue for bulk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) iso_qlen depth of queue for iso
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) =============== ==================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) Testing the SOURCESINK function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) -------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) device: run the gadget
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) host: test-usb (tools/usb/testusb.c)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) 16. UAC1 function (legacy implementation)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) =========================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) The function is provided by usb_f_uac1_legacy.ko module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) Function-specific configfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) The function name to use when creating the function directory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) is "uac1_legacy".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) The uac1 function provides these attributes in its function directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) =============== ====================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) audio_buf_size audio buffer size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) fn_cap capture pcm device file name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) fn_cntl control device file name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) fn_play playback pcm device file name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) req_buf_size ISO OUT endpoint request buffer size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) req_count ISO OUT endpoint request count
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) =============== ====================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) The attributes have sane default values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) Testing the UAC1 function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708) -------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) device: run the gadget
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) aplay -l # should list our USB Audio Gadget
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) 17. UAC2 function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) =================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) The function is provided by usb_f_uac2.ko module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) Function-specific configfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) The function name to use when creating the function directory is "uac2".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) The uac2 function provides these attributes in its function directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) ================ ====================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) c_chmask capture channel mask
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) c_srate list of capture sampling rates (comma-separated)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) c_ssize capture sample size (bytes)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) c_sync capture synchronization type (async/adaptive)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) c_mute_present capture mute control enable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) c_volume_present capture volume control enable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) c_volume_min capture volume control min value (in 1/256 dB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) c_volume_max capture volume control max value (in 1/256 dB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736) c_volume_res capture volume control resolution (in 1/256 dB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) c_hs_bint capture bInterval for HS/SS (1-4: fixed, 0: auto)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) fb_max maximum extra bandwidth in async mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739) p_chmask playback channel mask
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) p_srate list of playback sampling rates (comma-separated)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) p_ssize playback sample size (bytes)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742) p_mute_present playback mute control enable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) p_volume_present playback volume control enable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744) p_volume_min playback volume control min value (in 1/256 dB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) p_volume_max playback volume control max value (in 1/256 dB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746) p_volume_res playback volume control resolution (in 1/256 dB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) p_hs_bint playback bInterval for HS/SS (1-4: fixed, 0: auto)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) req_number the number of pre-allocated request for both capture
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749) and playback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750) function_name name of the interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751) ================ ====================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753) The attributes have sane default values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755) Testing the UAC2 function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) -------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758) device: run the gadget
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759) host: aplay -l # should list our USB Audio Gadget
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761) This function does not require real hardware support, it just
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762) sends a stream of audio data to/from the host. In order to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763) actually hear something at the device side, a command similar
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764) to this must be used at the device side::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766) $ arecord -f dat -t wav -D hw:2,0 | aplay -D hw:0,0 &
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768) e.g.::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770) $ arecord -f dat -t wav -D hw:CARD=UAC2Gadget,DEV=0 | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771) aplay -D default:CARD=OdroidU3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773) 18. UVC function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774) ================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776) The function is provided by usb_f_uvc.ko module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778) Function-specific configfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 781) The function name to use when creating the function directory is "uvc".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 782) The uvc function provides these attributes in its function directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 783)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 784) =================== ================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 785) streaming_interval interval for polling endpoint for data transfers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 786) streaming_maxburst bMaxBurst for super speed companion descriptor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 787) streaming_maxpacket maximum packet size this endpoint is capable of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 788) sending or receiving when this configuration is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 789) selected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 790) function_name name of the interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 791) =================== ================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 792)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 793) There are also "control" and "streaming" subdirectories, each of which contain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 794) a number of their subdirectories. There are some sane defaults provided, but
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 795) the user must provide the following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 796)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 797) ================== ====================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 798) control header create in control/header, link from control/class/fs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 799) and/or control/class/ss
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 800) streaming header create in streaming/header, link from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 801) streaming/class/fs and/or streaming/class/hs and/or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 802) streaming/class/ss
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 803) format description create in streaming/mjpeg and/or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 804) streaming/uncompressed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 805) frame description create in streaming/mjpeg/<format> and/or in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 806) streaming/uncompressed/<format>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 807) ================== ====================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 808)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 809) Each frame description contains frame interval specification, and each
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 810) such specification consists of a number of lines with an inverval value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 811) in each line. The rules stated above are best illustrated with an example::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 812)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 813) # mkdir functions/uvc.usb0/control/header/h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 814) # cd functions/uvc.usb0/control/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 815) # ln -s header/h class/fs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 816) # ln -s header/h class/ss
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 817) # mkdir -p functions/uvc.usb0/streaming/uncompressed/u/360p
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 818) # cat <<EOF > functions/uvc.usb0/streaming/uncompressed/u/360p/dwFrameInterval
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 819) 666666
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 820) 1000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 821) 5000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 822) EOF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 823) # cd $GADGET_CONFIGFS_ROOT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 824) # mkdir functions/uvc.usb0/streaming/header/h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 825) # cd functions/uvc.usb0/streaming/header/h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 826) # ln -s ../../uncompressed/u
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 827) # cd ../../class/fs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 828) # ln -s ../../header/h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 829) # cd ../../class/hs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 830) # ln -s ../../header/h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 831) # cd ../../class/ss
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 832) # ln -s ../../header/h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 833)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 834)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 835) Testing the UVC function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 836) ------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 837)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 838) device: run the gadget, modprobe vivid::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 839)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 840) # uvc-gadget -u /dev/video<uvc video node #> -v /dev/video<vivid video node #>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 841)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 842) where uvc-gadget is this program:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 843) http://git.ideasonboard.org/uvc-gadget.git
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 844)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 845) with these patches:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 846)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 847) http://www.spinics.net/lists/linux-usb/msg99220.html
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 848)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 849) host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 850)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 851) luvcview -f yuv
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 852)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 853) 19. PRINTER function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 854) ====================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 855)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 856) The function is provided by usb_f_printer.ko module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 857)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 858) Function-specific configfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 859) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 860)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 861) The function name to use when creating the function directory is "printer".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 862) The printer function provides these attributes in its function directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 863)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 864) ========== ===========================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 865) pnp_string Data to be passed to the host in pnp string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 866) q_len Number of requests per endpoint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 867) ========== ===========================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 868)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 869) Testing the PRINTER function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 870) ----------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 871)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 872) The most basic testing:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 873)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 874) device: run the gadget::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 875)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 876) # ls -l /devices/virtual/usb_printer_gadget/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 877)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 878) should show g_printer<number>.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 879)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 880) If udev is active, then /dev/g_printer<number> should appear automatically.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 881)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 882) host:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 883)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 884) If udev is active, then e.g. /dev/usb/lp0 should appear.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 885)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 886) host->device transmission:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 887)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 888) device::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 889)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 890) # cat /dev/g_printer<number>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 891)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 892) host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 893)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 894) # cat > /dev/usb/lp0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 895)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 896) device->host transmission::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 897)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 898) # cat > /dev/g_printer<number>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 899)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 900) host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 901)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 902) # cat /dev/usb/lp0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 903)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 904) More advanced testing can be done with the prn_example
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 905) described in Documentation/usb/gadget_printer.rst.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 906)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 907)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 908) 20. UAC1 function (virtual ALSA card, using u_audio API)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 909) ========================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 910)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 911) The function is provided by usb_f_uac1.ko module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 912) It will create a virtual ALSA card and the audio streams are simply
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 913) sinked to and sourced from it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 914)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 915) Function-specific configfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 916) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 917)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 918) The function name to use when creating the function directory is "uac1".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 919) The uac1 function provides these attributes in its function directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 920)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 921) ================ ====================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 922) c_chmask capture channel mask
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 923) c_srate list of capture sampling rates (comma-separated)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 924) c_ssize capture sample size (bytes)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 925) c_mute_present capture mute control enable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 926) c_volume_present capture volume control enable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 927) c_volume_min capture volume control min value (in 1/256 dB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 928) c_volume_max capture volume control max value (in 1/256 dB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 929) c_volume_res capture volume control resolution (in 1/256 dB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 930) p_chmask playback channel mask
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 931) p_srate list of playback sampling rates (comma-separated)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 932) p_ssize playback sample size (bytes)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 933) p_mute_present playback mute control enable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 934) p_volume_present playback volume control enable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 935) p_volume_min playback volume control min value (in 1/256 dB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 936) p_volume_max playback volume control max value (in 1/256 dB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 937) p_volume_res playback volume control resolution (in 1/256 dB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 938) req_number the number of pre-allocated requests for both capture
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 939) and playback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 940) function_name name of the interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 941) ================ ====================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 942)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 943) The attributes have sane default values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 944)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 945) Testing the UAC1 function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 946) -------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 947)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 948) device: run the gadget
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 949) host: aplay -l # should list our USB Audio Gadget
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 950)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 951) This function does not require real hardware support, it just
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 952) sends a stream of audio data to/from the host. In order to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 953) actually hear something at the device side, a command similar
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 954) to this must be used at the device side::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 955)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 956) $ arecord -f dat -t wav -D hw:2,0 | aplay -D hw:0,0 &
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 957)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 958) e.g.::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 959)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 960) $ arecord -f dat -t wav -D hw:CARD=UAC1Gadget,DEV=0 | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 961) aplay -D default:CARD=OdroidU3