X-Git-Url: https://git.wpitchoune.net/gitweb/?p=psensor.git;a=blobdiff_plain;f=src%2Flib%2Fnvidia.c;h=685f97da9311b1e50a082400e9bf1be22a1c2592;hp=d3bbb582c691cd0f9fb9de129fbc42b2272404ec;hb=c1e20f2631a1249720e9c75d753eacfcb0f6c7b9;hpb=850c80cb3c81b5bd24245ebf98165a98e47baa71 diff --git a/src/lib/nvidia.c b/src/lib/nvidia.c index d3bbb58..685f97d 100644 --- a/src/lib/nvidia.c +++ b/src/lib/nvidia.c @@ -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;