All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Ai Chao <aichao@kylinos.cn>
Cc: perex@perex.cz, tiwai@suse.com, kees@kernel.org,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: pcm: Show closed for DISCONNECTED state
Date: Mon, 15 Jun 2026 15:51:56 +0200	[thread overview]
Message-ID: <87o6hbsygz.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260615132657.2097213-1-aichao@kylinos.cn>

On Mon, 15 Jun 2026 15:26:57 +0200,
Ai Chao wrote:
> 
> Show "closed" for DISCONNECTED state allow audio service
> to detect USB reset/disconnect and reinitialize the device.

Hmm, why it must be that?  The state is shown as "DISCONNECTED".

IOW, does this matter for which application and how do we have to
imitate as if the file got closed?


thanks,

Takashi

> 
> Signed-off-by: Ai Chao <aichao@kylinos.cn>
> ---
>  sound/core/pcm.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/sound/core/pcm.c b/sound/core/pcm.c
> index bfedf571e021..6ce35492ea56 100644
> --- a/sound/core/pcm.c
> +++ b/sound/core/pcm.c
> @@ -450,6 +450,14 @@ static void snd_pcm_substream_proc_status_read(struct snd_info_entry *entry,
>  		snd_iprintf(buffer, "error %d\n", err);
>  		return;
>  	}
> +	/*
> +	 * Show "closed" for DISCONNECTED state allow audio service
> +	 * to detect USB reset/disconnect and reinitialize the device.
> +	 */
> +	if (status.state == SNDRV_PCM_STATE_DISCONNECTED) {
> +		snd_iprintf(buffer, "closed\n");
> +		return;
> +	}
>  	snd_iprintf(buffer, "state: %s\n", snd_pcm_state_name(status.state));
>  	snd_iprintf(buffer, "owner_pid   : %d\n", pid_vnr(substream->pid));
>  	snd_iprintf(buffer, "trigger_time: %lld.%09lld\n",
> -- 
> 2.25.1
> 

  reply	other threads:[~2026-06-15 13:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-15 13:26 [PATCH] ALSA: pcm: Show closed for DISCONNECTED state Ai Chao
2026-06-15 13:51 ` Takashi Iwai [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-06-16  2:06 Ai Chao
2026-06-16  7:24 ` Takashi Iwai
2026-06-17  7:19 Re: " Ai Chao
2026-06-17  8:36 ` Jaroslav Kysela
2026-06-17  8:53   ` Takashi Iwai

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=87o6hbsygz.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=aichao@kylinos.cn \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.