diff options
author | Leandro A. F. Pereira <leandro@hardinfo.org> | 2007-07-29 20:06:48 +0000 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2007-07-29 20:06:48 +0000 |
commit | c394e9e51c4867c42d4082623f84ad92ed80463b (patch) | |
tree | dd59b23f5f9198cb8268765133396d1d364f2b3d /hardinfo2/arch/linux | |
parent | 058f63cb3c49c53b0798ea61f92ab44c93a968ee (diff) |
Make it possible to update the PCI ID file. Will only show up if the default one (/usr/share/misc/pci.ids) is missing.
Diffstat (limited to 'hardinfo2/arch/linux')
-rw-r--r-- | hardinfo2/arch/linux/common/pci.h | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/hardinfo2/arch/linux/common/pci.h b/hardinfo2/arch/linux/common/pci.h index 554c3dca..388ce9aa 100644 --- a/hardinfo2/arch/linux/common/pci.h +++ b/hardinfo2/arch/linux/common/pci.h @@ -21,16 +21,32 @@ __scan_pci(void) { FILE *lspci; gchar buffer[256], *buf, *strhash = NULL, *strdevice = NULL; - gchar *category = NULL, *name = NULL; - gint n = 0; - - if (!(lspci = popen(LSPCI, "r"))) { - goto pci_error; + gchar *category = NULL, *name = NULL, *icon; + gint n = 0, x = 0; + + buf = g_build_filename(g_get_home_dir(), ".hardinfo", "pci.ids", NULL); + if (!g_file_test(buf, G_FILE_TEST_EXISTS)) { + DEBUG("using system-provided PCI IDs"); + g_free(buf); + if (!(lspci = popen(LSPCI, "r"))) { + goto pci_error; + } + } else { + gchar *tmp; + + tmp = g_strdup_printf("%s -i '%s'", LSPCI, buf); + g_free(buf); + buf = tmp; + + DEBUG("using updated PCI IDs (from %s)", buf); + if (!(lspci = popen(tmp, "r"))) { + g_free(buf); + goto pci_error; + } else { + g_free(buf); + } } - gchar *icon; - - int x = 0; /* unique Memory, Capability and I/O port */ while (fgets(buffer, 256, lspci)) { buf = g_strstrip(buffer); |