diff options
author | Jaroslav Kysela <perex@perex.cz> | 2010-08-20 10:31:17 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2010-08-20 10:33:32 +0200 |
commit | 97d25c0766405453d3c298bd51dd4916121a4f6a (patch) | |
tree | db8351c4531814eba61e3330090c618cc77fb127 | |
parent | 18b377dec2aa728d52dae55a19bbea35e231a1ef (diff) | |
download | alsa-lib-97d25c0766405453d3c298bd51dd4916121a4f6a.tar.gz |
namehint: Evaluate more possibilities for hw devices
This tries to fix the issue when logical device indexes does not match the
hardware device indexes (like hdmi -> 0:3, 1:7, 2:8, 3:9).
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r-- | src/control/namehint.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/control/namehint.c b/src/control/namehint.c index 18192921..e06d2407 100644 --- a/src/control/namehint.c +++ b/src/control/namehint.c @@ -414,6 +414,7 @@ static int add_card(struct hint_list *list, int card) const char *str; char ctl_name[16]; snd_ctl_card_info_t *info; + int device, max_device = 0; snd_ctl_card_info_alloca(&info); list->info = info; @@ -431,18 +432,25 @@ static int add_card(struct hint_list *list, int card) n = snd_config_iterator_entry(i); if (snd_config_get_id(n, &str) < 0) continue; + if (next_devices[list->iface] != NULL) { list->card = card; - list->device = -1; - err = next_devices[list->iface](list->ctl, &list->device); - if (list->device < 0) + device = max_device = -1; + err = next_devices[list->iface](list->ctl, &device); + if (device < 0) err = -EINVAL; + while (err >= 0 && device >= 0) { + err = next_devices[list->iface](list->ctl, &device); + if (device > max_device) + max_device = device; + ok++; + } ok = 0; - while (err >= 0 && list->device >= 0) { + for (device = 0; err >= 0 && device < max_device; device++) { + list->device = device; err = try_config(list, list->siface, str); if (err < 0) break; - err = next_devices[list->iface](list->ctl, &list->device); ok++; } if (ok) |