[PATCH] alsa: reread configuration when opening new devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2016-05-22 at 02:05 +0500, Alexander E. Patrakov wrote:
> 22.05.2016 02:03, Alexander E. Patrakov wrote:
> > 
> > If a card has been hot-plugged after pulseaudio start, alsa-lib still has
> > old configuration in memory, which doesn't have PCM definitions for the
> > new card. Thus, this error appears, and the device doesn't work:
> > 
> > I: [pulseaudio] (alsa-lib)confmisc.c: Unable to find definition 'cards.USB-Audio.pcm.front.0:CARD=0'
> > I: [pulseaudio] (alsa-lib)conf.c: function snd_func_refer returned error: No such file or directory
> > I: [pulseaudio] (alsa-lib)conf.c: Evaluate error: No such file or directory
> > I: [pulseaudio] (alsa-lib)pcm.c: Unknown PCM front:0
> > I: [pulseaudio] alsa-util.c: Error opening PCM device front:0: No such file or directory
> > 
> > The snd_config_update_free_global() function makes alsa-lib forget any
> > cached configuration and reparse all PCM definitions from scratch next
> > time it is told to open anything.
> > 
> > The trick has been copied from Phonon.
> > 
> > Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=54029
> > Signed-off-by: Alexander E. Patrakov <patrakov at gmail.com>

Thanks for the patch!

> Obviously, the proposed patch is invalid if PulseAudio calls 
> snd_something_open() from more than one thread. I don't know if this is 
> the case.

Technically PulseAudio does call snd_something_open() from multiple
threads, but that's ok, because the only non-main thread calls are done
when unsuspending, and unsuspending is done in
the PA_SINK_MESSAGE_SET_STATE handler, which is processed
synchronously. So the main thread is waiting while the IO thread does
the unsuspending.

I applied the patch to the "next" branch.

-- 
Tanu


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux