take full path for the pci dev

This commit is contained in:
2026-10-01 20:49:45 +02:00
parent 252e146576
commit 1469485f3d
2 changed files with 3 additions and 3 deletions

View File

@@ -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';

View File

@@ -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));