X-Git-Url: http://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fnvidia.c;h=4f411e98f1794ff0922c4510c3b555601eb85642;hb=7ac0c530e67161923db3c91252331148f713144f;hp=cface2fb4bfdb2ca616c66bb44f52236bea8b449;hpb=a4ec839965ede8ff81b2dcca679f7e129ee6765d;p=psensor.git diff --git a/src/lib/nvidia.c b/src/lib/nvidia.c index cface2f..4f411e9 100644 --- a/src/lib/nvidia.c +++ b/src/lib/nvidia.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2012 jeanfi@gmail.com + * Copyright (C) 2010-2014 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 @@ -33,9 +33,7 @@ Display *display; -/* - Returns the temperature (Celcius) of a NVidia GPU. -*/ +/* Returns the temperature (Celsius) of a NVIDIA GPU. */ static int get_temp(struct psensor *sensor) { int temp; @@ -51,7 +49,8 @@ static int get_temp(struct psensor *sensor) if (res == True) return temp; - log_err(_("Failed to retrieve NVIDIA temperature.")); + log_debug(_("NVIDIA proprietary driver not used or cannot " + "retrieve NVIDIA GPU temperature.")); return 0; } @@ -60,15 +59,19 @@ static struct psensor *create_sensor(int id, int values_len) char name[200]; char *sid; struct psensor *s; + int t; sprintf(name, "GPU%d", id); - sid = malloc(strlen("nvidia") + 1 + strlen(name) + 1); - sprintf(sid, "nvidia %s", name); + sid = malloc(strlen("NVIDIA") + 1 + strlen(name) + 1); + sprintf(sid, "NVIDIA %s", name); + + t = SENSOR_TYPE_NVCTRL | SENSOR_TYPE_GPU | SENSOR_TYPE_TEMP; s = psensor_create(sid, strdup(name), - SENSOR_TYPE_NVIDIA_TEMP, + strdup(_("NVIDIA GPU")), + t, values_len); s->nvidia_id = id; @@ -78,9 +81,9 @@ static struct psensor *create_sensor(int id, int values_len) /* Opens connection to X server and returns the number - of NVidia GPUs. + of NVIDIA GPUs. - Return 0 if no NVidia gpus or cannot get information. + Return 0 if no NVIDIA gpus or cannot get information. */ static int init() { @@ -110,7 +113,7 @@ void nvidia_psensor_list_update(struct psensor **sensors) while (*ss) { s = *ss; - if (s->type == SENSOR_TYPE_NVIDIA_TEMP) + if (s->type & SENSOR_TYPE_NVCTRL) psensor_set_current_value(s, get_temp(s)); ss++;