2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 14:25:39 +00:00

sensors support for ipmi. Includes limited support for

add'l dummy adaps in libsensors


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1606 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Mark D. Studebaker
2002-11-16 03:12:18 +00:00
parent ca292047a5
commit 5a24ce81e4
4 changed files with 78 additions and 0 deletions

View File

@@ -298,6 +298,8 @@ const char *sensors_get_adapter_name(int bus_nr)
int i;
if (bus_nr == SENSORS_CHIP_NAME_BUS_ISA)
return "ISA adapter";
if (bus_nr == SENSORS_CHIP_NAME_BUS_DUMMY)
return "Dummy adapter";
for (i=0; i < sensors_proc_bus_count; i++)
if (sensors_proc_bus[i].number == bus_nr)
return sensors_proc_bus[i].adapter;
@@ -309,6 +311,8 @@ const char *sensors_get_algorithm_name(int bus_nr)
int i;
if (bus_nr == SENSORS_CHIP_NAME_BUS_ISA)
return "ISA algorithm";
if (bus_nr == SENSORS_CHIP_NAME_BUS_DUMMY)
return "Dummy algorithm";
for (i=0; i < sensors_proc_bus_count; i++)
if (sensors_proc_bus[i].number == bus_nr)
return sensors_proc_bus[i].algorithm;

View File

@@ -28,6 +28,7 @@
#define SENSORS_CHIP_NAME_BUS_ISA -1
#define SENSORS_CHIP_NAME_BUS_ANY -2
#define SENSORS_CHIP_NAME_BUS_ANY_I2C -3
#define SENSORS_CHIP_NAME_BUS_DUMMY -4
#define SENSORS_CHIP_NAME_ADDR_ANY -1
#ifdef __cplusplus
@@ -39,6 +40,7 @@ typedef struct sensors_chip_name {
char *prefix;
int bus;
int addr;
char *busname; /* if dummy */
} sensors_chip_name;
/* (Re)load the configuration file and the detected chips list. If this

View File

@@ -3642,6 +3642,74 @@ void print_vt8231(const sensors_chip_name *name)
}
#define BMC_MAX_INS 10
#define BMC_MAX_FANS 10
#define BMC_MAX_TEMPS 10
void print_bmc(const sensors_chip_name *name)
{
char *label = NULL;
double cur,min,max,fdiv;
int alarms, valid, i;
/*
if (!sensors_get_feature(*name,SENSORS_VT8231_ALARMS,&cur))
alarms = cur + 0.5;
else {
printf("ERROR: Can't get alarm data!\n");
alarms = 0;
}
*/
#define BMC_ALARM_IN1 0
#define BMC_ALARM_FAN1 0
#define BMC_ALARM_TEMP1 0
alarms = 0;
for(i = 0; i < BMC_MAX_INS; i++) {
if (!sensors_get_label_and_valid(*name,SENSORS_BMC_IN1+i,&label,&valid) &&
!sensors_get_feature(*name,SENSORS_BMC_IN1+i,&cur) &&
!sensors_get_feature(*name,SENSORS_BMC_IN1_MIN+i,&min) &&
!sensors_get_feature(*name,SENSORS_BMC_IN1_MAX+i,&max)) {
if (valid) {
print_label(label,10);
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n",
cur,min,max,alarms&BMC_ALARM_IN1?"ALARM":"");
}
}
free_the_label(&label);
}
for(i = 0; i < BMC_MAX_FANS; i++) {
if (!sensors_get_label_and_valid(*name,SENSORS_BMC_FAN1+i,&label,&valid) &&
!sensors_get_feature(*name,SENSORS_BMC_FAN1+i,&cur) &&
/*
!sensors_get_feature(*name,SENSORS_BMC_FAN1_DIV+i,&fdiv) &&
*/
!sensors_get_feature(*name,SENSORS_BMC_FAN1_MIN+i,&min)) {
if (valid) {
print_label(label,10);
printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n",
cur,min,fdiv, alarms&BMC_ALARM_FAN1?"ALARM":"");
}
}
free_the_label(&label);
}
for(i = 0; i < BMC_MAX_TEMPS; i++) {
if (!sensors_get_label_and_valid(*name,SENSORS_BMC_TEMP1+i,&label,&valid) &&
!sensors_get_feature(*name,SENSORS_BMC_TEMP1+i,&cur) &&
!sensors_get_feature(*name,SENSORS_BMC_TEMP1_MIN+i,&min) &&
!sensors_get_feature(*name,SENSORS_BMC_TEMP1_MAX+i,&max)) {
if (valid) {
print_label(label,10);
print_temp_info( cur, max, min, HYST, 1, 0);
printf(" %s\n", alarms & BMC_ALARM_TEMP1 ? "ALARM" : "" );
}
}
free_the_label(&label);
}
}
void print_unknown_chip(const sensors_chip_name *name)
{
int a,b,valid;

View File

@@ -274,6 +274,8 @@ const char *sprintf_chip_name(sensors_chip_name name)
if (name.bus == SENSORS_CHIP_NAME_BUS_ISA)
snprintf(buf,BUF_SIZE,"%s-isa-%04x",name.prefix,name.addr);
else if (name.bus == SENSORS_CHIP_NAME_BUS_DUMMY)
snprintf(buf,BUF_SIZE,"%s-%s-%04x",name.prefix,name.busname,name.addr);
else
snprintf(buf,BUF_SIZE,"%s-i2c-%d-%02x",name.prefix,name.bus,name.addr);
return buf;
@@ -355,6 +357,8 @@ void do_a_print(sensors_chip_name name)
print_lm92(&name);
else if (!strcmp(name.prefix,"vt8231"))
print_vt8231(&name);
else if (!strcmp(name.prefix,"bmc"))
print_bmc(&name);
else
print_unknown_chip(&name);
printf("\n");