Fixed restoration of the panel divider position.
[psensor.git] / src / lib / nvidia.c
index d3bbb58..685f97d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2014 jeanfi@gmail.com
+ * Copyright (C) 2010-2016 jeanfi@gmail.com
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -256,7 +256,8 @@ static char *i2str(int i)
        size_t n;
 
        /* second +1 to avoid issue about the conversion of a double
-        * to a lower int */
+        * to a lower int
+        */
        n = 1 + (ceil(log10(INT_MAX)) + 1) + 1;
 
        str = malloc(n);
@@ -272,6 +273,7 @@ static struct psensor *create_nvidia_sensor(int id, int subtype, int value_len)
        int type;
        size_t n;
        struct psensor *s;
+       double v;
 
        type = SENSOR_TYPE_NVCTRL | subtype;
 
@@ -293,6 +295,13 @@ static struct psensor *create_nvidia_sensor(int id, int subtype, int value_len)
        s->provider_data = malloc(sizeof(int));
        set_nvidia_id(s, id);
 
+       if ((type & SENSOR_TYPE_GPU) && (type & SENSOR_TYPE_TEMP)) {
+               v = get_att(NV_CTRL_TARGET_TYPE_GPU,
+                           id,
+                           NV_CTRL_GPU_CORE_THRESHOLD);
+               s->max = v;
+       }
+
        free(strnid);
 
        return s;