X-Git-Url: https://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fnvidia.c;h=baef0b55eb57d6a89f10d150491903c9e272da71;hb=cc35e177d57bc4ee2cc57ae25f130dfc168aa61d;hp=e2e06027c922ecbabe8fbf4a3fc04c514988b138;hpb=45c8086f97097df36ba8cd0552f152be80f79b12;p=psensor.git diff --git a/src/lib/nvidia.c b/src/lib/nvidia.c index e2e0602..baef0b5 100644 --- a/src/lib/nvidia.c +++ b/src/lib/nvidia.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2011 jeanfi@gmail.com + * Copyright (C) 2010-2013 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 @@ -51,7 +51,7 @@ static int get_temp(struct psensor *sensor) if (res == True) return temp; - fprintf(stderr, _("ERROR: failed to retrieve nvidia temperature\n")); + log_err(_("Failed to retrieve NVIDIA temperature.")); return 0; } @@ -60,14 +60,20 @@ 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); - s = psensor_create(sid, strdup(name), - SENSOR_TYPE_NVIDIA_TEMP, values_len); + t = SENSOR_TYPE_NVCTRL | SENSOR_TYPE_GPU | SENSOR_TYPE_TEMP; + + s = psensor_create(sid, + strdup(name), + strdup("Nvidia GPU"), + t, + values_len); s->nvidia_id = id; @@ -87,8 +93,7 @@ static int init() 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; } @@ -96,7 +101,7 @@ static int init() 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; } @@ -109,7 +114,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++;