Hi Ruslan, Dne 11. 02. 20 v 17:10 Ruslan Bilovol napsal(a): > On Thu, Feb 6, 2020 at 3:35 PM Pavel Hofman <pavel.hofman@xxxxxxxxxxx> wrote: >> >> Hi, >> >> The existing UAC2 implementation presents itself as asynchronous >> USB_ENDPOINT_SYNC_ASYNC >> https://github.com/torvalds/linux/blob/master/drivers/usb/gadget/function/f_uac2.c#L276 >> + >> https://github.com/torvalds/linux/blob/master/drivers/usb/gadget/function/f_uac2.c#L285 >> . >> >> However: >> 1) The function does not define any feedback endpoint >> >> 2) IMO in reality it is adaptive - the g_audio capture device accepts >> any data passed by the USB host, the USB host is the one which defines >> the data pace. >> >> While Linux and reportedly OSX accept the async EP OUT without explicit >> feedback EP IN, Windows does not. >> >> Simply changing USB_ENDPOINT_SYNC_ASYNC to USB_ENDPOINT_SYNC_ADAPTIVE >> for the FS and HS output endpoints fixes the windows problem and IMO >> corrects the config to reflect real function. >> >> There are multiple projects underway adding the async feedback EP, but >> in the meantime I think the .bmAttributes information should be changed >> as above, making the device usable in Windows for everyone. > > Are you working on async feedback EP implementation? I'm interested in that > feature and I can implement it soon but do not want to do double work > if somebody > is already working on it and will send to the community soon I would be happy if you focused on the feedback. I want to solve the g_audio usability somehow first https://lore.kernel.org/linux-usb/df2eeff0-ca9c-35f9-2e72-8426b2cf72c9@xxxxxxxxxxx/ as it would allow easy usage of the existing adaptive gadget version. The feedback - I have been shown a simple implementation which is not public and is not using the g_audio alsa device on the other side. IMO the key issue is designing the async feedback to accept feedback values from userspace as well as from any third-party kernel module. Why userspace? The stream provided by the g_audio capture device can be output to a real master-clock alsa device (e.g. after synchronous resampling), be sent by network to some master-clock device, many other options possible. Any master-clock output device/ userspace sink should be able to provide data for calculating proper up-to-date feedback value for the slaved UAC2 gadget. I have done a few trials with master alsa output device - https://www.diyaudio.com/forums/pc-based/342070-linux-usb-audio-gadget-rpi4-otg.html#post5909816 https://www.diyaudio.com/forums/pc-based/342070-linux-usb-audio-gadget-rpi4-otg.html#post5910911 Details for alsa-lib are discussed in https://www.spinics.net/lists/alsa-devel/msg96781.html This is a solution I need - syncing the UAC2 gadget to master clock of real alsa soundcard . But again - I think the solution should be flexible to support any source of feedback information, be it in kernel or from userspace. Perhpas we should open a new thread on the async feedback, IMO it will be long :-) Thanks, Pavel.