+ return get_value(id, type) != UNKNOWN_DBL_VALUE;
+}
+
+static char *i2str(int i)
+{
+ char *str;
+ size_t n;
+
+ /* second +1 to avoid issue about the conversion of a double
+ * to a lower int */
+ n = 1 + (ceil(log10(INT_MAX)) + 1) + 1;
+
+ str = malloc(n);
+ snprintf(str, n, "%d", i);
+
+ return str;
+}
+
+static struct psensor *create_nvidia_sensor(int id, int subtype, int value_len)
+{
+ char *pname, *name, *strnid, *sid;
+ const char *stype;
+ int type;
+ size_t n;
+ struct psensor *s;
+
+ type = SENSOR_TYPE_NVCTRL | subtype;
+
+ if (!check_sensor(id, type))
+ return NULL;
+
+ pname = get_product_name(id, type);
+ strnid = i2str(id);
+ stype = get_nvidia_type_str(type);
+
+ n = strlen(pname) + 1 + strlen(strnid) + 1 + strlen(stype) + 1;
+ name = malloc(n);
+ sprintf(name, "%s %s %s", pname, strnid, stype);
+
+ sid = malloc(strlen(PROVIDER_NAME) + 1 + strlen(name) + 1);
+ sprintf(sid, "%s %s", PROVIDER_NAME, name);
+
+ s = psensor_create(sid, name, pname, type, value_len);
+ s->nvidia_id = id;
+
+ free(strnid);
+
+ return s;
+}
+
+static int init(void)
+{
+ int evt, err;