aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2014-09-04 14:21:03 +0200
committerTakashi Iwai <tiwai@suse.de>2014-09-04 14:51:35 +0200
commitce40e3f83c4a751fec1607179cad1aae87aaa48f (patch)
treee277e862e173c0457e6081666cae1ca7be49ed6b
parente2db7fed4910cef92b561ed27760cb1a9c22e572 (diff)
downloadhda-emu-ce40e3f83c4a751fec1607179cad1aae87aaa48f.tar.gz
hda-emu: Deal with two cards with one codec each
When using the -i switch to specify an index, we need to deal with two common cases: 1) All codecs belong to one card 2) There are as many cards as there are codecs This patch makes sure we pick the correct pci ID and SSID for the second case, too. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--hda-parse.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/hda-parse.c b/hda-parse.c
index 8d9a3c7..d9fc311 100644
--- a/hda-parse.c
+++ b/hda-parse.c
@@ -481,21 +481,21 @@ static int parse_codec_recursive(const char *buffer)
}
/* check the extra information from alsa-info output */
-static void check_alsa_info(char *line)
+static int check_alsa_info(char *line, int override)
{
int dummy, classid, vendor, id, rev;
if (sscanf(line, "%02x:%02x.%1d %04x: %04x:%04x (rev %02x)",
&dummy, &dummy, &dummy, &classid, &vendor, &id, &rev) == 7) {
- if (classid == 0x0403 && !codec->pci_vendor) {
+ if (classid == 0x0403 && (override || !codec->pci_vendor)) {
codec->pci_vendor = vendor;
codec->pci_device = id;
codec->pci_revision = rev;
}
- return;
+ return 0;
}
if (sscanf(line, " Subsystem: %04x:%04x", &vendor, &id) == 2) {
- if (!codec->pci_subvendor) {
+ if (override || !codec->pci_subvendor) {
codec->pci_subvendor = vendor;
codec->pci_subdevice = id;
hda_log(HDA_LOG_INFO, "Getting PCI ID %04x:%04x (%04x:%04x) rev %02x\n",
@@ -503,8 +503,9 @@ static void check_alsa_info(char *line)
codec->pci_subvendor, codec->pci_subdevice,
codec->pci_revision);
}
- return;
+ return 1;
}
+ return 0;
}
static int add_sysfs_list(struct xhda_codec *codec, int *vals)
@@ -612,7 +613,7 @@ static void clear_codec(struct xhda_codec *codec)
int parse_codec_proc(FILE *fp, struct xhda_codec *codecp, int codec_index)
{
char buffer[256], *p;
- int curidx = -1;
+ int curidx = -1, pciidx = 0;
int err = 0;
codec = codecp;
@@ -625,7 +626,8 @@ int parse_codec_proc(FILE *fp, struct xhda_codec *codecp, int codec_index)
again:
if (parse_mode == PARSE_START) {
if (!strmatch(buffer, "Codec: ")) {
- check_alsa_info(buffer);
+ if (check_alsa_info(buffer, pciidx == codec_index))
+ pciidx++;
continue;
}
curidx++;