| 1 |
.\" Copyright 1998, 1999 Adrian Baugh <adrian.baugh@keble.ox.ac.uk> |
|---|
| 2 |
.\" based on sensors.h, part of libsensors by Frodo Looijaard |
|---|
| 3 |
.\" libsensors is distributed under the GPL |
|---|
| 4 |
.\" |
|---|
| 5 |
.\" Permission is granted to make and distribute verbatim copies of this |
|---|
| 6 |
.\" manual provided the copyright notice and this permission notice are |
|---|
| 7 |
.\" preserved on all copies. |
|---|
| 8 |
.\" |
|---|
| 9 |
.\" Permission is granted to copy and distribute modified versions of this |
|---|
| 10 |
.\" manual under the conditions for verbatim copying, provided that the |
|---|
| 11 |
.\" entire resulting derived work is distributed under the terms of a |
|---|
| 12 |
.\" permission notice identical to this one |
|---|
| 13 |
.\" |
|---|
| 14 |
.\" Since the Linux kernel and libraries are constantly changing, this |
|---|
| 15 |
.\" manual page may be incorrect or out-of-date. The author(s) assume no |
|---|
| 16 |
.\" responsibility for errors or omissions, or for damages resulting from |
|---|
| 17 |
.\" the use of the information contained herein. The author(s) may not |
|---|
| 18 |
.\" have taken the same level of care in the production of this manual, |
|---|
| 19 |
.\" which is licensed free of charge, as they might when working |
|---|
| 20 |
.\" professionally. |
|---|
| 21 |
.\" |
|---|
| 22 |
.\" Formatted or processed versions of this manual, if unaccompanied by |
|---|
| 23 |
.\" the source, must acknowledge the copyright and authors of this work. |
|---|
| 24 |
.\" |
|---|
| 25 |
.\" References consulted: |
|---|
| 26 |
.\" libsensors source code |
|---|
| 27 |
.TH libsensors 3 "October 2007" "lm-sensors 3" "Linux Programmer's Manual" |
|---|
| 28 |
.SH NAME |
|---|
| 29 |
libsensors \- publicly accessible functions provided by the sensors library |
|---|
| 30 |
.SH SYNOPSIS |
|---|
| 31 |
.nf |
|---|
| 32 |
.B #include <sensors/sensors.h> |
|---|
| 33 |
|
|---|
| 34 |
.B int sensors_init(FILE *input); |
|---|
| 35 |
.B void sensors_cleanup(void); |
|---|
| 36 |
.B int sensors_parse_chip_name(const char *orig_name, |
|---|
| 37 |
\fBsensors_chip_name *res);\fP |
|---|
| 38 |
.B const char *sensors_get_adapter_name(int bus_nr); |
|---|
| 39 |
.B char *sensors_get_label(const sensors_chip_name *name, const sensors_feature *feature);\fP |
|---|
| 40 |
.B int sensors_get_value(const sensors_chip_name *name, int subfeat_nr, |
|---|
| 41 |
\fBdouble *value);\fP |
|---|
| 42 |
.B int sensors_set_value(const sensors_chip_name *name, int subfeat_nr, |
|---|
| 43 |
\fBdouble value);\fP |
|---|
| 44 |
.B int sensors_do_chip_sets(const sensors_chip_name *name); |
|---|
| 45 |
.B const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name |
|---|
| 46 |
\fB*match, int *nr);\fP |
|---|
| 47 |
.B const sensors_feature *sensors_get_features(const sensors_chip_name *name, int *nr);\fP |
|---|
| 48 |
.B const sensors_subfeature *sensors_get_all_subfeatures(const sensors_chip_name *name, const sensors_feature *feature, int *nr);\fP |
|---|
| 49 |
.B const sensors_subfeature *sensors_get_subfeature(const sensors_chip_name *name, const sensors_feature *feature, sensors_subfeature_type type);\fP |
|---|
| 50 |
.B const char *libsensors_version; |
|---|
| 51 |
.fi |
|---|
| 52 |
.SH DESCRIPTION |
|---|
| 53 |
.B int sensors_init(FILE *input); |
|---|
| 54 |
.br |
|---|
| 55 |
Load the configuration file and the detected chips list. If this returns a |
|---|
| 56 |
value unequal to zero, you are in trouble; you can not assume anything will |
|---|
| 57 |
be initialized properly. If you want to reload the configuration file, call |
|---|
| 58 |
sensors_cleanup() below before calling sensors_init() again. |
|---|
| 59 |
|
|---|
| 60 |
If FILE is NULL, the default configuration file is used (see the FILES |
|---|
| 61 |
section below). Most applications will want to do that. |
|---|
| 62 |
|
|---|
| 63 |
.B void sensors_cleanup(void); |
|---|
| 64 |
.br |
|---|
| 65 |
Clean-up function: You can't access anything after this, until the next sensors_init() call! |
|---|
| 66 |
.br |
|---|
| 67 |
|
|---|
| 68 |
\fBint sensors_parse_chip_name(const char *orig_name, |
|---|
| 69 |
sensors_chip_name *res);\fP |
|---|
| 70 |
.br |
|---|
| 71 |
Parse a chip name to the internal representation. Return 0 on succes, <0 on error. |
|---|
| 72 |
|
|---|
| 73 |
.B const char *sensors_get_adapter_name(int bus_nr); |
|---|
| 74 |
.br |
|---|
| 75 |
This function returns the adapter name of a bus number, as used within the |
|---|
| 76 |
sensors_chip_name structure. If it could not be found, it returns NULL. |
|---|
| 77 |
|
|---|
| 78 |
\fBchar *sensors_get_label(const sensors_chip_name *name, const sensors_feature *feature);\fP |
|---|
| 79 |
.br |
|---|
| 80 |
Look up the label which belongs to this chip. Note that chip should not |
|---|
| 81 |
contain wildcard values! The returned string is newly allocated (free it |
|---|
| 82 |
yourself). On failure, NULL is returned. |
|---|
| 83 |
If no label exists for this feature, its name is returned itself. |
|---|
| 84 |
|
|---|
| 85 |
\fBint sensors_get_value(const sensors_chip_name *name, int subfeat_nr, double *value);\fP |
|---|
| 86 |
.br |
|---|
| 87 |
Read the value of a subfeature of a certain chip. Note that chip should not |
|---|
| 88 |
contain wildcard values! This function will return 0 on success, and <0 on |
|---|
| 89 |
failure. |
|---|
| 90 |
|
|---|
| 91 |
\fBint sensors_set_value(const sensors_chip_name *name, int subfeat_nr, double value);\fP |
|---|
| 92 |
.br |
|---|
| 93 |
Set the value of a subfeature of a certain chip. Note that chip should not |
|---|
| 94 |
contain wildcard values! This function will return 0 on success, and <0 on |
|---|
| 95 |
failure. |
|---|
| 96 |
|
|---|
| 97 |
.B int sensors_do_chip_sets(const sensors_chip_name *name); |
|---|
| 98 |
.br |
|---|
| 99 |
Execute all set statements for this particular chip. The chip may contain wildcards! This function will return 0 on success, and <0 on failure. |
|---|
| 100 |
|
|---|
| 101 |
\fBconst sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name |
|---|
| 102 |
*match, int *nr);\fP |
|---|
| 103 |
.br |
|---|
| 104 |
This function returns all detected chips that match a given chip name, |
|---|
| 105 |
one by one. If no chip name is provided, all detected chips are returned. |
|---|
| 106 |
To start at the beginning of the list, use 0 for nr; NULL is returned if |
|---|
| 107 |
we are at the end of the list. Do not try to change these chip names, as |
|---|
| 108 |
they point to internal structures! |
|---|
| 109 |
|
|---|
| 110 |
This structure contains information related to a given feature of a |
|---|
| 111 |
specific chip. |
|---|
| 112 |
.br |
|---|
| 113 |
\fBtypedef struct sensors_feature { |
|---|
| 114 |
.br |
|---|
| 115 |
const char *name; |
|---|
| 116 |
.br |
|---|
| 117 |
int number; |
|---|
| 118 |
.br |
|---|
| 119 |
sensors_feature_type type; |
|---|
| 120 |
.br |
|---|
| 121 |
} sensors_feature;\fP |
|---|
| 122 |
.br |
|---|
| 123 |
There are other member not documented here, which are only meant for libsensors |
|---|
| 124 |
internal use. |
|---|
| 125 |
|
|---|
| 126 |
This structure contains information related to a given subfeature of a |
|---|
| 127 |
specific chip feature. |
|---|
| 128 |
.br |
|---|
| 129 |
\fBtypedef struct sensors_subfeature { |
|---|
| 130 |
.br |
|---|
| 131 |
const char *name; |
|---|
| 132 |
.br |
|---|
| 133 |
int number; |
|---|
| 134 |
.br |
|---|
| 135 |
sensors_subfeature_type type; |
|---|
| 136 |
.br |
|---|
| 137 |
int mapping; |
|---|
| 138 |
.br |
|---|
| 139 |
unsigned int flags; |
|---|
| 140 |
.br |
|---|
| 141 |
} sensors_subfeature;\fP |
|---|
| 142 |
.br |
|---|
| 143 |
The flags field is a bitfield, its value is a combination of |
|---|
| 144 |
SENSORS_MODE_R (readable), SENSORS_MODE_W (writable) and SENSORS_COMPUTE_MAPPING |
|---|
| 145 |
(affected by the computation rules of the main feature). |
|---|
| 146 |
|
|---|
| 147 |
\fBconst sensors_feature *sensors_get_features(const sensors_chip_name *name, int *nr);\fP |
|---|
| 148 |
.br |
|---|
| 149 |
This returns all main features of a specific chip. nr is an internally |
|---|
| 150 |
used variable. Set it to zero to start at the begin of the list. If no |
|---|
| 151 |
more features are found NULL is returned. |
|---|
| 152 |
Do not try to change the returned structure; you will corrupt internal |
|---|
| 153 |
data structures. |
|---|
| 154 |
|
|---|
| 155 |
\fBconst sensors_subfeature *sensors_get_all_subfeatures(const sensors_chip_name *name, const sensors_feature *feature, int *nr);\fP |
|---|
| 156 |
.br |
|---|
| 157 |
This returns all subfeatures of a given main feature. nr is an internally |
|---|
| 158 |
used variable. Set it to zero to start at the begin of the list. If no |
|---|
| 159 |
more subfeatures are found NULL is returned. |
|---|
| 160 |
Do not try to change the returned structure; you will corrupt internal |
|---|
| 161 |
data structures. |
|---|
| 162 |
|
|---|
| 163 |
\fBconst sensors_subfeature *sensors_get_subfeature(const sensors_chip_name *name, const sensors_feature *feature, sensors_subfeature_type type);\fP |
|---|
| 164 |
.br |
|---|
| 165 |
This returns the subfeature of the given type for a given main feature, |
|---|
| 166 |
if it exists, NULL otherwise. |
|---|
| 167 |
Do not try to change the returned structure; you will corrupt internal |
|---|
| 168 |
data structures. |
|---|
| 169 |
|
|---|
| 170 |
\fBconst char *libsensors_version;\fP |
|---|
| 171 |
.br |
|---|
| 172 |
A string representing the version of libsensors. |
|---|
| 173 |
|
|---|
| 174 |
.SH FILES |
|---|
| 175 |
.I /etc/sensors3.conf |
|---|
| 176 |
.br |
|---|
| 177 |
.I /etc/sensors.conf |
|---|
| 178 |
.RS |
|---|
| 179 |
The system-wide |
|---|
| 180 |
.BR libsensors (3) |
|---|
| 181 |
configuration file. /etc/sensors3.conf is tried first, and if it doesn't exist, |
|---|
| 182 |
/etc/sensors.conf is used instead. |
|---|
| 183 |
|
|---|
| 184 |
.SH SEE ALSO |
|---|
| 185 |
sensors.conf(5) |
|---|
| 186 |
|
|---|
| 187 |
.SH AUTHOR |
|---|
| 188 |
Frodo Looijaard and the lm_sensors group |
|---|
| 189 |
http://www.lm-sensors.org/ |
|---|
| 190 |
|
|---|