Hey everyone!
I want to use the UAC Gadget function on the Genio 1200.
How can I enable it? Any recommendations for this?
Thanks a bunch!
Hey everyone!
I want to use the UAC Gadget function on the Genio 1200.
How can I enable it? Any recommendations for this?
Thanks a bunch!
Please follow the steps: (tested on kernel v6.6)
Enable UAC related kernel option
CONFIG_USB_CONFIGFS_F_UAC1=y
CONFIG_USB_CONFIGFS_F_UAC2=y
CONFIG_USB_CONFIGFS_F_UAC1_LEGACY=y
CONFIG_USB_CONFIGFS_F_ACC=y
CONFIG_USB_CONFIGFS_F_AUDIO_SRC=y
Add UAC config to USB gadget via console (UART/SSH) on EVK
cd /sys/kernel/config/usb_gadget/g1
echo "" > UDC
rm -rf configs/c.1/ffs.adb # remove adb function
rm -rf configs/c.1/rndis.usb0 # remove rndis function
rm -rf configs/c.1/uac2.usb0 # remove previous uac2 function
echo "0x046D" > idVendor
echo "0x087C" > idProduct
echo "0x0010" > bcdDevice
echo "0xef" > bDeviceClass
echo "0x02" > bDeviceSubClass
echo "0x01" > bDeviceProtocol
mkdir strings/0x409
echo "0123456789ABCDEF" > strings/0x409/serialnumber
echo "Mediatek Inc." > strings/0x409/manufacturer
echo "uac gadget" > strings/0x409/product
# UAC2
mkdir -p functions/uac2.usb0
echo 8000,16000,44100,48000,96000 > functions/uac2.usb0/c_srate
echo 2 > functions/uac2.usb0/c_ssize # capture 2 bytes, 16bits
echo 0x3 > functions/uac2.usb0/c_chmask # 0x3 stereo(FL+FR)
echo 1 > functions/uac2.usb0/c_mute_present
echo 1 > functions/uac2.usb0/c_volume_present
echo -5120 > functions/uac2.usb0/c_volume_min
echo 8000,16000,44100,48000,96000 > functions/uac2.usb0/p_srate
echo 2 > functions/uac2.usb0/p_ssize # playback 2 bytes, 16bits
echo 0x3 > functions/uac2.usb0/p_chmask # 0x3 stereo(FL+FR)
echo 1 > functions/uac2.usb0/p_mute_present
echo 1 > functions/uac2.usb0/p_volume_present
echo -5120 > functions/uac2.usb0/p_volume_min
ln -s functions/uac2.usb0/ configs/c.1 # bind uac2 function
echo $(ls /sys/class/udc | awk 'NR==1') > UDC # bind to UDC
echo "uac setup done!"
Connect USB-0 to Windows PC, a USB audio device “Source/Sink” should be registered.
Play audio on EVK, receive(hear) on PC
aplay --list-devices to find the UAC2 Gadget.card 1: UAC2Gadget [UAC2_Gadget], device 0: UAC2 PCM [UAC2 PCM]
Subdevices: 1/1
Subdevice #0: subdevice #0
aplay piano2.wav -r 48000 -c 2 -D hw:1,0Play audio on PC, record on EVK
arecord -D hw:1,0 -f S16_LE -d 10 uac.wav to get 10sec sound recording from soundcard 1, device 0.