[alsa-devel] Order of device overrides in config files

Jaroslav Kysela perex at perex.cz
Mon Jun 11 15:34:39 CEST 2018


Dne 11.6.2018 v 15:18 Pavel Hofman napsal(a):
> Dne 11.6.2018 v 14:20 Jaroslav Kysela napsal(a):
>>
>> It means operation mode 'override':
>>
>> http://www.alsa-project.org/alsa-doc/alsa-lib/conf.html
>>
>> By default, the operation mode is 'merge+create'.
> 
> Hi Jaroslav,
> 
> Thank you for the information and the link.
> 
> In alsa.conf I see the order of config files which is same as my strace 
> output reveals:
> 
> @hooks [
>          {
>                  func load
>                  files [
>                          {
>                                  @func concat
>                                  strings [
>                                          { @func datadir }
>                                          "/alsa.conf.d/"
>                                  ]
>                          }
>                          "/etc/asound.conf"
>                          "~/.asoundrc"
>                  ]
>                  errors false
>          }
> ]
> 
> 
> The default device is overriden in pulse-alsa.conf which is called by 
> hook_func.pulse_load_if_running defined in alsa.conf.d/pulse.conf read 
> BEFORE processing my .asoundrc . Strace shows that reading 
> pulse-alsa.conf occurs AFTER reading .asoundrc . It works as specified :-)

I cannot confirm that - the order specified in the configuration file
(files compound/array) is retained on my system (as it should):

open("/usr/share/alsa/alsa.conf", O_RDONLY) = 3
open("/usr/share/alsa/alsa.conf.d/",
O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
open("/usr/share/alsa/alsa.conf.d//50-pulseaudio.conf", O_RDONLY) = 3
open("/usr/share/alsa/alsa.conf.d//99-pulseaudio-default.conf",
O_RDONLY) = 3
open("/etc/asound.conf", O_RDONLY)      = 3
open("/home/perex/.asoundrc", O_RDONLY) = 3

The snd_config_hook_load() in src/conf.c function handles that.

> Please would it make sense to call .asoundrc (somehow...) after all the 
> config hooks were processed so that redefining the default device in the 
> user's config actually works? Many users get confused by this behavior 
> as it is not really obvious. No matter what they list in their .asoundrc 
> (correctly following alsa documentation), the default device always ends 
> up to be the pulse plugin.

It seems that there's something different in your system, so the
~/.asoundrc file is not parsed as last.

						Jaroslav

-- 
Jaroslav Kysela <perex at perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.


More information about the Alsa-devel mailing list