aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2020-06-22 13:47:21 +0200
committerTakashi Iwai <tiwai@suse.de>2020-06-22 13:47:21 +0200
commitce0608f136e15f5a1202f2db7147d0ab82ccb8d7 (patch)
tree54a33b643a06a782f5db1f8afe71f893d061b4d2
parent25156136f87d803115e05c8f16f3c0cc6341447d (diff)
downloadhda-emu-ce0608f136e15f5a1202f2db7147d0ab82ccb8d7.tar.gz
Parse PCI ID and SSID in the new alsa-info.sh format
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--hda-parse.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/hda-parse.c b/hda-parse.c
index b5abd5e..4deea8c 100644
--- a/hda-parse.c
+++ b/hda-parse.c
@@ -494,7 +494,19 @@ static int check_alsa_info(char *line, int override)
}
return 0;
}
- if (sscanf(line, " Subsystem: %04x:%04x", &vendor, &id) == 2) {
+ if (sscanf(line, "%02x:%02x.%1d Audio device [%04x]:",
+ &dummy, &dummy, &dummy, &classid) == 4 &&
+ classid == 0x0403 &&
+ (override || !codec->pci_vendor)) {
+ if (sscanf(line + strlen(line) - 12, "[%04x:%04x]",
+ &vendor, &id) == 2) {
+ codec->pci_vendor = vendor;
+ codec->pci_device = id;
+ }
+ return 0;
+ }
+ if (sscanf(line, "\tSubsystem: %04x:%04x", &vendor, &id) == 2 ||
+ sscanf(line, " Subsystem: %04x:%04x", &vendor, &id) == 2) {
if (override || !codec->pci_subvendor) {
codec->pci_subvendor = vendor;
codec->pci_subdevice = id;
@@ -505,6 +517,21 @@ static int check_alsa_info(char *line, int override)
}
return 1;
}
+ if (!strncmp(line, "\tSubsystem: ", 12) ||
+ !strncmp(line, " Subsystem: ", 19)) {
+ if ((override || !codec->pci_subvendor) &&
+ sscanf(line + strlen(line) - 12, "[%04x:%04x]",
+ &vendor, &id) == 2) {
+ codec->pci_subvendor = vendor;
+ codec->pci_subdevice = id;
+ hda_log(HDA_LOG_INFO, "Getting PCI ID %04x:%04x (%04x:%04x) rev %02x\n",
+ codec->pci_vendor, codec->pci_device,
+ codec->pci_subvendor, codec->pci_subdevice,
+ codec->pci_revision);
+ return 1;
+ }
+ }
+
return 0;
}