Display *display;
-static char *get_product_name(int id)
+static char *get_product_name(int id, int type)
{
char *name;
Bool res;
+ if (type & SENSOR_TYPE_FAN)
+ return strdup("NVIDIA");
+
res = XNVCTRLQueryTargetStringAttribute(display,
NV_CTRL_TARGET_TYPE_GPU,
id,
return "ambient";
else if (type & SENSOR_TYPE_TEMP)
return "temp";
+ else if (type & SENSOR_TYPE_FAN)
+ return "fan";
else
return "unknown";
}
att = NV_CTRL_GPU_CORE_TEMPERATURE;
return get_att(NV_CTRL_TARGET_TYPE_GPU, id, att);
+ } else if (type & SENSOR_TYPE_FAN) {
+ return get_att(NV_CTRL_TARGET_TYPE_COOLER,
+ id,
+ NV_CTRL_THERMAL_COOLER_SPEED);
} else { /* SENSOR_TYPE_USAGE */
return get_usage(id, type);
}
if (!check_sensor(id, type))
return NULL;
- pname = get_product_name(id);
+ pname = get_product_name(id, type);
strnid = i2str(id);
stype = get_nvidia_type_str(type);
else
log_err("NVIDIA: fail to retrieve fan speed %d",
i);
+
+ add(&ss, i, SENSOR_TYPE_FAN, values_len);
}
} else {
log_err(_("Failed to retrieve number of NVIDIA fans."));