Modifying USB Gadget Based on Linux 4.1.15 Source Code to Support Both Microphone and Speaker

Learning USB for continuous improvement.To understand the USB device drivers under Linux, I started with USB Gadget. After extensive experimentation, I found that UAC1 does not support microphone creation. Therefore, I had to shift from configuring the KS file system to analyzing the source code. By analyzing the UAC1 source code (f_uac1.c), I realized that the microphone functionality was not implemented. This is also mentioned in the RK documentation (Rockchip Developer Guide Linux 4.4 USB Gadget UAC CN).Through reading the source code of f_uac1.c, I gained a profound understanding of the following statement:

[1] Kernel 4.4 supports USB Gadget UAC1/UAC2 recording and playback functions. Problem description: The USB Gadget UAC1/UAC2 driver in Kernel-4.4 has the following issues: UAC1 only supports playback functionality and requires an actual sound card to work. UAC2 is incompatible with Windows; although it can support recording and playback, the functionality is not complete.

Complaining about it does no good. I had to take matters into my own hands, leveraging my extensive knowledge of USB/UAC to manually modify it to support both microphone and speaker. Consider this my first practical lesson in Linux/USB.After repeated debugging and modifications, I finally succeeded, and I will now present the results in the video below.

Leave a Comment