libsensors(3)

NAME
libsensors - publicly 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);
const char *sensors_get_adapter_name(int bus_nr);
char *sensors_get_label(const sensors_chip_name *name, const sensors_feature *feature);
int sensors_get_value(const sensors_chip_name *name, int subfeat_nr,
                      double *value);
int sensors_set_value(const sensors_chip_name *name, int subfeat_nr,
                      double value);
int sensors_do_chip_sets(const sensors_chip_name *name);
const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name
                                                    *match, int *nr);
const sensors_feature *sensors_get_features(const sensors_chip_name *name, int *nr);
const sensors_subfeature *sensors_get_all_subfeatures(const sensors_chip_name *name, const sensors_feature *feature, int *nr);
const sensors_subfeature *sensors_get_subfeature(const sensors_chip_name *name, const sensors_feature *feature, sensors_subfeature_type type);
const char *libsensors_version;

DESCRIPTION
int sensors_init(FILE *input);
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. If you want to reload the configuration file, call sensors_cleanup() below before calling sensors_init() again. If FILE is NULL, the default configuration file is used (see the FILES section below). Most applications will want to do that. 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. const char *sensors_get_adapter_name(int bus_nr);
This function returns the adapter name of a bus number, as used within the sensors_chip_name structure. If it could not be found, it returns NULL. char *sensors_get_label(const sensors_chip_name *name, const sensors_feature *feature);
Look up the label which belongs to this chip. Note that chip should not contain wildcard values! The returned string is newly allocated (free it yourself). On failure, NULL is returned. If no label exists for this feature, its name is returned itself. int sensors_get_value(const sensors_chip_name *name, int subfeat_nr, double *value);
Read the value of a subfeature 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_value(const sensors_chip_name *name, int subfeat_nr, double value);
Set the value of a subfeature 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(const 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. const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name
                        *match, int *nr);
This function returns all detected chips that match a given chip name, one by one. If no chip name is provided, all detected chips are returned. 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! This structure contains information related to a given feature of a specific chip.
typedef struct sensors_feature {
  const char *name;
  int number;
  sensors_feature_type type;
} sensors_feature;
There are other member not documented here, which are only meant for libsensors internal use. This structure contains information related to a given subfeature of a specific chip feature.
typedef struct sensors_subfeature {
  const char *name;
  int number;
  sensors_subfeature_type type;
  int mapping;
  unsigned int flags;
} sensors_subfeature;
The flags field is a bitfield, its value is a combination of SENSORS_MODE_R (readable), SENSORS_MODE_W (writable) and SENSORS_COMPUTE_MAPPING (affected by the computation rules of the main feature). const sensors_feature *sensors_get_features(const sensors_chip_name *name, int *nr);
This returns all main features of a specific chip. nr is an internally used variable. Set it to zero to start 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. const sensors_subfeature *sensors_get_all_subfeatures(const sensors_chip_name *name, const sensors_feature *feature, int *nr);
This returns all subfeatures of a given main feature. nr is an internally used variable. Set it to zero to start at the begin of the list. If no more subfeatures are found NULL is returned. Do not try to change the returned structure; you will corrupt internal data structures. const sensors_subfeature *sensors_get_subfeature(const sensors_chip_name *name, const sensors_feature *feature, sensors_subfeature_type type);
This returns the subfeature of the given type for a given main feature, if it exists, NULL otherwise. Do not try to change the returned structure; you will corrupt internal data structures. const char *libsensors_version;
A string representing the version of libsensors.

FILES
/etc/sensors3.conf
/etc/sensors.conf
    The system-wide libsensors(3) configuration file. /etc/sensors3.conf is tried first, and if it doesn't exist, /etc/sensors.conf is used instead.

SEE ALSO
sensors.conf(5)

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