[alsa-devel] Options for ASYNC feedback source in USB-audio gadget (USB OTG)?

Pavel Hofman pavhofman at gmail.com
Wed Aug 28 13:17:01 CEST 2019


Hi,

The existing usb-audio v.2 gadget defines its EP OUT as asynchronous
https://github.com/torvalds/linux/blob/master/drivers/usb/gadget/function/f_uac2.c#L276
, but does not define any feedback IN EP (which is against USB audio
class 2.0 specs).  Windows 10 USB audio class 2 driver requires
presence of the feedback EP. By changing the EP OUT to adaptive (which
in fact it is), we could fix the driver issue and windows plays
through such device (RPi4) correctly now (linux/OSX already worked OK
before). We will post a patch soon.

RPi can now be used as an "intelligent" USB soundcard, allowing
further processing in linux on RPi, before outputting to some final
sound device.

However, there are two clock domains involved - the host USB
controller sending stream to the USB gadget, and the output soundcard
of the gadget. While adaptive resampling is possible (jackd, PA do
that), IMO the correct solution is going back to ASYNC EP OUT in the
audio gadget and implementing a proper feedback EP.

But the feedback EP needs input data. The whole chain behind the
virtual capture alsa device defined by the gadget driver is clocked by
the playback soundcard. May I ask for your opinions on possible
options for

1) gathering the feedback data from the playback chain
2) passing the gathered samplerate-diff data to the gadget module for
the feedback EP to send to the USB host

A general solution would be very useful, at best without using
alsa-lib defined PCM devices (e.g. Java still supports only hardware
devices (hw:X), not  PCM devices defined by alsa-lib).

I very much appreciate your suggestions and help.

Best regards,

Pavel.


More information about the Alsa-devel mailing list