This series aims at integrating configfs into the audio gadget, the way it has been done for acm, ncm, ecm, eem, ecm subset, rndis, obex, phonet, mass_storage, FunctionFS, loopback, sourcesink; rfc for uvc has also been sent. It contains everything that is required to provide the equivalent of g_audio.ko with configfs. It is meant for 3.18. Rebased onto Felipe's testing-next. BACKWARD COMPATIBILITY ====================== Please note that the old g_audio.ko is still available and works. USING THE NEW "GADGET" ====================== Please refer to this post: http://www.spinics.net/lists/linux-usb/msg76388.html for general information from Sebastian on how to use configfs-based gadgets (*). With configfs the procedure is as follows, compared to the information mentioned above (*): instead of mkdir functions/acm.ttyS1 do mkdir functions/uac2.0 or mkdir functions/uac1.0 In the uac2.0 directory there will be the following attributes: chmask - capture channel mask c_srate - capture sampling rate c_ssize - capture sample size (bytes) p_chmask - playback channel mask p_srate - playback sampling rate p_ssize - playback sample size (bytes) while in the uac1.0 directory there will be the following attributes: audio_buf_size - audio buffer size fn_cap - capture pcm device file name fn_cntl - control device file name fn_play - playback pcm device file name req_buf_size - ISO OUT endpoint request buffer size req_count - ISO OUT endpoint request count All attributes have sane default values. An example gadget with f_uac2 or f_uac1 function: $ modprobe libcomposite $ mount none cfg -t configfs $ mkdir cfg/usb_gadget/g1 $ cd cfg/usb_gadget/g1 $ mkdir configs/c.1 $ mkdir functions/uac2.0 or $ mkdir functions/uac1.0 $ mkdir strings/0x409 $ mkdir configs/c.1/strings/0x409 $ echo 0x0101 > idProduct $ echo 0x1d6b > idVendor $ echo my-serial-num > strings/0x409/serialnumber $ echo my-manufacturer > strings/0x409/manufacturer $ echo "Test gadget" > strings/0x409/product $ echo "Conf 1" > configs/c.1/strings/0x409/configuration $ echo 120 > configs/c.1/MaxPower $ ln -s functions/uac2.0 configs/c.1 or $ ln -s functions/uac1.0 configs/c.1 $ echo 12480000.hsotg > cfg/usb_gadget/g1/UDC Available udc names can be found with: $ ls /sys/class/udc After unbinding the gadget with echo "" > UDC the symbolic links in the configuration directory can be removed, the strings/* subdirectories in the configuration directory can be removed, the strings/* subdirectories at the gadget level can be removed and the configs/* subdirectories can be removed. The functions/* subdirectories can be removed. After that the gadget directory can be removed. Daemons need to be closed and then the respective modules can be unloaded. TESTING THE FUNCTIONS (actually there is only one) ===================== uac2, uac1) device: run the gadget host: aplay -l # should list our USB Audio Gadget Andrzej Pietrasiewicz (15): usb: gadget: audio: Use container_of to free audio_dev usb: gadget: f_uac2: convert to new function interface with backward compatibility usb: gadget: audio: convert to new interface of f_uac2 usb: gadget: f_uac2: remove compatibility layer usb: gadget: f_uac2: use usb_gstrings_attach usb: gadget: f_uac2: use defined constants as defaults usb: gadget: f_uac2: add configfs support usb: gadget: f_uac1: add function strings usb: gadget: f_uac1: prepare for separate compilation usb: gadget: f_uac1: convert to new function interface with backward compatibility usb: gadget: audio: convert to new interface of f_uac1 usb: gadget: f_uac1: remove compatibility layer usb: gadget: f_uac1: use usb_gstrings_attach usb: gadget: f_uac1: use defined constants as defaults usb: gadget: f_uac1: add configfs support Documentation/ABI/testing/configfs-usb-gadget-uac1 | 12 + Documentation/ABI/testing/configfs-usb-gadget-uac2 | 12 + drivers/usb/gadget/Kconfig | 6 + drivers/usb/gadget/function/Makefile | 4 + drivers/usb/gadget/function/f_uac1.c | 337 +++++++++++++++---- drivers/usb/gadget/function/f_uac2.c | 359 ++++++++++++++------- drivers/usb/gadget/function/u_uac1.c | 38 +-- drivers/usb/gadget/function/u_uac1.h | 31 +- drivers/usb/gadget/function/u_uac2.h | 42 +++ drivers/usb/gadget/legacy/Kconfig | 2 + drivers/usb/gadget/legacy/audio.c | 149 ++++++++- 11 files changed, 786 insertions(+), 206 deletions(-) create mode 100644 Documentation/ABI/testing/configfs-usb-gadget-uac1 create mode 100644 Documentation/ABI/testing/configfs-usb-gadget-uac2 create mode 100644 drivers/usb/gadget/function/u_uac2.h -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html