libsensors(3)

NAME
libsensors - publically accessible functions provided by the sensors library

SYNOPSIS
#include <sensors/sensors.h>
int sensors_init(FILE *input);
void sensors_cleanup(void);
int sensors_parse_chip_name(const char *orig_name,
                            sensors_chip_name *res);
int sensors_match_chip(sensors_chip_name chip1,
                       sensors_chip_name chip2);
int sensors_chip_name_has_wildcards(sensors_chip_name chip);
const char *sensors_get_adapter_name(int bus_nr);
const char *sensors_get_algorithm_name(int bus_nr);
int sensors_get_label(sensors_chip_name name, int feature,
                      char **result);
int sensors_get_feature(sensors_chip_name name, int feature,
                        double *result);
int sensors_set_feature(sensors_chip_name name, int feature,
                        double value);
int sensors_do_chip_sets(sensors_chip_name name);
extern int sensors_do_all_sets(void);
const sensors_chip_name *sensors_get_detected_chips(int *nr);
const sensors_feature_data *sensors_get_all_features
             (sensors_chip_name name, int *nr1,int *nr2);

DESCRIPTION
int sensors_init(FILE *input);
(Re)load the configuration file and the detected chips list. If this returns a value unequal to zero, you are in trouble; you can not assume anything will be initialized properly. void sensors_cleanup(void);
Clean-up function: You can't access anything after this, until the next sensors_init() call!
int sensors_parse_chip_name(const char *orig_name,
                        sensors_chip_name *res);
Parse a chip name to the internal representation. Return 0 on succes, <0 on error. int sensors_match_chip(sensors_chip_name chip1,
                       sensors_chip_name chip2);
Compare two chips name descriptions, to see whether they could match. Return 0 if it does not match, return 1 if it does match. int sensors_chip_name_has_wildcards
    (sensors_chip_name chip);
Check whether the chip name is an 'absolute' name, which can only match one chip, or whether it has wildcards. Returns 0 if it is absolute, 1 if there are wildcards. const char *sensors_get_adapter_name(int bus_nr);
const char *sensors_get_algorithm_name(int bus_nr);
These functions return the adapter and algorithm names of a bus number, as used within the sensors_chip_name structure. If it could not be found, it returns NULL int sensors_get_label(sensors_chip_name name, int feature,
                      char **result);
Look up the label which belongs to this chip. Note that chip should not contain wildcard values! *result is newly allocated (free it yourself). This function will return 0 on success, and <0 on failure. int sensors_get_feature(sensors_chip_name name,
                        int feature, double *result);
Read the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. int sensors_set_feature(sensors_chip_name name,
                        int feature, double value);
Set the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. int sensors_do_chip_sets(sensors_chip_name name);
Execute all set statements for this particular chip. The chip may contain wildcards! This function will return 0 on success, and <0 on failure. int sensors_do_all_sets(void);
Execute all set statements for all detected chips. This is the same as calling sensors_do_chip_sets with an all wildcards chip name const sensors_chip_name *sensors_get_detected_chips
                        (int *nr);
This function returns all detected chips, one by one. To start at the beginning of the list, use 0 for nr; NULL is returned if we are at the end of the list. Do not try to change these chip names, as they point to internal structures! Do not use nr for anything else. This structure is used when you want to get all features of a specific chip.
typedef struct sensors_feature_data {
  int number;
  const char *name;
  int mapping;
  int unused;
  int mode;
} sensors_feature_data;
The field sensors_feature_data can be one of:
SENSORS_MODE_NO_RW, SENSORS_MODE_R, SENSORS_MODE_W,
SENSORS_MODE_RW or SENSORS_NO_MAPPING. const sensors_feature_data *sensors_get_all_features
      (sensors_chip_name name, int *nr1,int *nr2);
This returns all features of a specific chip. They are returned in bunches: everything with the same mapping is returned just after each other, with the master feature in front (that feature does not map to itself, but has SENSORS_NO_MAPPING as mapping field). nr1 and nr2 are two internally used variables. Set both to zero to start again at the begin of the list. If no more features are found NULL is returned. Do not try to change the returned structure; you will corrupt internal data structures.

CONFORMING TO
lm_sensors-2.x

SEE ALSO
sensors.conf(5)

AUTHOR
Frodo Looijaard and the lm_sensors group http://www.lm-sensors.org/