summaryrefslogtreecommitdiff
path: root/hardinfo
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2018-09-09 14:53:21 -0500
committerLeandro A. F. Pereira <leandro@hardinfo.org>2018-09-26 20:51:53 -0700
commitda50fabd1897462531153a5a27366eb0ad7d0413 (patch)
tree7e4a42939f1e5958742555619cec3e4bd3ba1046 /hardinfo
parent62964b789d933e68e4024e165b20288471a0029c (diff)
gpu: show more dt info
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'hardinfo')
-rw-r--r--hardinfo/gpu_util.c19
1 files changed, 14 insertions, 5 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;
}