X-Git-Url: https://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fnvidia.c;h=1e9ea4fa9d14512f2ef45a1ec8dbc7a4e578fda9;hb=2b51051578ef29b031d0927388c4d62baa3c525e;hp=54ad7247cbdf2029460d777553a0b5d8810a93dd;hpb=cd4ee07fe75a48ab1087918f031ee58f8141826d;p=psensor.git diff --git a/src/lib/nvidia.c b/src/lib/nvidia.c index 54ad724..1e9ea4f 100644 --- a/src/lib/nvidia.c +++ b/src/lib/nvidia.c @@ -1,22 +1,21 @@ /* - Copyright (C) 2010-2011 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 published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA -*/ - + * Copyright (C) 2010-2012 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 + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ #include #include #define _(str) gettext(str) @@ -68,20 +67,13 @@ static struct psensor *create_sensor(int id, int values_len) sprintf(sid, "nvidia %s", name); s = psensor_create(sid, strdup(name), - SENSOR_TYPE_NVIDIA, values_len); + SENSOR_TYPE_NVIDIA_TEMP, values_len); s->nvidia_id = id; return s; } -static void close_display() -{ - XCloseDisplay(display); - display = NULL; - -} - /* Opens connection to X server and returns the number of NVidia GPUs. @@ -117,15 +109,15 @@ void nvidia_psensor_list_update(struct psensor **sensors) while (*ss) { s = *ss; - if (s->type == SENSOR_TYPE_NVIDIA) + if (s->type == SENSOR_TYPE_NVIDIA_TEMP) psensor_set_current_value(s, get_temp(s)); ss++; } } -struct psensor * * -nvidia_psensor_list_add(struct psensor **sensors, int values_len) +struct psensor **nvidia_psensor_list_add(struct psensor **sensors, + int values_len) { int i, n; struct psensor **tmp, **ss, *s; @@ -149,6 +141,8 @@ nvidia_psensor_list_add(struct psensor **sensors, int values_len) void nvidia_cleanup() { - if (display) - close_display(); + if (display) { + XCloseDisplay(display); + display = NULL; + } }