diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-08-10 14:11:57 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-08-10 14:14:10 +0200 |
commit | 96da0c842d14b40ce8e37726b259229634b3aa21 (patch) | |
tree | 0b99dcc9fcd79f141babd7aad3d2dc28ad6109bc | |
parent | 34d63b449fbfd13064d0a65b5b8caf17e4251dc1 (diff) |
Fix driver conf parsing in snd_config_hook_load_for_all_cards()
Reported by Kevin Goodsell.
Summary: load_for_all_cards fails with existing configuration elements
In snd_config_hook_load_for_all_cards, the first call to
snd_config_search attempts to locate an existing configuration node with
the name of the driver. Typically none is found, and everything is
good. However, if such a node is located, the next line assumes it is a
leaf node with type 'string' and calls snd_config_get_string to fetch
the string value. If this fails, the entire hook is abandoned.
Because of this, setting something like the following in asoundrc:
cards.<driver name>.foo 0
is sufficient to disable the entire card-specific configuration.
As a concrete example, I have a HDA-Intel sound card. dmix.conf includes
a way to set period_size, period_time, and periods by using
configuration elements of the form cards.<driver name>.pcm.dmix.<var>.
In ~/.asoundrc I add
cards.HDA-Intel.pcm.dmix.period_size 1024
This will cause HDA-Intel.conf to fail to load, and the pcm defined in
default.conf will fail to find the device-specific pcm
cards.HDA-Intel.pcm.default, and fall back on the default pcm using
plughw. By attempting to configure dmix, I have disabled it.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | src/conf.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -3477,9 +3477,8 @@ int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config, err = snd_determine_driver(card, &fdriver); if (err < 0) return err; - if (snd_config_search(root, fdriver, &n) >= 0) { - if (snd_config_get_string(n, &driver) < 0) - goto __err; + if (snd_config_search(root, fdriver, &n) >= 0 && + snd_config_get_string(n, &driver) >= 0) { assert(driver); while (1) { char *s = strchr(driver, '.'); |