1998-12-23 00:25:53 +00:00
|
|
|
/*
|
|
|
|
chips.c - Part of sensors, a user-space program for hardware monitoring
|
2006-09-27 12:09:04 +00:00
|
|
|
Copyright (c) 1998-2003 Frodo Looijaard <frodol@dds.nl>
|
|
|
|
and Mark D. Studebaker <mdsxyz123@yahoo.com>
|
|
|
|
Copyright (c) 2003-2006 The lm_sensors team
|
1998-12-23 00:25:53 +00:00
|
|
|
|
|
|
|
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2002-06-30 20:28:08 +00:00
|
|
|
#include <string.h>
|
1998-12-23 00:25:53 +00:00
|
|
|
|
2007-08-26 13:24:46 +00:00
|
|
|
#include "main.h"
|
1998-12-23 00:25:53 +00:00
|
|
|
#include "chips.h"
|
|
|
|
#include "lib/sensors.h"
|
2007-09-19 16:53:16 +00:00
|
|
|
#include "lib/error.h"
|
1998-12-23 00:25:53 +00:00
|
|
|
|
2007-08-23 07:45:58 +00:00
|
|
|
void print_chip_raw(const sensors_chip_name *name)
|
1999-05-01 15:03:14 +00:00
|
|
|
{
|
2007-09-23 12:00:59 +00:00
|
|
|
int a, b;
|
2007-09-23 12:05:16 +00:00
|
|
|
const sensors_feature *feature;
|
|
|
|
const sensors_subfeature *sub;
|
2007-08-26 10:57:16 +00:00
|
|
|
char *label;
|
|
|
|
double val;
|
1999-05-01 15:03:14 +00:00
|
|
|
|
2007-08-26 10:57:16 +00:00
|
|
|
a = 0;
|
2007-09-23 12:00:59 +00:00
|
|
|
while ((feature = sensors_get_features(name, &a))) {
|
2007-09-23 12:05:16 +00:00
|
|
|
if (!(label = sensors_get_label(name, feature))) {
|
|
|
|
printf("ERROR: Can't get feature label!\n");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
printf("%s:\n", label);
|
|
|
|
free(label);
|
|
|
|
|
2007-09-23 12:00:59 +00:00
|
|
|
b = 0;
|
2007-09-23 12:05:16 +00:00
|
|
|
while ((sub = sensors_get_all_subfeatures(name, feature, &b))) {
|
2007-09-23 12:00:59 +00:00
|
|
|
if (sub->flags & SENSORS_MODE_R) {
|
|
|
|
if (sensors_get_value(name, sub->number, &val))
|
|
|
|
printf("ERROR: Can't get feature `%s' "
|
|
|
|
"data!\n", sub->name);
|
|
|
|
else
|
2007-09-23 12:05:16 +00:00
|
|
|
printf(" %s: %.2f\n", sub->name, val);
|
2007-09-23 12:00:59 +00:00
|
|
|
} else
|
|
|
|
printf("(%s)\n", label);
|
2007-08-26 10:57:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-08-26 12:19:07 +00:00
|
|
|
|
2007-08-26 20:55:36 +00:00
|
|
|
static inline double deg_ctof(double cel)
|
|
|
|
{
|
|
|
|
return cel * (9.0F / 5.0F) + 32.0F;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void print_label(const char *label, int space)
|
|
|
|
{
|
|
|
|
int len = strlen(label)+1;
|
|
|
|
printf("%s:%*s", label, space - len, "");
|
|
|
|
}
|
|
|
|
|
2007-09-23 12:30:28 +00:00
|
|
|
static double get_value(const sensors_chip_name *name, int subfeat_nr)
|
2007-08-26 12:19:07 +00:00
|
|
|
{
|
2007-09-23 12:30:28 +00:00
|
|
|
double val;
|
|
|
|
int err;
|
2007-08-26 12:19:07 +00:00
|
|
|
|
2007-09-23 12:30:28 +00:00
|
|
|
err = sensors_get_value(name, subfeat_nr, &val);
|
|
|
|
if (err) {
|
|
|
|
printf("ERROR: Can't get value of subfeature %d: %s\n",
|
|
|
|
subfeat_nr, sensors_strerror(err));
|
|
|
|
val = 0;
|
2007-08-26 12:19:07 +00:00
|
|
|
}
|
2007-09-23 12:30:28 +00:00
|
|
|
return val;
|
2007-08-26 12:19:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int sensors_get_label_size(const sensors_chip_name *name)
|
|
|
|
{
|
|
|
|
int i;
|
2007-09-23 12:05:16 +00:00
|
|
|
const sensors_feature *iter;
|
2007-08-26 12:19:07 +00:00
|
|
|
char *label;
|
|
|
|
unsigned int max_size = 11; /* 11 as minumum label width */
|
|
|
|
|
|
|
|
i = 0;
|
2007-09-23 12:00:59 +00:00
|
|
|
while ((iter = sensors_get_features(name, &i))) {
|
2007-09-23 12:05:16 +00:00
|
|
|
if ((label = sensors_get_label(name, iter)) &&
|
2007-08-26 12:19:07 +00:00
|
|
|
strlen(label) > max_size)
|
|
|
|
max_size = strlen(label);
|
|
|
|
free(label);
|
|
|
|
}
|
|
|
|
return max_size + 1;
|
|
|
|
}
|
|
|
|
|
2007-08-26 20:41:03 +00:00
|
|
|
static void print_temp_limits(double limit1, double limit2,
|
2007-08-26 20:37:15 +00:00
|
|
|
const char *name1, const char *name2, int alarm)
|
|
|
|
{
|
|
|
|
if (fahrenheit) {
|
|
|
|
limit1 = deg_ctof(limit1);
|
|
|
|
limit2 = deg_ctof(limit2);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (name2) {
|
|
|
|
printf("(%-4s = %+5.1f%s, %-4s = %+5.1f%s) ",
|
|
|
|
name1, limit1, degstr,
|
|
|
|
name2, limit2, degstr);
|
|
|
|
} else if (name1) {
|
|
|
|
printf("(%-4s = %+5.1f%s) ",
|
|
|
|
name1, limit1, degstr);
|
|
|
|
} else {
|
|
|
|
printf(" ");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (alarm)
|
|
|
|
printf("ALARM ");
|
|
|
|
}
|
|
|
|
|
2007-08-26 21:26:20 +00:00
|
|
|
static void print_chip_temp(const sensors_chip_name *name,
|
2007-09-23 12:05:16 +00:00
|
|
|
const sensors_feature *feature,
|
2007-08-26 21:26:20 +00:00
|
|
|
int label_size)
|
2007-08-26 12:19:07 +00:00
|
|
|
{
|
2007-09-23 12:30:28 +00:00
|
|
|
const sensors_subfeature *sf, *sfmin, *sfmax, *sfcrit, *sfhyst;
|
2007-08-26 20:37:15 +00:00
|
|
|
double val, limit1, limit2;
|
|
|
|
const char *s1, *s2;
|
|
|
|
int alarm, crit_displayed = 0;
|
2007-08-26 12:19:07 +00:00
|
|
|
char *label;
|
|
|
|
|
2007-09-23 12:05:16 +00:00
|
|
|
if (!(label = sensors_get_label(name, feature))) {
|
2007-08-26 12:19:07 +00:00
|
|
|
printf("ERROR: Can't get temperature label!\n");
|
|
|
|
return;
|
|
|
|
}
|
2007-09-23 12:30:28 +00:00
|
|
|
print_label(label, label_size);
|
|
|
|
free(label);
|
2007-08-26 12:19:07 +00:00
|
|
|
|
2007-09-23 12:30:28 +00:00
|
|
|
sf = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_TEMP_INPUT);
|
|
|
|
val = sf ? get_value(name, sf->number) : 0;
|
|
|
|
|
|
|
|
sf = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_TEMP_ALARM);
|
|
|
|
alarm = sf && get_value(name, sf->number);
|
|
|
|
|
|
|
|
sfmin = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_TEMP_MIN);
|
|
|
|
sfmax = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_TEMP_MAX);
|
|
|
|
sfcrit = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_TEMP_CRIT);
|
|
|
|
if (sfmax) {
|
|
|
|
sf = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_TEMP_MAX_ALARM);
|
|
|
|
if (sf && get_value(name, sf->number))
|
2007-08-26 20:37:15 +00:00
|
|
|
alarm |= 1;
|
|
|
|
|
2007-09-23 12:30:28 +00:00
|
|
|
if (sfmin) {
|
|
|
|
limit1 = get_value(name, sfmin->number);
|
2007-08-26 20:37:15 +00:00
|
|
|
s1 = "low";
|
2007-09-23 12:30:28 +00:00
|
|
|
limit2 = get_value(name, sfmax->number);
|
2007-08-26 20:37:15 +00:00
|
|
|
s2 = "high";
|
|
|
|
|
2007-09-23 12:30:28 +00:00
|
|
|
sf = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_TEMP_MIN_ALARM);
|
|
|
|
if (sf && get_value(name, sf->number))
|
2007-08-26 20:37:15 +00:00
|
|
|
alarm |= 1;
|
2007-08-26 12:19:07 +00:00
|
|
|
} else {
|
2007-09-23 12:30:28 +00:00
|
|
|
limit1 = get_value(name, sfmax->number);
|
2007-08-26 20:37:15 +00:00
|
|
|
s1 = "high";
|
|
|
|
|
2007-09-23 12:30:28 +00:00
|
|
|
sfhyst = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_TEMP_MAX_HYST);
|
|
|
|
if (sfhyst) {
|
|
|
|
limit2 = get_value(name, sfhyst->number);
|
2007-08-26 20:37:15 +00:00
|
|
|
s2 = "hyst";
|
2007-09-23 12:30:28 +00:00
|
|
|
} else if (sfcrit) {
|
|
|
|
limit2 = get_value(name, sfcrit->number);
|
2007-08-26 20:37:15 +00:00
|
|
|
s2 = "crit";
|
|
|
|
|
2007-09-23 12:30:28 +00:00
|
|
|
sf = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_TEMP_CRIT_ALARM);
|
|
|
|
if (sf && get_value(name, sf->number))
|
2007-08-26 20:37:15 +00:00
|
|
|
alarm |= 1;
|
|
|
|
crit_displayed = 1;
|
|
|
|
} else {
|
|
|
|
limit2 = 0;
|
|
|
|
s2 = NULL;
|
|
|
|
}
|
2007-08-26 12:19:07 +00:00
|
|
|
}
|
2007-09-23 12:30:28 +00:00
|
|
|
} else if (sfcrit) {
|
|
|
|
limit1 = get_value(name, sfcrit->number);
|
2007-09-08 10:47:03 +00:00
|
|
|
s1 = "crit";
|
|
|
|
|
2007-09-23 12:30:28 +00:00
|
|
|
sfhyst = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_TEMP_CRIT_HYST);
|
|
|
|
if (sfhyst) {
|
|
|
|
limit2 = get_value(name, sfhyst->number);
|
2007-09-08 10:47:03 +00:00
|
|
|
s2 = "hyst";
|
|
|
|
} else {
|
|
|
|
limit2 = 0;
|
|
|
|
s2 = NULL;
|
|
|
|
}
|
|
|
|
|
2007-09-23 12:30:28 +00:00
|
|
|
sf = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_TEMP_CRIT_ALARM);
|
|
|
|
if (sf && get_value(name, sf->number))
|
2007-09-08 10:47:03 +00:00
|
|
|
alarm |= 1;
|
|
|
|
crit_displayed = 1;
|
2007-08-26 12:19:07 +00:00
|
|
|
} else {
|
2007-08-26 20:37:15 +00:00
|
|
|
limit1 = limit2 = 0;
|
|
|
|
s1 = s2 = NULL;
|
2007-08-26 12:19:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-23 12:30:28 +00:00
|
|
|
sf = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_TEMP_FAULT);
|
|
|
|
if (sf && get_value(name, sf->number)) {
|
2007-08-26 20:36:46 +00:00
|
|
|
printf(" FAULT ");
|
|
|
|
} else {
|
|
|
|
if (fahrenheit)
|
|
|
|
val = deg_ctof(val);
|
|
|
|
printf("%+6.1f%s ", val, degstr);
|
|
|
|
}
|
2007-08-26 20:37:15 +00:00
|
|
|
print_temp_limits(limit1, limit2, s1, s2, alarm);
|
2007-08-26 12:19:07 +00:00
|
|
|
|
2007-09-23 12:30:28 +00:00
|
|
|
if (!crit_displayed && sfcrit) {
|
|
|
|
limit1 = get_value(name, sfcrit->number);
|
2007-08-26 20:37:15 +00:00
|
|
|
s1 = "crit";
|
2007-08-26 12:19:07 +00:00
|
|
|
|
2007-09-23 12:30:28 +00:00
|
|
|
sfhyst = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_TEMP_CRIT_HYST);
|
|
|
|
if (sfhyst) {
|
|
|
|
limit2 = get_value(name, sfhyst->number);
|
2007-08-26 20:37:15 +00:00
|
|
|
s2 = "hyst";
|
|
|
|
} else {
|
|
|
|
limit2 = 0;
|
|
|
|
s2 = NULL;
|
2007-08-26 12:19:07 +00:00
|
|
|
}
|
2007-08-26 20:37:15 +00:00
|
|
|
|
2007-09-23 12:30:28 +00:00
|
|
|
sf = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_TEMP_CRIT_ALARM);
|
|
|
|
if (sf && get_value(name, sf->number))
|
|
|
|
alarm |= 1;
|
2007-08-26 20:37:15 +00:00
|
|
|
|
|
|
|
printf("\n%*s", label_size + 10, "");
|
|
|
|
print_temp_limits(limit1, limit2, s1, s2, alarm);
|
2007-08-26 12:19:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* print out temperature sensor info */
|
2007-09-23 12:30:28 +00:00
|
|
|
sf = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_TEMP_TYPE);
|
|
|
|
if (sf) {
|
|
|
|
int sens = (int)get_value(name, sf->number);
|
2007-08-26 12:19:07 +00:00
|
|
|
|
|
|
|
/* older kernels / drivers sometimes report a beta value for
|
|
|
|
thermistors */
|
|
|
|
if (sens > 1000)
|
|
|
|
sens = 4;
|
|
|
|
|
|
|
|
printf("sensor = %s", sens == 0 ? "disabled" :
|
|
|
|
sens == 1 ? "diode" :
|
|
|
|
sens == 2 ? "transistor" :
|
|
|
|
sens == 3 ? "thermal diode" :
|
|
|
|
sens == 4 ? "thermistor" :
|
|
|
|
sens == 5 ? "AMD AMDSI" :
|
|
|
|
sens == 6 ? "Intel PECI" : "unknown");
|
|
|
|
}
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
|
2007-08-26 21:26:20 +00:00
|
|
|
static void print_chip_in(const sensors_chip_name *name,
|
2007-09-23 12:05:16 +00:00
|
|
|
const sensors_feature *feature,
|
2007-08-26 21:26:20 +00:00
|
|
|
int label_size)
|
2007-08-26 12:19:07 +00:00
|
|
|
{
|
2007-09-23 12:30:28 +00:00
|
|
|
const sensors_subfeature *sf, *sfmin, *sfmax;
|
2007-08-26 12:19:07 +00:00
|
|
|
double val, alarm_max, alarm_min;
|
|
|
|
char *label;
|
|
|
|
|
2007-09-23 12:05:16 +00:00
|
|
|
if (!(label = sensors_get_label(name, feature))) {
|
2007-08-26 12:19:07 +00:00
|
|
|
printf("ERROR: Can't get in label!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
print_label(label, label_size);
|
|
|
|
free(label);
|
2007-09-23 12:30:28 +00:00
|
|
|
|
|
|
|
sf = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_IN_INPUT);
|
|
|
|
val = sf ? get_value(name, sf->number) : 0;
|
2007-08-26 12:19:07 +00:00
|
|
|
printf("%+6.2f V", val);
|
|
|
|
|
2007-09-23 12:30:28 +00:00
|
|
|
sfmin = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_IN_MIN);
|
|
|
|
sfmax = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_IN_MAX);
|
|
|
|
if (sfmin && sfmax)
|
2007-08-26 12:19:07 +00:00
|
|
|
printf(" (min = %+6.2f V, max = %+6.2f V)",
|
2007-09-23 12:30:28 +00:00
|
|
|
get_value(name, sfmin->number),
|
|
|
|
get_value(name, sfmax->number));
|
|
|
|
else if (sfmin)
|
2007-08-26 12:19:07 +00:00
|
|
|
printf(" (min = %+6.2f V)",
|
2007-09-23 12:30:28 +00:00
|
|
|
get_value(name, sfmin->number));
|
|
|
|
else if (sfmax)
|
2007-08-26 12:19:07 +00:00
|
|
|
printf(" (max = %+6.2f V)",
|
2007-09-23 12:30:28 +00:00
|
|
|
get_value(name, sfmax->number));
|
|
|
|
|
|
|
|
sf = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_IN_ALARM);
|
|
|
|
sfmin = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_IN_MIN_ALARM);
|
|
|
|
sfmax = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_IN_MAX_ALARM);
|
|
|
|
if (sfmin || sfmax) {
|
|
|
|
alarm_max = sfmax ? get_value(name, sfmax->number) : 0;
|
|
|
|
alarm_min = sfmin ? get_value(name, sfmin->number) : 0;
|
2007-08-26 12:19:07 +00:00
|
|
|
|
|
|
|
if (alarm_min || alarm_max) {
|
|
|
|
printf(" ALARM (");
|
|
|
|
|
|
|
|
if (alarm_min)
|
|
|
|
printf("MIN");
|
|
|
|
if (alarm_max)
|
|
|
|
printf("%sMAX", (alarm_min) ? ", " : "");
|
|
|
|
|
|
|
|
printf(")");
|
|
|
|
}
|
2007-09-23 12:30:28 +00:00
|
|
|
} else if (sf) {
|
2007-08-26 12:19:07 +00:00
|
|
|
printf(" %s",
|
2007-09-23 12:30:28 +00:00
|
|
|
get_value(name, sf->number) ? "ALARM" : "");
|
2007-08-26 12:19:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
|
2007-08-26 21:26:20 +00:00
|
|
|
static void print_chip_fan(const sensors_chip_name *name,
|
2007-09-23 12:05:16 +00:00
|
|
|
const sensors_feature *feature,
|
2007-08-26 21:26:20 +00:00
|
|
|
int label_size)
|
2007-08-26 12:19:07 +00:00
|
|
|
{
|
2007-09-23 12:30:28 +00:00
|
|
|
const sensors_subfeature *sf, *sfmin, *sfdiv;
|
2007-08-26 12:19:07 +00:00
|
|
|
char *label;
|
|
|
|
double val;
|
|
|
|
|
2007-09-23 12:05:16 +00:00
|
|
|
if (!(label = sensors_get_label(name, feature))) {
|
2007-08-26 12:19:07 +00:00
|
|
|
printf("ERROR: Can't get fan label!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
print_label(label, label_size);
|
|
|
|
free(label);
|
|
|
|
|
2007-09-23 12:30:28 +00:00
|
|
|
sf = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_FAN_INPUT);
|
|
|
|
val = sf ? get_value(name, sf->number) : 0;
|
|
|
|
sf = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_FAN_FAULT);
|
|
|
|
if (sf && get_value(name, sf->number))
|
2007-08-26 12:19:07 +00:00
|
|
|
printf(" FAULT");
|
|
|
|
else
|
|
|
|
printf("%4.0f RPM", val);
|
|
|
|
|
2007-09-23 12:30:28 +00:00
|
|
|
sfmin = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_FAN_MIN);
|
|
|
|
sfdiv = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_FAN_DIV);
|
|
|
|
if (sfmin && sfdiv)
|
2007-08-26 12:19:07 +00:00
|
|
|
printf(" (min = %4.0f RPM, div = %1.0f)",
|
2007-09-23 12:30:28 +00:00
|
|
|
get_value(name, sfmin->number),
|
|
|
|
get_value(name, sfdiv->number));
|
|
|
|
else if (sfmin)
|
2007-08-26 12:19:07 +00:00
|
|
|
printf(" (min = %4.0f RPM)",
|
2007-09-23 12:30:28 +00:00
|
|
|
get_value(name, sfmin->number));
|
|
|
|
else if (sfdiv)
|
2007-08-26 12:19:07 +00:00
|
|
|
printf(" (div = %1.0f)",
|
2007-09-23 12:30:28 +00:00
|
|
|
get_value(name, sfdiv->number));
|
2007-08-26 12:19:07 +00:00
|
|
|
|
2007-09-23 12:30:28 +00:00
|
|
|
sf = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_FAN_ALARM);
|
|
|
|
if (sf && get_value(name, sf->number)) {
|
2007-08-26 12:19:07 +00:00
|
|
|
printf(" ALARM");
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
|
2007-09-23 12:05:16 +00:00
|
|
|
static void print_chip_vid(const sensors_chip_name *name,
|
|
|
|
const sensors_feature *feature,
|
2007-08-26 21:26:20 +00:00
|
|
|
int label_size)
|
|
|
|
{
|
|
|
|
char *label;
|
2007-09-23 12:05:16 +00:00
|
|
|
const sensors_subfeature *subfeature;
|
2007-08-26 21:26:20 +00:00
|
|
|
double vid;
|
2007-09-23 12:05:16 +00:00
|
|
|
|
2007-09-23 12:30:28 +00:00
|
|
|
subfeature = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_VID);
|
2007-09-23 12:05:16 +00:00
|
|
|
if (!subfeature)
|
|
|
|
return;
|
2007-08-26 21:26:20 +00:00
|
|
|
|
2007-09-23 12:05:16 +00:00
|
|
|
if ((label = sensors_get_label(name, feature))
|
|
|
|
&& !sensors_get_value(name, subfeature->number, &vid)) {
|
2007-08-26 21:26:20 +00:00
|
|
|
print_label(label, label_size);
|
|
|
|
printf("%+6.3f V\n", vid);
|
|
|
|
}
|
|
|
|
free(label);
|
|
|
|
}
|
|
|
|
|
2007-09-23 12:05:16 +00:00
|
|
|
static void print_chip_beep_enable(const sensors_chip_name *name,
|
|
|
|
const sensors_feature *feature,
|
2007-09-05 12:28:31 +00:00
|
|
|
int label_size)
|
|
|
|
{
|
|
|
|
char *label;
|
2007-09-23 12:05:16 +00:00
|
|
|
const sensors_subfeature *subfeature;
|
2007-09-05 12:28:31 +00:00
|
|
|
double beep_enable;
|
2007-09-23 12:05:16 +00:00
|
|
|
|
2007-09-23 12:30:28 +00:00
|
|
|
subfeature = sensors_get_subfeature(name, feature,
|
|
|
|
SENSORS_SUBFEATURE_BEEP_ENABLE);
|
2007-09-23 12:05:16 +00:00
|
|
|
if (!subfeature)
|
|
|
|
return;
|
2007-09-05 12:28:31 +00:00
|
|
|
|
2007-09-23 12:05:16 +00:00
|
|
|
if ((label = sensors_get_label(name, feature))
|
|
|
|
&& !sensors_get_value(name, subfeature->number, &beep_enable)) {
|
2007-09-05 12:28:31 +00:00
|
|
|
print_label(label, label_size);
|
|
|
|
printf("%s\n", beep_enable ? "enabled" : "disabled");
|
|
|
|
}
|
|
|
|
free(label);
|
|
|
|
}
|
|
|
|
|
2007-08-26 21:26:20 +00:00
|
|
|
void print_chip(const sensors_chip_name *name)
|
2007-08-26 12:19:07 +00:00
|
|
|
{
|
2007-09-23 12:05:16 +00:00
|
|
|
const sensors_feature *feature;
|
2007-08-26 12:19:07 +00:00
|
|
|
int i, label_size;
|
|
|
|
|
|
|
|
label_size = sensors_get_label_size(name);
|
|
|
|
|
|
|
|
i = 0;
|
2007-09-23 12:00:59 +00:00
|
|
|
while ((feature = sensors_get_features(name, &i))) {
|
2007-08-26 12:19:07 +00:00
|
|
|
switch (feature->type) {
|
2007-09-23 12:16:50 +00:00
|
|
|
case SENSORS_FEATURE_TEMP:
|
2007-09-23 12:00:59 +00:00
|
|
|
print_chip_temp(name, feature, label_size);
|
2007-08-26 12:19:07 +00:00
|
|
|
break;
|
2007-09-23 12:16:50 +00:00
|
|
|
case SENSORS_FEATURE_IN:
|
2007-09-23 12:00:59 +00:00
|
|
|
print_chip_in(name, feature, label_size);
|
2007-08-26 12:19:07 +00:00
|
|
|
break;
|
2007-09-23 12:16:50 +00:00
|
|
|
case SENSORS_FEATURE_FAN:
|
2007-09-23 12:00:59 +00:00
|
|
|
print_chip_fan(name, feature, label_size);
|
2007-08-26 12:19:07 +00:00
|
|
|
break;
|
2007-09-23 12:16:50 +00:00
|
|
|
case SENSORS_FEATURE_VID:
|
2007-09-23 12:05:16 +00:00
|
|
|
print_chip_vid(name, feature, label_size);
|
2007-08-26 12:19:07 +00:00
|
|
|
break;
|
2007-09-23 12:16:50 +00:00
|
|
|
case SENSORS_FEATURE_BEEP_ENABLE:
|
2007-09-23 12:05:16 +00:00
|
|
|
print_chip_beep_enable(name, feature, label_size);
|
2007-09-05 12:28:31 +00:00
|
|
|
break;
|
2007-08-26 12:19:07 +00:00
|
|
|
default:
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|