| 1 |
/* |
| 2 |
* sensord |
| 3 |
* |
| 4 |
* A daemon that periodically logs sensor information to syslog. |
| 5 |
* |
| 6 |
* Copyright (c) 1999-2002 Merlin Hughes <[email protected]> |
| 7 |
* |
| 8 |
* This program is free software; you can redistribute it and/or modify |
| 9 |
* it under the terms of the GNU General Public License as published by |
| 10 |
* the Free Software Foundation; either version 2 of the License, or |
| 11 |
* (at your option) any later version. |
| 12 |
* |
| 13 |
* This program is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU General Public License |
| 19 |
* along with this program; if not, write to the Free Software |
| 20 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
| 21 |
* MA 02110-1301 USA. |
| 22 |
*/ |
| 23 |
|
| 24 |
#include "lib/sensors.h" |
| 25 |
|
| 26 |
#define ARRAY_SIZE(arr) (int)(sizeof(arr) / sizeof((arr)[0])) |
| 27 |
|
| 28 |
extern void sensorLog(int priority, const char *fmt, ...); |
| 29 |
|
| 30 |
/* from args.c */ |
| 31 |
|
| 32 |
extern int parseArgs(int argc, char **argv); |
| 33 |
extern int parseChips(int argc, char **argv); |
| 34 |
extern void freeChips(void); |
| 35 |
|
| 36 |
/* from lib.c */ |
| 37 |
|
| 38 |
extern int loadLib(const char *cfgPath); |
| 39 |
extern int reloadLib(const char *cfgPath); |
| 40 |
extern int unloadLib(void); |
| 41 |
|
| 42 |
/* from sense.c */ |
| 43 |
|
| 44 |
extern int readChips(void); |
| 45 |
extern int scanChips(void); |
| 46 |
extern int setChips(void); |
| 47 |
extern int rrdChips(void); |
| 48 |
|
| 49 |
/* from rrd.c */ |
| 50 |
|
| 51 |
extern char rrdBuff[]; |
| 52 |
extern int rrdInit(void); |
| 53 |
extern int rrdUpdate(void); |
| 54 |
extern int rrdCGI(void); |
| 55 |
|
| 56 |
/* from chips.c */ |
| 57 |
|
| 58 |
#define MAX_DATA 5 |
| 59 |
|
| 60 |
typedef const char *(*FormatterFN) (const double values[], int alrm, |
| 61 |
int beep); |
| 62 |
|
| 63 |
typedef const char *(*RRDFN) (const double values[]); |
| 64 |
|
| 65 |
typedef enum { |
| 66 |
DataType_voltage = 0, |
| 67 |
DataType_rpm, |
| 68 |
DataType_temperature, |
| 69 |
DataType_other = -1 |
| 70 |
} DataType; |
| 71 |
|
| 72 |
typedef struct { |
| 73 |
FormatterFN format; |
| 74 |
RRDFN rrd; |
| 75 |
DataType type; |
| 76 |
int alarmNumber; |
| 77 |
int beepNumber; |
| 78 |
const sensors_feature *feature; |
| 79 |
int dataNumbers[MAX_DATA + 1]; |
| 80 |
} FeatureDescriptor; |
| 81 |
|
| 82 |
typedef struct { |
| 83 |
const sensors_chip_name *name; |
| 84 |
FeatureDescriptor *features; |
| 85 |
} ChipDescriptor; |
| 86 |
|
| 87 |
extern ChipDescriptor * knownChips; |
| 88 |
extern int initKnownChips(void); |
| 89 |
extern void freeKnownChips(void); |