aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hardinfo2/arch/linux/common/modules.h22
-rw-r--r--hardinfo2/devices.c5
2 files changed, 25 insertions, 2 deletions
diff --git a/hardinfo2/arch/linux/common/modules.h b/hardinfo2/arch/linux/common/modules.h
index 9c335f18..ce012b70 100644
--- a/hardinfo2/arch/linux/common/modules.h
+++ b/hardinfo2/arch/linux/common/modules.h
@@ -16,12 +16,32 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+static gboolean
+remove_module_devices(gpointer key, gpointer value, gpointer data)
+{
+ if (!strncmp((gchar *) key, "MOD", 3)) {
+ g_free((gchar *) key);
+ g_free((GtkTreeIter *) value);
+ return TRUE;
+ }
+ return FALSE;
+}
+
void
scan_modules(void)
{
FILE *lsmod;
gchar buffer[1024];
+ shell_status_update("Getting loaded modules information...");
+
+ if (module_list) {
+ g_free(module_list);
+ module_list = NULL;
+ }
+
+ g_hash_table_foreach_remove(devices, remove_module_devices, NULL);
+
lsmod = popen("/sbin/lsmod", "r");
if (!lsmod)
return;
@@ -79,7 +99,7 @@ scan_modules(void)
/* append this module to the list of modules */
module_list = g_strdup_printf("%s$%s$%s=%s\n",
- module_list,
+ module_list ? module_list : "",
hashkey,
modname,
description ? description : "");
diff --git a/hardinfo2/devices.c b/hardinfo2/devices.c
index c43104d4..6dc989b2 100644
--- a/hardinfo2/devices.c
+++ b/hardinfo2/devices.c
@@ -45,7 +45,7 @@ static ModuleEntry hi_entries[] = {
};
static GHashTable *devices = NULL;
-static gchar *module_list = "";
+static gchar *module_list = NULL;
static gchar *printer_list = NULL;
static gchar *pci_list = "";
static gchar *input_list = NULL;
@@ -115,6 +115,9 @@ void
hi_reload(gint entry)
{
switch (entry) {
+ case DEVICES_KERNEL_MODULES:
+ scan_modules();
+ break;
case DEVICES_BATTERY:
scan_battery();
break;