root/lm-sensors/trunk/lib/libsensors.3 @ 5647

Revision 5647, 7.7 KB (checked in by khali, 4 years ago)

Read extra configuration files from /etc/sensors.d.

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