/*
- 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 <locale.h>
#include <libintl.h>
#define _(str) gettext(str)
err = sensors_get_value(name, sub->number, &val);
if (err) {
- fprintf(stderr,
- _("ERROR: Can't get value of subfeature %s: %s\n"),
+ log_err(_("lmsensor: cannot get value of subfeature %s: %s."),
sub->name, sensors_strerror(err));
val = UNKNOWN_DBL_VALUE;
}
{
char name[200];
const sensors_subfeature *sf;
- char *label;
int type;
- char *id;
+ char *id, *label, *cname;
struct psensor *psensor;
sensors_subfeature_type fault_subfeature;
fault_subfeature = SENSORS_SUBFEATURE_FAN_FAULT;
} else {
- fprintf(stderr,
- _("ERROR: create_sensor, wrong feature type\n"));
+ log_err(_(
+"lmsensor: lmsensor_psensor_create failure: wrong feature type."));
return NULL;
}
1);
sprintf(id, "lmsensor %s %s", name, label);
- psensor = psensor_create(id, label, type, values_max_length);
+ if (!strcmp(chip->prefix, "coretemp"))
+ cname = strdup("Intel CPU");
+ else if (!strcmp(chip->prefix, "k10temp"))
+ cname = strdup("AMD CPU");
+ else if (!strcmp(chip->prefix, "nouveau"))
+ cname = strdup("Nvidia GPU");
+ else
+ cname = strdup(chip->prefix);
+
+ psensor = psensor_create(id, label, cname, type, values_max_length);
psensor->iname = chip;
psensor->feature = feature;
int i;
if (!init_done)
- return ;
+ return NULL;
result = sensors;
while ((chip = sensors_get_detected_chips(NULL, &chip_nr))) {
int err = sensors_init(NULL);
if (err) {
- fprintf(stderr,
- _("ERROR: lm-sensors initialization failure: %s\n"),
+ log_err(_("lmsensor: initialization failure: %s."),
sensors_strerror(err));
init_done = 0;
} else {