mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-29 21:08:19 +00:00
Simplify gl518sm print.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2251 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
db27a07183
commit
3eaffe23d3
1 file changed
+59
-102
+59
-102
@@ -1014,120 +1014,76 @@ void print_gl518(const sensors_chip_name *name)
|
|||||||
char *label = NULL;
|
char *label = NULL;
|
||||||
double cur,min,max,fdiv;
|
double cur,min,max,fdiv;
|
||||||
int alarms,beeps,valid;
|
int alarms,beeps,valid;
|
||||||
int is_r00;
|
|
||||||
|
|
||||||
cur = 0.0;
|
|
||||||
sensors_get_feature(*name,SENSORS_GL518_ITERATE,&cur);
|
|
||||||
is_r00 = ((int) (cur + 0.5)) != 3;
|
|
||||||
if (!sensors_get_feature(*name,SENSORS_GL518_ALARMS,&cur))
|
if (!sensors_get_feature(*name,SENSORS_GL518_ALARMS,&cur))
|
||||||
alarms = cur + 0.5;
|
alarms = cur + 0.5;
|
||||||
else {
|
else {
|
||||||
printf("ERROR: Can't get alarm data!\n");
|
printf("ERROR: Can't get ALARMS data!\n");
|
||||||
alarms = 0;
|
alarms = 0;
|
||||||
}
|
}
|
||||||
if (!sensors_get_feature(*name,SENSORS_GL518_BEEPS,&cur))
|
if (!sensors_get_feature(*name,SENSORS_GL518_BEEPS,&cur))
|
||||||
beeps = cur + 0.5;
|
beeps = cur + 0.5;
|
||||||
else {
|
else {
|
||||||
printf("ERROR: Can't get beep data!\n");
|
printf("ERROR: Can't get BEEPS data!\n");
|
||||||
beeps = 0;
|
beeps = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We need special treatment for the R00 chips, because they can't display
|
/* VCC, VIN1 and VIN2 are handled specially because on early releases (0x00)
|
||||||
actual readings! We hardcode this, as this is the easiest way. */
|
* of the GL518SM, we cannot read their values. This is detected when the
|
||||||
if (is_r00) {
|
* reading would be 0.0 V and displayed as "(n/a)" instead. */
|
||||||
if (!sensors_get_label_and_valid(*name,SENSORS_GL518_VDD,&label,&valid) &&
|
if (!sensors_get_label_and_valid(*name,SENSORS_GL518_VDD,&label,&valid) &&
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_VDD,&cur) &&
|
!sensors_get_feature(*name,SENSORS_GL518_VDD,&cur) &&
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_VDD_MIN,&min) &&
|
!sensors_get_feature(*name,SENSORS_GL518_VDD_MIN,&min) &&
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_VDD_MAX,&max)) {
|
!sensors_get_feature(*name,SENSORS_GL518_VDD_MAX,&max)) {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
print_label(label,10);
|
print_label(label,10);
|
||||||
if (cur == 0.0)
|
if (cur == 0.0)
|
||||||
printf("(n/a) ");
|
printf("(n/a) ");
|
||||||
else
|
else
|
||||||
printf("%+6.2f V ",cur);
|
printf("%+6.2f V ",cur);
|
||||||
printf( "(min = %+6.2f V, max = %+6.2f V) %s %s\n",
|
printf( "(min = %+6.2f V, max = %+6.2f V) %s %s\n",
|
||||||
min,max,alarms&GL518_ALARM_VDD?"ALARM":" ",
|
min,max,alarms&GL518_ALARM_VDD?"ALARM":" ",
|
||||||
beeps&GL518_ALARM_VDD?"(beep)":"");
|
beeps&GL518_ALARM_VDD?"(beep)":"");
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
printf("ERROR: Can't get VDD data!\n");
|
printf("ERROR: Can't get VDD data!\n");
|
||||||
free_the_label(&label);
|
free_the_label(&label);
|
||||||
|
|
||||||
if (!sensors_get_label_and_valid(*name,SENSORS_GL518_VIN1,&label,&valid) &&
|
if (!sensors_get_label_and_valid(*name,SENSORS_GL518_VIN1,&label,&valid) &&
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_VIN1,&cur) &&
|
!sensors_get_feature(*name,SENSORS_GL518_VIN1,&cur) &&
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_VIN1_MIN,&min) &&
|
!sensors_get_feature(*name,SENSORS_GL518_VIN1_MIN,&min) &&
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_VIN1_MAX,&max)) {
|
!sensors_get_feature(*name,SENSORS_GL518_VIN1_MAX,&max)) {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
print_label(label,10);
|
print_label(label,10);
|
||||||
if (cur == 0.0)
|
if (cur == 0.0)
|
||||||
printf("(n/a) ");
|
printf("(n/a) ");
|
||||||
else
|
else
|
||||||
printf("%+6.2f V ",cur);
|
printf("%+6.2f V ",cur);
|
||||||
printf("(min = %+6.2f V, max = %+6.2f V) %s %s\n",
|
printf("(min = %+6.2f V, max = %+6.2f V) %s %s\n",
|
||||||
min,max,alarms&GL518_ALARM_VIN1?"ALARM":" ",
|
min,max,alarms&GL518_ALARM_VIN1?"ALARM":" ",
|
||||||
beeps&GL518_ALARM_VIN1?"(beep)":"");
|
beeps&GL518_ALARM_VIN1?"(beep)":"");
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
printf("ERROR: Can't get VIN1 data!\n");
|
printf("ERROR: Can't get VIN1 data!\n");
|
||||||
free_the_label(&label);
|
free_the_label(&label);
|
||||||
if (!sensors_get_label_and_valid(*name,SENSORS_GL518_VIN2,&label,&valid) &&
|
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_VIN2,&cur) &&
|
if (!sensors_get_label_and_valid(*name,SENSORS_GL518_VIN2,&label,&valid) &&
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_VIN2_MIN,&min) &&
|
!sensors_get_feature(*name,SENSORS_GL518_VIN2,&cur) &&
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_VIN2_MAX,&max)) {
|
!sensors_get_feature(*name,SENSORS_GL518_VIN2_MIN,&min) &&
|
||||||
if (valid) {
|
!sensors_get_feature(*name,SENSORS_GL518_VIN2_MAX,&max)) {
|
||||||
print_label(label,10);
|
if (valid) {
|
||||||
if (cur == 0.0)
|
print_label(label,10);
|
||||||
printf("(n/a) ");
|
if (cur == 0.0)
|
||||||
else
|
printf("(n/a) ");
|
||||||
printf("%+6.2f V ",cur);
|
else
|
||||||
printf("(min = %+6.2f V, max = %+6.2f V) %s %s\n",
|
printf("%+6.2f V ",cur);
|
||||||
min,max,alarms&GL518_ALARM_VIN2?"ALARM":" ",
|
printf("(min = %+6.2f V, max = %+6.2f V) %s %s\n",
|
||||||
beeps&GL518_ALARM_VIN2?"(beep)":"");
|
min,max,alarms&GL518_ALARM_VIN2?"ALARM":" ",
|
||||||
}
|
beeps&GL518_ALARM_VIN2?"(beep)":"");
|
||||||
} else
|
}
|
||||||
printf("ERROR: Can't get IN2 data!\n");
|
} else
|
||||||
free_the_label(&label);
|
printf("ERROR: Can't get VIN2 data!\n");
|
||||||
} else {
|
free_the_label(&label);
|
||||||
if (!sensors_get_label_and_valid(*name,SENSORS_GL518_VDD,&label,&valid) &&
|
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_VDD,&cur) &&
|
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_VDD_MIN,&min) &&
|
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_VDD_MAX,&max)) {
|
|
||||||
if (valid) {
|
|
||||||
print_label(label,10);
|
|
||||||
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n",
|
|
||||||
cur,min,max,alarms&GL518_ALARM_VDD?"ALARM":" ",
|
|
||||||
beeps&GL518_ALARM_VDD?"(beep)":"");
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
printf("ERROR: Can't get VDD data!\n");
|
|
||||||
free_the_label(&label);
|
|
||||||
if (!sensors_get_label_and_valid(*name,SENSORS_GL518_VIN1,&label,&valid) &&
|
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_VIN1,&cur) &&
|
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_VIN1_MIN,&min) &&
|
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_VIN1_MAX,&max)) {
|
|
||||||
if (valid) {
|
|
||||||
print_label(label,10);
|
|
||||||
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n",
|
|
||||||
cur,min,max,alarms&GL518_ALARM_VIN1?"ALARM":" ",
|
|
||||||
beeps&GL518_ALARM_VIN1?"(beep)":"");
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
printf("ERROR: Can't get VIN1 data!\n");
|
|
||||||
free_the_label(&label);
|
|
||||||
if (!sensors_get_label_and_valid(*name,SENSORS_GL518_VIN2,&label,&valid) &&
|
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_VIN2,&cur) &&
|
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_VIN2_MIN,&min) &&
|
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_VIN2_MAX,&max)) {
|
|
||||||
if (valid) {
|
|
||||||
print_label(label,10);
|
|
||||||
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n",
|
|
||||||
cur,min,max,alarms&GL518_ALARM_VIN2?"ALARM":" ",
|
|
||||||
beeps&GL518_ALARM_VIN2?"(beep)":"");
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
printf("ERROR: Can't get IN2 data!\n");
|
|
||||||
free_the_label(&label);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sensors_get_label_and_valid(*name,SENSORS_GL518_VIN3,&label,&valid) &&
|
if (!sensors_get_label_and_valid(*name,SENSORS_GL518_VIN3,&label,&valid) &&
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_VIN3,&cur) &&
|
!sensors_get_feature(*name,SENSORS_GL518_VIN3,&cur) &&
|
||||||
@@ -1156,6 +1112,7 @@ void print_gl518(const sensors_chip_name *name)
|
|||||||
} else
|
} else
|
||||||
printf("ERROR: Can't get FAN1 data!\n");
|
printf("ERROR: Can't get FAN1 data!\n");
|
||||||
free_the_label(&label);
|
free_the_label(&label);
|
||||||
|
|
||||||
if (!sensors_get_label_and_valid(*name,SENSORS_GL518_FAN2,&label,&valid) &&
|
if (!sensors_get_label_and_valid(*name,SENSORS_GL518_FAN2,&label,&valid) &&
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_FAN2,&cur) &&
|
!sensors_get_feature(*name,SENSORS_GL518_FAN2,&cur) &&
|
||||||
!sensors_get_feature(*name,SENSORS_GL518_FAN2_DIV,&fdiv) &&
|
!sensors_get_feature(*name,SENSORS_GL518_FAN2_DIV,&fdiv) &&
|
||||||
@@ -1193,7 +1150,7 @@ void print_gl518(const sensors_chip_name *name)
|
|||||||
else
|
else
|
||||||
printf("Sound alarm enabled\n");
|
printf("Sound alarm enabled\n");
|
||||||
} else
|
} else
|
||||||
printf("ERROR: Can't get BEEP data!\n");
|
printf("ERROR: Can't get BEEP ENABLE data!\n");
|
||||||
}
|
}
|
||||||
free_the_label(&label);
|
free_the_label(&label);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user