Re: [PATCH] ALSA: pcm: Show closed for DISCONNECTED state
From: Takashi Iwai
Date: Mon Jun 15 2026 - 09:52:06 EST
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@xxxxxxxxxx>
> ---
> 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
>