linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Hofman <pavel.hofman@ivitera.com>
To: Linux USB <linux-usb@vger.kernel.org>
Subject: usb:gadget.f_uac2: Options for u_audio.c behavior when UAC2 host is disconnected/idle
Date: Thu, 6 Feb 2020 14:43:48 +0100	[thread overview]
Message-ID: <df2eeff0-ca9c-35f9-2e72-8426b2cf72c9@ivitera.com> (raw)

Hi,

I would like to start a discussion about options to make the g_audio 
device more usable. Currently if the USB UAC2 function does not 
supply/consume any audio data (USB disconnected or the host side is not 
using the UAC2 gadget, the g_audio devices (both capture and playback) 
are waiting, leading eventually to an error. This makes using the 
feature rather inconvenient.

Possible options (certainly more are available)

1) The alsa devices will be openable at any time and when the UAC2 is 
not producing/consuming, the alsa devices will be generating 
zeros/dropping samples. Dropping samples would be similar to the 
snd-aloop behavior.

2) Opening the alsa devices will fail when the UAC2 is not actively 
running, and the pcm stream will be closed when UAC2 stops being active. 
This is similar to how SPDIF receivers are coded in alsa drivers - if 
change in the incoming SPDIF stream is detected (no samples, different 
sample rate), the pcm stream is closed 
https://github.com/torvalds/linux/blob/master/sound/i2c/other/ak4117.c#L504 
It is up to the application to handle the error/close.

The behavior could be configurable via some params, if needed.

Thanks a lot for any suggestions and recommendations.

Best regards,


Pavel.


                 reply	other threads:[~2020-02-06 13:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=df2eeff0-ca9c-35f9-2e72-8426b2cf72c9@ivitera.com \
    --to=pavel.hofman@ivitera.com \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).