60 lines
1.8 KiB
Diff
60 lines
1.8 KiB
Diff
|
From 97d25c0766405453d3c298bd51dd4916121a4f6a Mon Sep 17 00:00:00 2001
|
||
|
From: Jaroslav Kysela <perex@perex.cz>
|
||
|
Date: Fri, 20 Aug 2010 10:31:17 +0200
|
||
|
Subject: [PATCH 18/21] 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>
|
||
|
---
|
||
|
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 1819292..e06d240 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)
|
||
|
--
|
||
|
1.7.2.1
|
||
|
|