From: "Arun Raghavan" <arun@arunraghavan.net>
To: "Pavel Hofman" <pavel.hofman@ivitera.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Cc: "Julian Scheel" <julian@jusst.de>, "Takashi Iwai" <tiwai@suse.de>,
"Ruslan Bilovol" <ruslan.bilovol@gmail.com>,
"Jerome Brunet" <jbrunet@baylibre.com>
Subject: Re: RFC: usb: gadget: u_audio: Notifying gadget that host started playback/capture?
Date: Wed, 20 Sep 2023 21:30:28 -0400 [thread overview]
Message-ID: <27b4b607-5d71-4e5d-a0ff-530c25752213@app.fastmail.com> (raw)
In-Reply-To: <35766f0f-784d-d37a-6d07-665f9ee88331@ivitera.com>
Hi folks,
On Fri, 1 Oct 2021, at 8:38 AM, Pavel Hofman wrote:
> Hi,
>
> Dne 08. 09. 21 v 10:21 Pavel Hofman napsal(a):
>> 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 drafted a simple patch for u_audio.c which defines read-only boolean
> ctl elems "Capture Requested" and "Playback Requested". Their values are
> set/reset in methods u_audio_start_capture/playback and
> u_audio_stop_capture/playback, i.e. at changes of respective altsettings
> from 0 to 1 and back. Every ctl elem value change sends notification via
> snd_ctl_notify. The principle works OK for capture/playback start/stop
> on the host, as monitored by alsactl:
>
> pi@raspberrypi:~ $ alsactl monitor hw:UAC2Gadget
> node hw:UAC2Gadget, #4 (3,0,0,Capture Requested,0) VALUE
> node hw:UAC2Gadget, #4 (3,0,0,Capture Requested,0) VALUE
> node hw:UAC2Gadget, #3 (3,0,0,Playback Requested,0) VALUE
> node hw:UAC2Gadget, #3 (3,0,0,Playback Requested,0) VALUE
>
> However at enumeration the USB host switches both playback and capture
> altsettings repeatedly, generating "fake" events from the gadget side
> POW. The host even sends regular-sized EP-OUT packets filled with zeros
> during enumeration (tested on linux only for now).
>
> Please is there any way to "detect" the enumeration stage to mask out
> the "fake" playback/capture start/stop events?
>
> The attached patch does not apply cleanly to mainline u_audio.c because
> it's rebased on other patches not submitted yet but it's only a
> discussion inducer for now.
Resurrecting this one -- is there any input on how we want to deal wit letting UAC gadgets know when the host is sending/receiving data?
Cheers,
Arun
next prev parent reply other threads:[~2023-09-21 1:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-08 8:21 RFC: usb: gadget: u_audio: Notifying gadget that host started playback/capture? Pavel Hofman
2021-10-01 12:38 ` Pavel Hofman
2023-09-21 1:30 ` Arun Raghavan [this message]
2023-09-22 7:09 ` Pavel Hofman
2023-10-04 23:15 ` Arun Raghavan
2023-10-05 14:30 ` Pavel Hofman
2023-10-25 16:33 ` Arun Raghavan
2023-10-30 16:19 ` Arun Raghavan
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=27b4b607-5d71-4e5d-a0ff-530c25752213@app.fastmail.com \
--to=arun@arunraghavan.net \
--cc=alsa-devel@alsa-project.org \
--cc=jbrunet@baylibre.com \
--cc=julian@jusst.de \
--cc=linux-usb@vger.kernel.org \
--cc=pavel.hofman@ivitera.com \
--cc=ruslan.bilovol@gmail.com \
--cc=tiwai@suse.de \
/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