Skip to contentSkip to conversation

Question about f_uac1 gadget

DISCUSSION Noah Causin 2 participants 5 messages Mar 7, 2023 – Mar 11, 2023 USB

lore
Share & tools
lore
#0 lore raw

Hi,

I was wondering if the f_uac1 gadget supports more than two channels of audio.

Noah

#2 lore raw

Hi Ruslan,

I can't seem to get the f_uac1 to work with more than 2 channels. I'm able to setup f_uac2 with 8 channels.

I've tried a 5.1 and 7.1 setup (c_chmask=63 or 255, c_srate=44100, c_ssize=2) but I get a urb 0 error on the connected Linux laptop and the gnome sound-test freezes when testing a channel, no errors on the gadget device. My usb controller is a DWC3 on a RockPro64 board.

usb 3-2: USB disconnect, device number 9
usb 3-2: new high-speed USB device number 10 using xhci_hcd
usb 3-2: New USB device found, idVendor=1d6b, idProduct=0104, bcdDevice= 1.00 usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 3-2: Product: audioproduct
usb 3-2: Manufacturer: audiomanufacturer
usb 3-2: SerialNumber: audioserial
usb 3-2: cannot submit urb 0, error -90: internal error

Noah

Quoted 14 lines · Ruslan Bilovol
Quoted 5 lines · Noah Causin

Hi,

I was wondering if the f_uac1 gadget supports more than two channels of audio.

Yes it does, see channel mask configfs configuration options for capture/playback
in the documentation for UAC1 function:
https://www.kernel.org/doc/Documentation/ABI/testing/configfs-usb-gadget-uac1

Regards,
Ruslan

#3 lore raw
Quoted 11 lines · Noah Causin

Hi Ruslan,

I can't seem to get the f_uac1 to work with more than 2 channels. I'm able to setup f_uac2 with 8 channels.

I've tried a 5.1 and 7.1 setup (c_chmask=63 or 255, c_srate=44100, c_ssize=2) but I get a urb 0 error on the connected Linux laptop and the gnome sound-test freezes when testing a channel, no errors on the gadget device. My usb controller is a DWC3 on a RockPro64 board.

Quoted 9 lines

usb 3-2: USB disconnect, device number 9
usb 3-2: new high-speed USB device number 10 using xhci_hcd usb 3-2: New USB device found, idVendor=1d6b, idProduct=0104, bcdDevice= 1.00
usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 3-2: Product: audioproduct
usb 3-2: Manufacturer: audiomanufacturer
usb 3-2: SerialNumber: audioserial
usb 3-2: cannot submit urb 0, error -90: internal error

Hmmm.. I also can reproduce this issue, it seems that's some bug in the host USB audio driver. At least I see that it tries to send packets with size bigger than the endpoint's max packet size.

I reproduced it on my Debian laptop with (kernel v6.1) and can't reproduce on older Ubuntu with kernel v5.4.

BTW Noah what is the kernel version on your laptop where you see this issue?

Thanks,
Ruslan

#4 lore raw

The laptop has kernel 6.1.14 (Fedora 37)

I looked into the error message and found a patch description saying that the error: (cannot submit urb 0, error -90: internal error) can happen when a audio device's channel number does not match its data endpoint, leading to failure at the host driver.

https://github.com/DerRomtester/android_kernel_oneplus_msm8974/commit/2ef9cf0c9181e9472fa0be7885541e91189ecd5d

It seems like the f_uac1 gadget might not be syncing the channel number value with the data endpoint.

Noah

Quoted 34 lines · Ruslan Bilovol
Quoted 11 lines · Noah Causin

Hi Ruslan,

I can't seem to get the f_uac1 to work with more than 2 channels. I'm able to setup f_uac2 with 8 channels.

I've tried a 5.1 and 7.1 setup (c_chmask=63 or 255, c_srate=44100, c_ssize=2) but I get a urb 0 error on the connected Linux laptop and the gnome sound-test freezes when testing a channel, no errors on the gadget device. My usb controller is a DWC3 on a RockPro64 board.

Quoted 9 lines

usb 3-2: USB disconnect, device number 9
usb 3-2: new high-speed USB device number 10 using xhci_hcd usb 3-2: New USB device found, idVendor=1d6b, idProduct=0104, bcdDevice= 1.00
usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 3-2: Product: audioproduct
usb 3-2: Manufacturer: audiomanufacturer
usb 3-2: SerialNumber: audioserial
usb 3-2: cannot submit urb 0, error -90: internal error

Hmmm.. I also can reproduce this issue, it seems that's some bug in the host USB audio driver. At least I see that it tries to send packets with size bigger than the endpoint's max packet size.

I reproduced it on my Debian laptop with (kernel v6.1) and can't reproduce on older Ubuntu with kernel v5.4.

BTW Noah what is the kernel version on your laptop where you see this issue?

Thanks,
Ruslan