mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-01 22:58:47 -04:00
alsa: reread configuration when opening new devices
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@gmail.com>
This commit is contained in:
parent
4c42b3ef7c
commit
768c80f3c3
3 changed files with 26 additions and 0 deletions
|
|
@ -2146,6 +2146,15 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
|
|||
b = use_mmap;
|
||||
d = use_tsched;
|
||||
|
||||
/* Force ALSA to reread its configuration if module-alsa-card didn't
|
||||
* do it for us. This matters if our device was hot-plugged after ALSA
|
||||
* has already read its configuration - see
|
||||
* https://bugs.freedesktop.org/show_bug.cgi?id=54029
|
||||
*/
|
||||
|
||||
if (!card)
|
||||
snd_config_update_free_global();
|
||||
|
||||
if (mapping) {
|
||||
|
||||
if (!(dev_id = pa_modargs_get_value(ma, "device_id", NULL))) {
|
||||
|
|
|
|||
|
|
@ -1854,6 +1854,15 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
|
|||
b = use_mmap;
|
||||
d = use_tsched;
|
||||
|
||||
/* Force ALSA to reread its configuration if module-alsa-card didn't
|
||||
* do it for us. This matters if our device was hot-plugged after ALSA
|
||||
* has already read its configuration - see
|
||||
* https://bugs.freedesktop.org/show_bug.cgi?id=54029
|
||||
*/
|
||||
|
||||
if (!card)
|
||||
snd_config_update_free_global();
|
||||
|
||||
if (mapping) {
|
||||
|
||||
if (!(dev_id = pa_modargs_get_value(ma, "device_id", NULL))) {
|
||||
|
|
|
|||
|
|
@ -715,6 +715,14 @@ int pa__init(pa_module *m) {
|
|||
}
|
||||
|
||||
pa_modargs_get_value_boolean(u->modargs, "use_ucm", &u->use_ucm);
|
||||
|
||||
/* Force ALSA to reread its configuration. This matters if our device
|
||||
* was hot-plugged after ALSA has already read its configuration - see
|
||||
* https://bugs.freedesktop.org/show_bug.cgi?id=54029
|
||||
*/
|
||||
|
||||
snd_config_update_free_global();
|
||||
|
||||
if (u->use_ucm && !pa_alsa_ucm_query_profiles(&u->ucm, u->alsa_card_index)) {
|
||||
pa_log_info("Found UCM profiles");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue