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

Revision 5650, 8.2 KB (checked in by khali, 4 years ago)

Reformat synopsis section.

  • 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
30.SH NAME
31libsensors \- publicly accessible functions provided by the sensors library
32
33.SH SYNOPSIS
34.nf
35.B #include <sensors/sensors.h>
36
37/* Library initialization and clean-up */
38.BI "int sensors_init(FILE *" input ");"
39.B void sensors_cleanup(void);
40.BI "const char *" libsensors_version ";"
41
42/* Chip name handling */
43.BI "int sensors_parse_chip_name(const char *" orig_name ","
44.BI "                            sensors_chip_name *" res ");"
45.BI "const char *sensors_get_adapter_name(const sensors_bus_id *" bus ");"
46
47/* Chips and features enumeration */
48.B const sensors_chip_name *
49.BI "sensors_get_detected_chips(const sensors_chip_name *" match ","
50.BI "                           int *" nr ");"
51.B const sensors_feature *
52.BI "sensors_get_features(const sensors_chip_name *" name ","
53.BI "                     int *" nr ");"
54.B const sensors_subfeature *
55.BI "sensors_get_all_subfeatures(const sensors_chip_name *" name ","
56.BI "                            const sensors_feature *" feature ","
57.BI "                            int *" nr ");"
58.B const sensors_subfeature *
59.BI "sensors_get_subfeature(const sensors_chip_name *" name ","
60.BI "                       const sensors_feature *" feature ","
61.BI "                       sensors_subfeature_type " type ");"
62
63/* Features access */
64.BI "char *sensors_get_label(const sensors_chip_name *" name ","
65.BI "                        const sensors_feature *" feature ");"
66.BI "int sensors_get_value(const sensors_chip_name *" name ", int " subfeat_nr ","
67.BI "                      double *" value ");"
68.BI "int sensors_set_value(const sensors_chip_name *" name ", int " subfeat_nr ","
69.BI "                      double " value ");"
70.BI "int sensors_do_chip_sets(const sensors_chip_name *" name ");"
71.fi
72
73.SH DESCRIPTION
74.B int sensors_init(FILE *input);
75.br
76Load the configuration file and the detected chips list. If this returns a
77value unequal to zero, you are in trouble; you can not assume anything will
78be initialized properly. If you want to reload the configuration file, call
79sensors_cleanup() below before calling sensors_init() again.
80
81If FILE is NULL, the default configuration files are used (see the FILES
82section below). Most applications will want to do that.
83
84.B void sensors_cleanup(void);
85.br
86Clean-up function: You can't access anything after this, until the next sensors_init() call!
87.br
88
89\fBint sensors_parse_chip_name(const char *orig_name,
90                            sensors_chip_name *res);\fP
91.br
92Parse a chip name to the internal representation. Return 0 on succes, <0 on error.
93
94.B const char *sensors_get_adapter_name(int bus_nr);
95.br
96This function returns the adapter name of a bus number, as used within the
97sensors_chip_name structure. If it could not be found, it returns NULL.
98
99\fBchar *sensors_get_label(const sensors_chip_name *name, const sensors_feature *feature);\fP
100.br
101Look up the label which belongs to this chip. Note that chip should not
102contain wildcard values! The returned string is newly allocated (free it
103yourself). On failure, NULL is returned.
104If no label exists for this feature, its name is returned itself.
105
106\fBint sensors_get_value(const sensors_chip_name *name, int subfeat_nr, double *value);\fP
107.br
108Read the value of a subfeature of a certain chip. Note that chip should not
109contain wildcard values! This function will return 0 on success, and <0 on
110failure.
111
112\fBint sensors_set_value(const sensors_chip_name *name, int subfeat_nr, double value);\fP
113.br
114Set the value of a subfeature of a certain chip. Note that chip should not
115contain wildcard values! This function will return 0 on success, and <0 on
116failure.
117
118.B int sensors_do_chip_sets(const sensors_chip_name *name);
119.br
120Execute all set statements for this particular chip. The chip may contain wildcards!  This function will return 0 on success, and <0 on failure.
121
122\fBconst sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name
123                                                    *match, int *nr);\fP
124.br
125This function returns all detected chips that match a given chip name,
126one by one. If no chip name is provided, all detected chips are returned.
127To start at the beginning of the list, use 0 for nr; NULL is returned if
128we are at the end of the list. Do not try to change these chip names, as
129they point to internal structures!
130
131This structure contains information related to a given feature of a
132specific chip.
133.br
134\fBtypedef struct sensors_feature {
135.br
136  const char *name;
137.br
138  int number;
139.br
140  sensors_feature_type type;
141.br
142} sensors_feature;\fP
143.br
144There are other member not documented here, which are only meant for libsensors
145internal use.
146
147This structure contains information related to a given subfeature of a
148specific chip feature.
149.br
150\fBtypedef struct sensors_subfeature {
151.br
152  const char *name;
153.br
154  int number;
155.br
156  sensors_subfeature_type type;
157.br
158  int mapping;
159.br
160  unsigned int flags;
161.br
162} sensors_subfeature;\fP
163.br
164The flags field is a bitfield, its value is a combination of
165SENSORS_MODE_R (readable), SENSORS_MODE_W (writable) and SENSORS_COMPUTE_MAPPING
166(affected by the computation rules of the main feature).
167
168\fBconst sensors_feature *sensors_get_features(const sensors_chip_name *name, int *nr);\fP
169.br
170This returns all main features of a specific chip. nr is an internally
171used variable. Set it to zero to start at the begin of the list. If no
172more features are found NULL is returned.
173Do not try to change the returned structure; you will corrupt internal
174data structures.
175
176\fBconst sensors_subfeature *sensors_get_all_subfeatures(const sensors_chip_name *name, const sensors_feature *feature, int *nr);\fP
177.br
178This returns all subfeatures of a given main feature. nr is an internally
179used variable. Set it to zero to start at the begin of the list. If no
180more subfeatures are found NULL is returned.
181Do not try to change the returned structure; you will corrupt internal
182data structures.
183
184\fBconst sensors_subfeature *sensors_get_subfeature(const sensors_chip_name *name, const sensors_feature *feature, sensors_subfeature_type type);\fP
185.br
186This returns the subfeature of the given type for a given main feature,
187if it exists, NULL otherwise.
188Do not try to change the returned structure; you will corrupt internal
189data structures.
190
191\fBconst char *libsensors_version;\fP
192.br
193A string representing the version of libsensors.
194
195.SH FILES
196.I /etc/sensors3.conf
197.br
198.I /etc/sensors.conf
199.RS
200The system-wide
201.BR libsensors (3)
202configuration file. /etc/sensors3.conf is tried first, and if it doesn't exist,
203/etc/sensors.conf is used instead.
204.RE
205
206.I /etc/sensors.d
207.RS
208A directory where you can put additional libsensors configuration files.
209Files found in this directory will be processed in alphabetical order after
210the default configuration file. Files with names that start with a dot are
211ignored.
212.RE
213
214.SH SEE ALSO
215sensors.conf(5)
216
217.SH AUTHOR
218Frodo Looijaard and the lm_sensors group
219http://www.lm-sensors.org/
220
Note: See TracBrowser for help on using the browser.