mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-08-31 06:15:15 +00:00
Initial checkin of it87 driver from
Christophe Gauthron <chrisg@0-in.com> git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1112 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
@@ -2426,6 +2426,220 @@ printf("%d %d %d %d\n", (int) a, (int) b, (int) c, (int) d);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void print_it87(const sensors_chip_name *name)
|
||||
{
|
||||
char *label = NULL;
|
||||
double cur, min, max, fdiv;
|
||||
int alarms_fan, alarms_vin, alarms_temp, valid;
|
||||
|
||||
if (!sensors_get_feature(*name,SENSORS_IT87_ALARMS_FAN, &cur)) {
|
||||
alarms_fan = cur + 0.5;
|
||||
}
|
||||
else {
|
||||
printf("ERROR: Can't get fan alarm data!\n");
|
||||
alarms_fan = 0;
|
||||
}
|
||||
|
||||
if (!sensors_get_feature(*name,SENSORS_IT87_ALARMS_VIN, &cur)) {
|
||||
alarms_vin = cur + 0.5;
|
||||
}
|
||||
else {
|
||||
printf("ERROR: Can't get vin alarm data!\n");
|
||||
alarms_vin = 0;
|
||||
}
|
||||
|
||||
if (!sensors_get_feature(*name,SENSORS_IT87_ALARMS_TEMP, &cur)) {
|
||||
alarms_temp = cur + 0.5;
|
||||
}
|
||||
else {
|
||||
printf("ERROR: Can't get temp alarm data!\n");
|
||||
alarms_temp = 0;
|
||||
}
|
||||
|
||||
|
||||
if (!sensors_get_label_and_valid(*name,SENSORS_IT87_IN0,&label,&valid) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN0,&cur) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN0_MIN,&min) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN0_MAX,&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_vin&IT87_ALARM_IN0?"ALARM":"");
|
||||
}
|
||||
} else
|
||||
printf("ERROR: Can't get IN0 data!\n");
|
||||
free_the_label(&label);
|
||||
if (!sensors_get_label_and_valid(*name,SENSORS_IT87_IN1,&label,&valid) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN1,&cur) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN1_MIN,&min) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN1_MAX,&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_vin&IT87_ALARM_IN1?"ALARM":"");
|
||||
}
|
||||
} else
|
||||
printf("ERROR: Can't get IN1 data!\n");
|
||||
free_the_label(&label);
|
||||
if (!sensors_get_label_and_valid(*name,SENSORS_IT87_IN2,&label,&valid) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN2,&cur) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN2_MIN,&min) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN2_MAX,&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_vin&IT87_ALARM_IN2?"ALARM":"");
|
||||
}
|
||||
} else
|
||||
printf("ERROR: Can't get IN2 data!\n");
|
||||
free_the_label(&label);
|
||||
if (!sensors_get_label_and_valid(*name,SENSORS_IT87_IN3,&label,&valid) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN3,&cur) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN3_MIN,&min) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN3_MAX,&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_vin&IT87_ALARM_IN3?"ALARM":"");
|
||||
}
|
||||
} else
|
||||
printf("ERROR: Can't get IN3 data!\n");
|
||||
free_the_label(&label);
|
||||
if (!sensors_get_label_and_valid(*name,SENSORS_IT87_IN4,&label,&valid) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN4,&cur) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN4_MIN,&min) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN4_MAX,&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_vin&IT87_ALARM_IN4?"ALARM":"");
|
||||
}
|
||||
} else
|
||||
printf("ERROR: Can't get IN4 data!\n");
|
||||
free_the_label(&label);
|
||||
if (!sensors_get_label_and_valid(*name,SENSORS_IT87_IN5,&label,&valid) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN5,&cur) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN5_MIN,&min) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN5_MAX,&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_vin&IT87_ALARM_IN5?"ALARM":"");
|
||||
}
|
||||
} else
|
||||
printf("ERROR: Can't get IN5 data!\n");
|
||||
free_the_label(&label);
|
||||
if (!sensors_get_label_and_valid(*name,SENSORS_IT87_IN6,&label,&valid) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN6,&cur) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN6_MIN,&min) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN6_MAX,&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_vin&IT87_ALARM_IN6?"ALARM":"");
|
||||
}
|
||||
} else
|
||||
printf("ERROR: Can't get IN6 data!\n");
|
||||
free_the_label(&label);
|
||||
if (!sensors_get_label_and_valid(*name,SENSORS_IT87_IN7,&label,&valid) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN7,&cur) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN7_MIN,&min) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_IN7_MAX,&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_vin&IT87_ALARM_IN7?"ALARM":"");
|
||||
}
|
||||
} else
|
||||
printf("ERROR: Can't get IN7 data!\n");
|
||||
free_the_label(&label);
|
||||
|
||||
if (!sensors_get_label_and_valid(*name,SENSORS_IT87_FAN1,&label,&valid) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_FAN1,&cur) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_FAN1_DIV,&fdiv) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_FAN1_MIN,&min)) {
|
||||
if (valid) {
|
||||
print_label(label,10);
|
||||
printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n",
|
||||
cur,min,fdiv, alarms_fan&IT87_ALARM_FAN1?"ALARM":"");
|
||||
}
|
||||
} else
|
||||
printf("ERROR: Can't get FAN1 data!\n");
|
||||
free_the_label(&label);
|
||||
if (!sensors_get_label_and_valid(*name,SENSORS_IT87_FAN2,&label,&valid) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_FAN2,&cur) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_FAN2_DIV,&fdiv) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_FAN2_MIN,&min)) {
|
||||
if (valid) {
|
||||
print_label(label,10);
|
||||
printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n",
|
||||
cur,min,fdiv, alarms_fan&IT87_ALARM_FAN2?"ALARM":"");
|
||||
}
|
||||
} else
|
||||
printf("ERROR: Can't get FAN2 data!\n");
|
||||
free_the_label(&label);
|
||||
if (!sensors_get_label_and_valid(*name,SENSORS_IT87_FAN3,&label,&valid) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_FAN3,&cur) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_FAN3_DIV,&fdiv) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_FAN3_MIN,&min)) {
|
||||
if (valid) {
|
||||
print_label(label,10);
|
||||
printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n",
|
||||
cur,min,fdiv, alarms_fan&IT87_ALARM_FAN3?"ALARM":"");
|
||||
}
|
||||
} else
|
||||
printf("ERROR: Can't get FAN3 data!\n");
|
||||
free_the_label(&label);
|
||||
|
||||
if (!sensors_get_label_and_valid(*name,SENSORS_IT87_TEMP1,&label,&valid) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_TEMP1,&cur) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_TEMP1_LOW,&min) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_TEMP1_HIGH,&max)) {
|
||||
if (valid) {
|
||||
print_label(label,10);
|
||||
print_temp_info( cur, max, min, MINMAX );
|
||||
printf( " %s\n", alarms_temp & IT87_ALARM_TEMP1 ? "ALARM" : "" );
|
||||
}
|
||||
} else
|
||||
printf("ERROR: Can't get TEMP1 data!\n");
|
||||
free_the_label(&label);
|
||||
if (!sensors_get_label_and_valid(*name,SENSORS_IT87_TEMP2,&label,&valid) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_TEMP2,&cur) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_TEMP2_LOW,&min) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_TEMP2_HIGH,&max)) {
|
||||
if (valid) {
|
||||
print_label(label,10);
|
||||
print_temp_info( cur, max, min, MINMAX );
|
||||
printf( " %s\n", alarms_temp & IT87_ALARM_TEMP2 ? "ALARM" : "" );
|
||||
}
|
||||
} else
|
||||
printf("ERROR: Can't get TEMP2 data!\n");
|
||||
free_the_label(&label);
|
||||
if (!sensors_get_label_and_valid(*name,SENSORS_IT87_TEMP3,&label,&valid) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_TEMP3,&cur) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_TEMP3_LOW,&min) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_TEMP3_HIGH,&max)) {
|
||||
if (valid) {
|
||||
print_label(label,10);
|
||||
print_temp_info( cur, max, min, MINMAX );
|
||||
printf( " %s\n", alarms_temp & IT87_ALARM_TEMP3 ? "ALARM" : "" );
|
||||
}
|
||||
} else
|
||||
printf("ERROR: Can't get TEMP3 data!\n");
|
||||
free_the_label(&label);
|
||||
|
||||
if (!sensors_get_label_and_valid(*name,SENSORS_IT87_VID,&label,&valid) &&
|
||||
!sensors_get_feature(*name,SENSORS_IT87_VID,&cur)) {
|
||||
if (valid) {
|
||||
print_label(label,10);
|
||||
printf("%+5.2f V\n",cur);
|
||||
}
|
||||
}
|
||||
free_the_label(&label);
|
||||
}
|
||||
|
||||
|
||||
void print_unknown_chip(const sensors_chip_name *name)
|
||||
{
|
||||
int a,b,valid;
|
||||
|
Reference in New Issue
Block a user