diff options
Diffstat (limited to 'hardinfo2')
| -rw-r--r-- | hardinfo2/arch/linux/common/pci.h | 32 | ||||
| -rw-r--r-- | hardinfo2/devices.c | 17 | 
2 files changed, 39 insertions, 10 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); diff --git a/hardinfo2/devices.c b/hardinfo2/devices.c index e1ccf6c9..6221769c 100644 --- a/hardinfo2/devices.c +++ b/hardinfo2/devices.c @@ -23,6 +23,7 @@  #include <hardinfo.h>  #include <shell.h>  #include <iconcache.h> +#include <syncmanager.h>  #include <expr.h>  #include <socket.h> @@ -346,8 +347,20 @@ guchar hi_module_get_weight(void)  void hi_module_init(void)  { -    moreinfo = -	g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); +    if (!g_file_test("/usr/share/misc/pci.ids", G_FILE_TEST_EXISTS)) { +        static SyncEntry se[] = { +            { +             .fancy_name = "Update PCI ID listing", +             .name = "GetPCIIds", +             .save_to = "pci.ids", +             .get_data = NULL +            } +        }; + +        sync_manager_add_entry(&se[0]); +    } + +    moreinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);      __init_memory_labels();  } | 
