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

Revision 5652, 7.4 KB (checked in by khali, 4 years ago)

Reorder description section to match synopsis order. Move structure
definitions to their own subsection.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
RevLine 
[5647]1.\" Copyright (C) 1998, 1999  Adrian Baugh <adrian.baugh@keble.ox.ac.uk>
2.\" Copyright (C) 2007, 2009  Jean Delvare <khali@linux-fr.org>
[205]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
[5647]28.TH libsensors 3  "February 2009" "lm-sensors 3" "Linux Programmer's Manual"
[5650]29
[205]30.SH NAME
[4208]31libsensors \- publicly accessible functions provided by the sensors library
[5650]32
[205]33.SH SYNOPSIS
34.nf
[2378]35.B #include <sensors/sensors.h>
[205]36
[5650]37/* Library initialization and clean-up */
38.BI "int sensors_init(FILE *" input ");"
[205]39.B void sensors_cleanup(void);
[5650]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 ");"
[205]71.fi
[5650]72
[205]73.SH DESCRIPTION
[5651]74.B sensors_init()
75loads the configuration file and the detected chips list. If this returns a
[4693]76value unequal to zero, you are in trouble; you can not assume anything will
77be initialized properly. If you want to reload the configuration file, call
78sensors_cleanup() below before calling sensors_init() again.
[205]79
[5647]80If FILE is NULL, the default configuration files are used (see the FILES
[4985]81section below). Most applications will want to do that.
82
[5651]83.B sensors_cleanup()
84cleans everything up: you can't access anything after this, until the next sensors_init() call!
[205]85
[5652]86.B libsensors_version
87is a string representing the version of libsensors.
88
[5651]89.B sensors_parse_chip_name()
90parses a chip name to the internal representation. Return 0 on success,
91<0 on error.
[205]92
[5651]93.B sensors_get_adapter_name()
94returns the adapter name of a bus number, as used within the
[4208]95sensors_chip_name structure. If it could not be found, it returns NULL.
96
[5652]97.B sensors_get_detected_chips()
98returns all detected chips that match a given chip name,
99one by one. If no chip name is provided, all detected chips are returned.
100To start at the beginning of the list, use 0 for nr; NULL is returned if
101we are at the end of the list. Do not try to change these chip names, as
102they point to internal structures!
103
104.B sensors_get_features()
105returns all main features of a specific chip. nr is an internally
106used variable. Set it to zero to start at the begin of the list. If no
107more features are found NULL is returned.
108Do not try to change the returned structure; you will corrupt internal
109data structures.
110
111.B sensors_get_all_subfeatures()
112returns all subfeatures of a given main feature. nr is an internally
113used variable. Set it to zero to start at the begin of the list. If no
114more subfeatures are found NULL is returned.
115Do not try to change the returned structure; you will corrupt internal
116data structures.
117
118.B sensors_get_subfeature()
119returns the subfeature of the given type for a given main feature,
120if it exists, NULL otherwise.
121Do not try to change the returned structure; you will corrupt internal
122data structures.
123
[5651]124.B sensors_get_label()
125looks up the label which belongs to this chip. Note that chip should not
[4694]126contain wildcard values! The returned string is newly allocated (free it
127yourself). On failure, NULL is returned.
128If no label exists for this feature, its name is returned itself.
[205]129
[5651]130.B sensors_get_value()
131Reads the value of a subfeature of a certain chip. Note that chip should not
[4836]132contain wildcard values! This function will return 0 on success, and <0 on
133failure.
[205]134
[5651]135.B sensors_set_value()
136sets the value of a subfeature of a certain chip. Note that chip should not
[4836]137contain wildcard values! This function will return 0 on success, and <0 on
138failure.
[205]139
[5651]140.B sensors_do_chip_sets()
141executes all set statements for this particular chip. The chip may contain
142wildcards!  This function will return 0 on success, and <0 on failure.
[205]143
[5652]144.SH DATA STRUCTURES
[205]145
[5652]146Structure \fBsensors_feature\fR contains information related to a given
147feature of a specific chip:
148
[4860]149\fBtypedef struct sensors_feature {
[205]150.br
[5651]151        const char *name;
[4733]152.br
[5651]153        int number;
[205]154.br
[5651]155        sensors_feature_type type;
[4629]156.br
[4860]157} sensors_feature;\fP
158
[5652]159There are other members not documented here, which are only meant for
160libsensors internal use.
161
162Structure \fBsensors_subfeature\fR contains information related to a given
163subfeature of a specific chip feature:
164
[4860]165\fBtypedef struct sensors_subfeature {
166.br
[5651]167        const char *name;
[4860]168.br
[5651]169        int number;
[4860]170.br
[5651]171        sensors_subfeature_type type;
[4860]172.br
[5651]173        int mapping;
[205]174.br
[5651]175        unsigned int flags;
[205]176.br
[4832]177} sensors_subfeature;\fP
[5652]178
[4757]179The flags field is a bitfield, its value is a combination of
[5652]180\fBSENSORS_MODE_R\fR (readable), \fBSENSORS_MODE_W\fR (writable) and
181\fBSENSORS_COMPUTE_MAPPING\fR (affected by the computation rules of the
182main feature).
[205]183
[4985]184.SH FILES
[4990]185.I /etc/sensors3.conf
186.br
[4985]187.I /etc/sensors.conf
188.RS
189The system-wide
190.BR libsensors (3)
[4990]191configuration file. /etc/sensors3.conf is tried first, and if it doesn't exist,
192/etc/sensors.conf is used instead.
[5647]193.RE
[4985]194
[5647]195.I /etc/sensors.d
196.RS
197A directory where you can put additional libsensors configuration files.
198Files found in this directory will be processed in alphabetical order after
199the default configuration file. Files with names that start with a dot are
200ignored.
201.RE
202
[205]203.SH SEE ALSO
204sensors.conf(5)
205
[2456]206.SH AUTHOR
207Frodo Looijaard and the lm_sensors group
[4157]208http://www.lm-sensors.org/
[205]209
Note: See TracBrowser for help on using the browser.