Hi,
The current audio gadget has no way to inform the gadget side that the
host side has started playback/capture and that gadget-side alsa
processes should be started.
Playback/capture processes on the host side do not get stuck without the
gadget side consuming/producing data (OUT requests are ignored in
u_audio_iso_complete, IN ones send initial zeros in their req->buf).
However, playback/capture processes on the gadget side get stuck without
the host side sending playback OUT packets or capture IN requests and
time out with error. If there was a way to inform the gadget side that
playback/capture has started on the host side, the gadget clients could
react accordingly.
I have been trying to investigate the packet flow/behavior in
u_audio:u_audio_iso_complete, u_audio_start_capture/playback,
u_audio_stop_capture/playback but could not find a pattern which would
recognize that playback or capture has started. I see incoming OUT and
IN requests shortly after gadget enumeration. Also before starting
playback/capture both _start_ and _stop_ method are called. I guess the
actual sequence will be specific for every UAC2, maybe even for every
player/capture app on the host.
Technically a boolean alsa ctrl could be used for each direction
(Capture Running/Playback Running, resp. specific rate or zero in
Capture Rate/Playback Rate in Julian's multiple rates patches I am
preparing), with the gadget client registering for notifications.But
detecting when to set the ctrl value is the key.
Thanks a lot for ideas and recommendations.
Pavel.