aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hardinfo/gpu_util.c19
-rw-r--r--includes/gpu_util.h3
-rw-r--r--modules/devices/gpu.c16
3 files changed, 28 insertions, 10 deletions
diff --git a/hardinfo/gpu_util.c b/hardinfo/gpu_util.c
index 2c89be72..4347aad6 100644
--- a/hardinfo/gpu_util.c
+++ b/hardinfo/gpu_util.c
@@ -21,6 +21,9 @@
#include "hardinfo.h"
#include "gpu_util.h"
+#include "cpu_util.h" /* for EMPIFNULL() */
+
+
nvgpu *nvgpu_new() {
return g_new0(nvgpu, 1);
}
@@ -255,7 +258,8 @@ gpud *dt_soc_gpu() {
{ "arm,mali", "ARM", "Mali family" },
{ NULL, NULL }
};
- char *dt_gpu_path = NULL, *compat_path = NULL;
+ char tmp_path[256] = "";
+ char *dt_gpu_path = NULL;
char *compat = NULL;
char *vendor = NULL, *device = NULL;
int i;
@@ -271,8 +275,8 @@ gpud *dt_soc_gpu() {
if (dt_gpu_path == NULL)
goto dt_gpu_end;
- compat_path = g_strdup_printf("%s/compatible", dt_gpu_path);
- compat = dtr_get_string(compat_path, 1);
+ snprintf(tmp_path, 255, "%s/compatible", dt_gpu_path);
+ compat = dtr_get_string(tmp_path, 1);
if (compat == NULL)
goto dt_gpu_end;
@@ -292,6 +296,13 @@ gpud *dt_soc_gpu() {
gpu->dt_compat = compat;
gpu->dt_vendor = vendor;
gpu->dt_device = device;
+ gpu->dt_path = dt_gpu_path;
+ snprintf(tmp_path, 255, "%s/status", dt_gpu_path);
+ gpu->dt_status = dtr_get_string(tmp_path, 1);
+ snprintf(tmp_path, 255, "%s/name", dt_gpu_path);
+ gpu->dt_name = dtr_get_string(tmp_path, 1);
+ EMPIFNULL(gpu->dt_name);
+ EMPIFNULL(gpu->dt_status);
gpu->id = strdup("dt-soc-gpu");
gpu->location = strdup("SOC");
@@ -304,8 +315,6 @@ gpud *dt_soc_gpu() {
dt_gpu_end:
- free(dt_gpu_path);
- free(compat_path);
dtr_free(dt);
return gpu;
}
diff --git a/includes/gpu_util.h b/includes/gpu_util.h
index be69e941..0523cc81 100644
--- a/includes/gpu_util.h
+++ b/includes/gpu_util.h
@@ -39,7 +39,8 @@ typedef struct gpud {
char *drm_dev;
char *sysfs_drm_path;
pcid *pci_dev;
- char *dt_compat;
+
+ char *dt_compat, *dt_status, *dt_name, *dt_path;
const char *dt_vendor, *dt_device;
nvgpu *nv_info;
diff --git a/modules/devices/gpu.c b/modules/devices/gpu.c
index 05fbac7e..429b0b0f 100644
--- a/modules/devices/gpu.c
+++ b/modules/devices/gpu.c
@@ -177,14 +177,22 @@ int _dt_soc_gpu(gpud *gpu) {
gpu_list = h_strdup_cprintf("$%s$%s=%s\n", gpu_list, key, key, name);
gchar *str = g_strdup_printf("[%s]\n"
/* Location */ "%s=%s\n"
- /* dt compat */ "%s=%s\n"
/* Vendor */ "%s=%s\n"
- /* Device */ "%s=%s\n",
+ /* Device */ "%s=%s\n"
+ "[%s]\n"
+ /* Path */ "%s=%s\n"
+ /* Compat */ "%s=%s\n"
+ /* Status */ "%s=%s\n"
+ /* Name */ "%s=%s\n",
_("Device Information"),
_("Location"), gpu->location,
- _("DT Compatibility"), gpu->dt_compat,
_("Vendor"), vendor,
- _("Device"), device
+ _("Device"), device,
+ _("Device Tree Node"),
+ _("Path"), gpu->dt_path,
+ _("Compatible"), gpu->dt_compat,
+ _("Status"), gpu->dt_status,
+ _("Name"), gpu->dt_name
);
moreinfo_add_with_prefix("DEV", key, str); /* str now owned by morinfo */
return 1;