mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-10-28 12:40:42 +00:00
"alarm" is a glibc function, don't use this identifier for our own
variables to prevent any confusion. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5797 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
db0b1e6e11
commit
6d3f81d5da
4 files changed
+31
-30
No files matched your search
@@ -9,6 +9,7 @@ SVN-HEAD
|
||||
pwmconfig: Exit immediately if not root
|
||||
Save device paths and names in configuration file
|
||||
sensors.conf.default: Encourage user to not modify this file
|
||||
sensord: Don't name our variables "alarm"
|
||||
sensors-detect: Refer to tmp401 driver if TMP411 is detected
|
||||
Clean up the discovery of i2c adapters
|
||||
Report unsupported Access Bus adapters
|
||||
|
||||
+22
-22
@@ -33,78 +33,78 @@
|
||||
|
||||
static char buff[4096];
|
||||
|
||||
static const char *fmtExtra(int alarm, int beep)
|
||||
static const char *fmtExtra(int alrm, int beep)
|
||||
{
|
||||
if (alarm)
|
||||
if (alrm)
|
||||
sprintf(buff + strlen(buff), " [ALARM]");
|
||||
if (beep)
|
||||
sprintf(buff + strlen(buff), " (beep)");
|
||||
return buff;
|
||||
}
|
||||
|
||||
static const char *fmtTemps_1(const double values[], int alarm, int beep)
|
||||
static const char *fmtTemps_1(const double values[], int alrm, int beep)
|
||||
{
|
||||
sprintf(buff, "%.1f C (limit = %.1f C, hysteresis = %.1f C)",
|
||||
values[0], values[1], values[2]);
|
||||
return fmtExtra(alarm, beep);
|
||||
return fmtExtra(alrm, beep);
|
||||
}
|
||||
|
||||
static const char *fmtTemps_minmax_1(const double values[], int alarm,
|
||||
static const char *fmtTemps_minmax_1(const double values[], int alrm,
|
||||
int beep) {
|
||||
sprintf(buff, "%.1f C (min = %.1f C, max = %.1f C)", values[0],
|
||||
values[1], values[2]);
|
||||
return fmtExtra(alarm, beep);
|
||||
return fmtExtra(alrm, beep);
|
||||
}
|
||||
|
||||
static const char *fmtTemp_only(const double values[], int alarm, int beep)
|
||||
static const char *fmtTemp_only(const double values[], int alrm, int beep)
|
||||
{
|
||||
sprintf(buff, "%.1f C", values[0]);
|
||||
return fmtExtra(alarm, beep);
|
||||
return fmtExtra(alrm, beep);
|
||||
}
|
||||
|
||||
static const char *fmtVolt_2(const double values[], int alarm, int beep)
|
||||
static const char *fmtVolt_2(const double values[], int alrm, int beep)
|
||||
{
|
||||
sprintf(buff, "%+.2f V", values[0]);
|
||||
return fmtExtra(alarm, beep);
|
||||
return fmtExtra(alrm, beep);
|
||||
}
|
||||
|
||||
static const char *fmtVolt_3(const double values[], int alarm, int beep)
|
||||
static const char *fmtVolt_3(const double values[], int alrm, int beep)
|
||||
{
|
||||
sprintf(buff, "%+.3f V", values[0]);
|
||||
return fmtExtra(alarm, beep);
|
||||
return fmtExtra(alrm, beep);
|
||||
}
|
||||
|
||||
static const char *fmtVolts_2(const double values[], int alarm, int beep)
|
||||
static const char *fmtVolts_2(const double values[], int alrm, int beep)
|
||||
{
|
||||
sprintf(buff, "%+.2f V (min = %+.2f V, max = %+.2f V)", values[0],
|
||||
values[1], values[2]);
|
||||
return fmtExtra(alarm, beep);
|
||||
return fmtExtra(alrm, beep);
|
||||
}
|
||||
|
||||
static const char *fmtFans_0(const double values[], int alarm, int beep)
|
||||
static const char *fmtFans_0(const double values[], int alrm, int beep)
|
||||
{
|
||||
sprintf(buff, "%.0f RPM (min = %.0f RPM, div = %.0f)", values[0],
|
||||
values[1], values[2]);
|
||||
return fmtExtra(alarm, beep);
|
||||
return fmtExtra(alrm, beep);
|
||||
}
|
||||
|
||||
static const char *fmtFans_nodiv_0(const double values[], int alarm, int beep)
|
||||
static const char *fmtFans_nodiv_0(const double values[], int alrm, int beep)
|
||||
{
|
||||
sprintf(buff, "%.0f RPM (min = %.0f RPM)", values[0], values[1]);
|
||||
return fmtExtra(alarm, beep);
|
||||
return fmtExtra(alrm, beep);
|
||||
}
|
||||
|
||||
static const char *fmtFan_only(const double values[], int alarm, int beep)
|
||||
static const char *fmtFan_only(const double values[], int alrm, int beep)
|
||||
{
|
||||
sprintf(buff, "%.0f RPM", values[0]);
|
||||
return fmtExtra(alarm, beep);
|
||||
return fmtExtra(alrm, beep);
|
||||
}
|
||||
|
||||
static const char *fmtSoundAlarm(const double values[], int alarm, int beep)
|
||||
static const char *fmtSoundAlarm(const double values[], int alrm, int beep)
|
||||
{
|
||||
sprintf(buff, "Sound alarm %s",
|
||||
(values[0] < 0.5) ? "disabled" : "enabled");
|
||||
return fmtExtra(alarm, beep);
|
||||
return fmtExtra(alrm, beep);
|
||||
}
|
||||
|
||||
static const char *rrdF0(const double values[])
|
||||
|
||||
@@ -84,7 +84,7 @@ static int get_flag(const sensors_chip_name *chip, int num)
|
||||
|
||||
static int get_features(const sensors_chip_name *chip,
|
||||
const FeatureDescriptor *feature, int action,
|
||||
char *label, int alarm, int beep)
|
||||
char *label, int alrm, int beep)
|
||||
{
|
||||
int i, ret;
|
||||
double val[MAX_DATA];
|
||||
@@ -111,7 +111,7 @@ static int get_features(const sensors_chip_name *chip,
|
||||
strcat(strcat (rrdBuff, ":"), rrded ? rrded : "U");
|
||||
}
|
||||
} else {
|
||||
const char *formatted = feature->format(val, alarm, beep);
|
||||
const char *formatted = feature->format(val, alrm, beep);
|
||||
|
||||
if (!formatted) {
|
||||
sensorLog(LOG_ERR, "Error formatting sensor data");
|
||||
@@ -132,7 +132,7 @@ static int do_features(const sensors_chip_name *chip,
|
||||
const FeatureDescriptor *feature, int action)
|
||||
{
|
||||
char *label;
|
||||
int alarm, beep;
|
||||
int alrm, beep;
|
||||
|
||||
label = sensors_get_label(chip, feature->feature);
|
||||
if (!label) {
|
||||
@@ -141,17 +141,17 @@ static int do_features(const sensors_chip_name *chip,
|
||||
return -1;
|
||||
}
|
||||
|
||||
alarm = get_flag(chip, feature->alarmNumber);
|
||||
if (alarm == -1)
|
||||
alrm = get_flag(chip, feature->alarmNumber);
|
||||
if (alrm == -1)
|
||||
return -1;
|
||||
else if (action == DO_SCAN && !alarm)
|
||||
else if (action == DO_SCAN && !alrm)
|
||||
return 0;
|
||||
|
||||
beep = get_flag(chip, feature->beepNumber);
|
||||
if (beep == -1)
|
||||
return -1;
|
||||
|
||||
return get_features(chip, feature, action, label, alarm, beep);
|
||||
return get_features(chip, feature, action, label, alrm, beep);
|
||||
}
|
||||
|
||||
static int doKnownChip(const sensors_chip_name *chip,
|
||||
|
||||
@@ -57,7 +57,7 @@ extern int rrdCGI(void);
|
||||
|
||||
#define MAX_DATA 5
|
||||
|
||||
typedef const char *(*FormatterFN) (const double values[], int alarm,
|
||||
typedef const char *(*FormatterFN) (const double values[], int alrm,
|
||||
int beep);
|
||||
|
||||
typedef const char *(*RRDFN) (const double values[]);
|
||||
|
||||
Reference in new issue
Block a user