1libsensors(3)              Linux Programmer's Manual             libsensors(3)
2
3
4

NAME

6       libsensors  -  publicly  accessible  functions  provided by the sensors
7       library
8

SYNOPSIS

10       #include <sensors/sensors.h>
11
12       int sensors_init(FILE *input);
13       void sensors_cleanup(void);
14       int sensors_parse_chip_name(const char *orig_name,
15                                   sensors_chip_name *res);
16       int sensors_match_chip(sensors_chip_name chip1,
17                              sensors_chip_name chip2);
18       int sensors_chip_name_has_wildcards(sensors_chip_name chip);
19       const char *sensors_get_adapter_name(int bus_nr);
20       int sensors_get_label(sensors_chip_name name, int feature,
21                             char **result);
22       int sensors_get_feature(sensors_chip_name name, int feature,
23                               double *result);
24       int sensors_set_feature(sensors_chip_name name, int feature,
25                               double value);
26       int sensors_do_chip_sets(sensors_chip_name name);
27       extern int sensors_do_all_sets(void);
28       const sensors_chip_name *sensors_get_detected_chips(int *nr);
29       const sensors_feature_data *sensors_get_all_features
30                    (sensors_chip_name name, int *nr1,int *nr2);
31

DESCRIPTION

33       int sensors_init(FILE *input);
34       (Re)load the configuration file and the detected chips  list.  If  this
35       returns a value unequal to zero, you are in trouble; you can not assume
36       anything will be initialized properly.
37
38       void sensors_cleanup(void);
39       Clean-up function: You can't access anything after this, until the next
40       sensors_init() call!
41
42       int sensors_parse_chip_name(const char *orig_name,
43                                   sensors_chip_name *res);
44       Parse  a  chip name to the internal representation. Return 0 on succes,
45       <0 on error.
46
47       int sensors_match_chip(sensors_chip_name chip1,
48                              sensors_chip_name chip2);
49       Compare two chips name descriptions, to see whether they  could  match.
50       Return 0 if it does not match, return 1 if it does match.
51
52       int sensors_chip_name_has_wildcards
53           (sensors_chip_name chip);
54       Check whether the chip name is an 'absolute' name, which can only match
55       one chip, or whether it has wildcards. Returns 0 if it is  absolute,  1
56       if there are wildcards.
57
58       const char *sensors_get_adapter_name(int bus_nr);
59       This  function returns the adapter name of a bus number, as used within
60       the sensors_chip_name structure. If it could not be found,  it  returns
61       NULL.
62
63       const char *sensors_get_algorithm_name(int bus_nr);
64       This function used to return the algorithm name of a bus number.  It is
65       now deprecated and returns an arbitrary string. It will be dropped in a
66       later version of the library so you should stop using it.
67
68       int sensors_get_label(sensors_chip_name name, int feature,
69                             char **result);
70       Look up the label which belongs to this chip. Note that chip should not
71       contain wildcard values! *result is newly allocated (free it yourself).
72       This function will return 0 on success, and <0 on failure.
73
74       int sensors_get_feature(sensors_chip_name name,
75                               int feature, double *result);
76       Read  the  value  of a feature of a certain chip. Note that chip should
77       not contain wildcard values! This function will return  0  on  success,
78       and <0 on failure.
79
80       int sensors_set_feature(sensors_chip_name name,
81                               int feature, double value);
82       Set the value of a feature of a certain chip. Note that chip should not
83       contain wildcard values! This function will return 0 on success, and <0
84       on failure.
85
86       int sensors_do_chip_sets(sensors_chip_name name);
87       Execute  all set statements for this particular chip. The chip may con‐
88       tain wildcards!  This function will return 0  on  success,  and  <0  on
89       failure.
90
91       int sensors_do_all_sets(void);
92       Execute  all set statements for all detected chips. This is the same as
93       calling sensors_do_chip_sets with an all wildcards chip name
94
95       const sensors_chip_name *sensors_get_detected_chips
96                               (int *nr);
97       This function returns all detected chips, one by one. To start  at  the
98       beginning  of the list, use 0 for nr; NULL is returned if we are at the
99       end of the list. Do not try to change these chip names, as  they  point
100       to internal structures! Do not use nr for anything else.
101
102       This  structure is used when you want to get all features of a specific
103       chip.
104       typedef struct sensors_feature_data {
105         int number;
106         const char *name;
107         int mapping;
108         int unused;
109         int mode;
110       } sensors_feature_data;
111       The mode field can be one of:
112       SENSORS_MODE_NO_RW, SENSORS_MODE_R, SENSORS_MODE_W or SENSORS_MODE_RW.
113
114       const sensors_feature_data *sensors_get_all_features
115             (sensors_chip_name name, int *nr1,int *nr2);
116       This returns all features of a specific  chip.  They  are  returned  in
117       bunches:  everything  with the same mapping is returned just after each
118       other, with the master feature in front (that feature does not  map  to
119       itself,  but  has SENSORS_NO_MAPPING as mapping field). nr1 and nr2 are
120       two internally used variables. Set both to zero to start again  at  the
121       begin  of  the list. If no more features are found NULL is returned. Do
122       not try to change the returned structure;  you  will  corrupt  internal
123       data structures.
124
125
126

CONFORMING TO

128       lm_sensors-2.x
129

SEE ALSO

131       sensors.conf(5)
132
133

AUTHOR

135       Frodo Looijaard and the lm_sensors group http://www.lm-sensors.org/
136
137
138
139
140                                 October 2006                    libsensors(3)
Impressum