projects
/
psensor-pkg-debian.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 1.0.2
[psensor-pkg-debian.git]
/
src
/
lib
/
nvidia.c
diff --git
a/src/lib/nvidia.c
b/src/lib/nvidia.c
index
1e9ea4f
..
4f411e9
100644
(file)
--- a/
src/lib/nvidia.c
+++ b/
src/lib/nvidia.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (C) 2010-201
2
jeanfi@gmail.com
+ * Copyright (C) 2010-201
4
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
*
* 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;
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;
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;
if (res == True)
return temp;
- fprintf(stderr, _("ERROR: failed to retrieve nvidia temperature\n"));
+ log_debug(_("NVIDIA proprietary driver not used or cannot "
+ "retrieve NVIDIA GPU temperature."));
return 0;
}
return 0;
}
@@
-60,14
+59,20
@@
static struct psensor *create_sensor(int id, int values_len)
char name[200];
char *sid;
struct psensor *s;
char name[200];
char *sid;
struct psensor *s;
+ int t;
sprintf(name, "GPU%d", id);
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, values_len);
+ s = psensor_create(sid,
+ strdup(name),
+ strdup(_("NVIDIA GPU")),
+ t,
+ values_len);
s->nvidia_id = id;
s->nvidia_id = id;
@@
-76,9
+81,9
@@
static struct psensor *create_sensor(int id, int values_len)
/*
Opens connection to X server and returns the number
/*
Opens connection to X server and returns the number
- of NV
idia
GPUs.
+ of NV
IDIA
GPUs.
- Return 0 if no NV
idia
gpus or cannot get information.
+ Return 0 if no NV
IDIA
gpus or cannot get information.
*/
static int init()
{
*/
static int init()
{
@@
-87,8
+92,7
@@
static int init()
display = XOpenDisplay(NULL);
if (!display) {
display = XOpenDisplay(NULL);
if (!display) {
- fprintf(stderr,
- _("ERROR: Cannot open connection to X Server\n"));
+ log_err(_("Cannot open connection to X11 server."));
return 0;
}
return 0;
}
@@
-96,7
+100,7
@@
static int init()
XNVCTRLQueryTargetCount(display, NV_CTRL_TARGET_TYPE_GPU, &n))
return n;
XNVCTRLQueryTargetCount(display, NV_CTRL_TARGET_TYPE_GPU, &n))
return n;
-
fprintf(stderr, _("ERROR: Cannot retrieve NVidia information\n
"));
+
log_err(_("Failed to retrieve NVIDIA information.
"));
return 0;
}
return 0;
}
@@
-109,7
+113,7
@@
void nvidia_psensor_list_update(struct psensor **sensors)
while (*ss) {
s = *ss;
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++;
psensor_set_current_value(s, get_temp(s));
ss++;