From 1469485f3de8c2151718e552912090c9b73249fc Mon Sep 17 00:00:00 2001 From: Drath Date: Thu, 1 Oct 2026 20:49:45 +0200 Subject: [PATCH] take full path for the pci dev --- src/cpu.c | 2 +- src/gpu.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cpu.c b/src/cpu.c index e86a6ea..2b7a861 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -15,7 +15,7 @@ void cpu_detect(struct cpu_sensors_t *t, const char *pci_dev) { t->module = unknown; t->num_cores = (uint8_t)sysconf(_SC_NPROCESSORS_ONLN); - snprintf(t->hwmon, sizeof(t->hwmon), "/sys/bus/pci/devices/%s/hwmon", pci_dev); + snprintf(t->hwmon, sizeof(t->hwmon), "%s/hwmon", pci_dev); const int ret = get_hwmon_dir(t->hwmon, sizeof(t->hwmon)); if (ret != 0) { t->hwmon[0] = '\0'; diff --git a/src/gpu.c b/src/gpu.c index 1710319..83fc231 100644 --- a/src/gpu.c +++ b/src/gpu.c @@ -18,7 +18,7 @@ static sensor_file_t* sensors; static int gpu_metrics_fd; void gpu_detect(struct gpu_sensors_t *t, const char *pci) { - snprintf(t->hwmon, sizeof(t->hwmon), "/sys/bus/pci/devices/%s/hwmon", pci); + snprintf(t->hwmon, sizeof(t->hwmon), "%s/hwmon", pci); const int ret = get_hwmon_dir(t->hwmon, sizeof(t->hwmon)); if (ret != 0) { t->hwmon[0] = '\0'; @@ -36,7 +36,7 @@ void gpu_detect(struct gpu_sensors_t *t, const char *pci) { char raw_metrics[max_metrics_length]; read(gpu_metrics_fd, raw_metrics, sizeof(raw_metrics)); const struct metrics_table_header *header = (struct metrics_table_header *)raw_metrics; - applog(LOG_INF, "Found gpu_metrics_v%d_%d", header->format_revision, header->content_revision); + applog(LOG_INF, "Found gpu_metrics_v%d_%d at %s", header->format_revision, header->content_revision, p); } sensors = malloc(sizeof(sensor_file_t) * (t->has_gpu_metrics ? 10 : 5));