From 47c10af317faae9184d5d9e1f1f37c2913a16ef7 Mon Sep 17 00:00:00 2001 From: "Leandro A. F. Pereira" Date: Mon, 30 Jun 2008 17:35:58 -0300 Subject: Make "Resources" information a little more meaningful. If the resource is claimed by a kernel module, use its description. If the resource is reserved by a PCI device, use its name. --- hardinfo2/arch/linux/common/modules.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'hardinfo2/arch/linux/common/modules.h') diff --git a/hardinfo2/arch/linux/common/modules.h b/hardinfo2/arch/linux/common/modules.h index 46f73d2f..32c9c0d6 100644 --- a/hardinfo2/arch/linux/common/modules.h +++ b/hardinfo2/arch/linux/common/modules.h @@ -29,12 +29,18 @@ remove_module_devices(gpointer key, gpointer value, gpointer data) return g_str_has_prefix(key, "MOD"); } +static GHashTable *_module_hash_table = NULL; + static void scan_modules_do(void) { FILE *lsmod; gchar buffer[1024]; + if (!_module_hash_table) { + _module_hash_table = g_hash_table_new(g_str_hash, g_str_equal); + } + if (module_list) { g_free(module_list); } @@ -95,7 +101,15 @@ scan_modules_do(void) if (description && g_str_equal(description, "<none>")) { g_free(description); description = g_strdup(""); - } + + g_hash_table_insert(_module_hash_table, + g_strdup(modname), + g_strdup_printf("Kernel module (%s)", modname)); + } else { + g_hash_table_insert(_module_hash_table, + g_strdup(modname), + g_strdup(description)); + } /* append this module to the list of modules */ module_list = h_strdup_cprintf("$%s$%s=%s\n", -- cgit v1.2.3