2009-02-15 17:22:38 +00:00
|
|
|
.\" Copyright (C) 1998, 1999 Adrian Baugh <adrian.baugh@keble.ox.ac.uk>
|
|
|
|
.\" Copyright (C) 2007, 2009 Jean Delvare <khali@linux-fr.org>
|
1999-02-08 19:57:30 +00:00
|
|
|
.\" based on sensors.h, part of libsensors by Frodo Looijaard
|
|
|
|
.\" libsensors is distributed under the GPL
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to make and distribute verbatim copies of this
|
|
|
|
.\" manual provided the copyright notice and this permission notice are
|
|
|
|
.\" preserved on all copies.
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to copy and distribute modified versions of this
|
|
|
|
.\" manual under the conditions for verbatim copying, provided that the
|
|
|
|
.\" entire resulting derived work is distributed under the terms of a
|
|
|
|
.\" permission notice identical to this one
|
|
|
|
.\"
|
|
|
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
|
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
|
|
.\" responsibility for errors or omissions, or for damages resulting from
|
|
|
|
.\" the use of the information contained herein. The author(s) may not
|
|
|
|
.\" have taken the same level of care in the production of this manual,
|
|
|
|
.\" which is licensed free of charge, as they might when working
|
|
|
|
.\" professionally.
|
|
|
|
.\"
|
|
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
|
|
|
.\"
|
|
|
|
.\" References consulted:
|
|
|
|
.\" libsensors source code
|
2009-02-15 17:22:38 +00:00
|
|
|
.TH libsensors 3 "February 2009" "lm-sensors 3" "Linux Programmer's Manual"
|
2009-02-15 20:42:43 +00:00
|
|
|
|
1999-02-08 19:57:30 +00:00
|
|
|
.SH NAME
|
2006-10-13 19:55:41 +00:00
|
|
|
libsensors \- publicly accessible functions provided by the sensors library
|
2009-02-15 20:42:43 +00:00
|
|
|
|
1999-02-08 19:57:30 +00:00
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
2004-03-20 18:41:50 +00:00
|
|
|
.B #include <sensors/sensors.h>
|
1999-02-08 19:57:30 +00:00
|
|
|
|
2009-02-15 20:42:43 +00:00
|
|
|
/* Library initialization and clean-up */
|
|
|
|
.BI "int sensors_init(FILE *" input ");"
|
1999-02-08 19:57:30 +00:00
|
|
|
.B void sensors_cleanup(void);
|
2009-02-15 20:42:43 +00:00
|
|
|
.BI "const char *" libsensors_version ";"
|
|
|
|
|
|
|
|
/* Chip name handling */
|
|
|
|
.BI "int sensors_parse_chip_name(const char *" orig_name ","
|
|
|
|
.BI " sensors_chip_name *" res ");"
|
|
|
|
.BI "const char *sensors_get_adapter_name(const sensors_bus_id *" bus ");"
|
|
|
|
|
|
|
|
/* Chips and features enumeration */
|
|
|
|
.B const sensors_chip_name *
|
|
|
|
.BI "sensors_get_detected_chips(const sensors_chip_name *" match ","
|
|
|
|
.BI " int *" nr ");"
|
|
|
|
.B const sensors_feature *
|
|
|
|
.BI "sensors_get_features(const sensors_chip_name *" name ","
|
|
|
|
.BI " int *" nr ");"
|
|
|
|
.B const sensors_subfeature *
|
|
|
|
.BI "sensors_get_all_subfeatures(const sensors_chip_name *" name ","
|
|
|
|
.BI " const sensors_feature *" feature ","
|
|
|
|
.BI " int *" nr ");"
|
|
|
|
.B const sensors_subfeature *
|
|
|
|
.BI "sensors_get_subfeature(const sensors_chip_name *" name ","
|
|
|
|
.BI " const sensors_feature *" feature ","
|
|
|
|
.BI " sensors_subfeature_type " type ");"
|
|
|
|
|
|
|
|
/* Features access */
|
|
|
|
.BI "char *sensors_get_label(const sensors_chip_name *" name ","
|
|
|
|
.BI " const sensors_feature *" feature ");"
|
|
|
|
.BI "int sensors_get_value(const sensors_chip_name *" name ", int " subfeat_nr ","
|
|
|
|
.BI " double *" value ");"
|
|
|
|
.BI "int sensors_set_value(const sensors_chip_name *" name ", int " subfeat_nr ","
|
|
|
|
.BI " double " value ");"
|
|
|
|
.BI "int sensors_do_chip_sets(const sensors_chip_name *" name ");"
|
1999-02-08 19:57:30 +00:00
|
|
|
.fi
|
2009-02-15 20:42:43 +00:00
|
|
|
|
1999-02-08 19:57:30 +00:00
|
|
|
.SH DESCRIPTION
|
|
|
|
.B int sensors_init(FILE *input);
|
|
|
|
.br
|
2007-08-22 17:04:12 +00:00
|
|
|
Load the configuration file and the detected chips list. If this returns a
|
|
|
|
value unequal to zero, you are in trouble; you can not assume anything will
|
|
|
|
be initialized properly. If you want to reload the configuration file, call
|
|
|
|
sensors_cleanup() below before calling sensors_init() again.
|
1999-02-08 19:57:30 +00:00
|
|
|
|
2009-02-15 17:22:38 +00:00
|
|
|
If FILE is NULL, the default configuration files are used (see the FILES
|
2007-10-25 09:48:18 +00:00
|
|
|
section below). Most applications will want to do that.
|
|
|
|
|
1999-02-08 19:57:30 +00:00
|
|
|
.B void sensors_cleanup(void);
|
|
|
|
.br
|
2003-11-23 21:26:37 +00:00
|
|
|
Clean-up function: You can't access anything after this, until the next sensors_init() call!
|
1999-02-08 19:57:30 +00:00
|
|
|
.br
|
|
|
|
|
|
|
|
\fBint sensors_parse_chip_name(const char *orig_name,
|
|
|
|
sensors_chip_name *res);\fP
|
|
|
|
.br
|
|
|
|
Parse a chip name to the internal representation. Return 0 on succes, <0 on error.
|
|
|
|
|
|
|
|
.B const char *sensors_get_adapter_name(int bus_nr);
|
|
|
|
.br
|
2006-10-13 19:55:41 +00:00
|
|
|
This function returns the adapter name of a bus number, as used within the
|
|
|
|
sensors_chip_name structure. If it could not be found, it returns NULL.
|
|
|
|
|
2007-09-23 12:05:16 +00:00
|
|
|
\fBchar *sensors_get_label(const sensors_chip_name *name, const sensors_feature *feature);\fP
|
1999-02-08 19:57:30 +00:00
|
|
|
.br
|
2007-08-22 17:05:01 +00:00
|
|
|
Look up the label which belongs to this chip. Note that chip should not
|
|
|
|
contain wildcard values! The returned string is newly allocated (free it
|
|
|
|
yourself). On failure, NULL is returned.
|
|
|
|
If no label exists for this feature, its name is returned itself.
|
1999-02-08 19:57:30 +00:00
|
|
|
|
2007-09-23 12:07:53 +00:00
|
|
|
\fBint sensors_get_value(const sensors_chip_name *name, int subfeat_nr, double *value);\fP
|
1999-02-08 19:57:30 +00:00
|
|
|
.br
|
2007-09-23 12:07:53 +00:00
|
|
|
Read the value of a subfeature of a certain chip. Note that chip should not
|
|
|
|
contain wildcard values! This function will return 0 on success, and <0 on
|
|
|
|
failure.
|
1999-02-08 19:57:30 +00:00
|
|
|
|
2007-09-23 12:07:53 +00:00
|
|
|
\fBint sensors_set_value(const sensors_chip_name *name, int subfeat_nr, double value);\fP
|
1999-02-08 19:57:30 +00:00
|
|
|
.br
|
2007-09-23 12:07:53 +00:00
|
|
|
Set the value of a subfeature of a certain chip. Note that chip should not
|
|
|
|
contain wildcard values! This function will return 0 on success, and <0 on
|
|
|
|
failure.
|
1999-02-08 19:57:30 +00:00
|
|
|
|
2007-08-13 20:16:03 +00:00
|
|
|
.B int sensors_do_chip_sets(const sensors_chip_name *name);
|
1999-02-08 19:57:30 +00:00
|
|
|
.br
|
|
|
|
Execute all set statements for this particular chip. The chip may contain wildcards! This function will return 0 on success, and <0 on failure.
|
|
|
|
|
2007-08-26 08:26:20 +00:00
|
|
|
\fBconst sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name
|
|
|
|
*match, int *nr);\fP
|
1999-02-08 19:57:30 +00:00
|
|
|
.br
|
2007-08-26 08:26:20 +00:00
|
|
|
This function returns all detected chips that match a given chip name,
|
|
|
|
one by one. If no chip name is provided, all detected chips are returned.
|
|
|
|
To start at the beginning of the list, use 0 for nr; NULL is returned if
|
|
|
|
we are at the end of the list. Do not try to change these chip names, as
|
|
|
|
they point to internal structures!
|
1999-02-08 19:57:30 +00:00
|
|
|
|
2007-09-23 18:00:20 +00:00
|
|
|
This structure contains information related to a given feature of a
|
2007-09-23 12:02:22 +00:00
|
|
|
specific chip.
|
1999-02-08 19:57:30 +00:00
|
|
|
.br
|
2007-09-23 18:00:20 +00:00
|
|
|
\fBtypedef struct sensors_feature {
|
1999-02-08 19:57:30 +00:00
|
|
|
.br
|
|
|
|
const char *name;
|
2007-08-30 21:23:22 +00:00
|
|
|
.br
|
|
|
|
int number;
|
2007-07-19 20:46:09 +00:00
|
|
|
.br
|
|
|
|
sensors_feature_type type;
|
2007-09-23 18:00:20 +00:00
|
|
|
.br
|
|
|
|
} sensors_feature;\fP
|
|
|
|
.br
|
|
|
|
There are other member not documented here, which are only meant for libsensors
|
|
|
|
internal use.
|
|
|
|
|
|
|
|
This structure contains information related to a given subfeature of a
|
|
|
|
specific chip feature.
|
|
|
|
.br
|
|
|
|
\fBtypedef struct sensors_subfeature {
|
|
|
|
.br
|
|
|
|
const char *name;
|
|
|
|
.br
|
|
|
|
int number;
|
|
|
|
.br
|
|
|
|
sensors_subfeature_type type;
|
1999-02-08 19:57:30 +00:00
|
|
|
.br
|
|
|
|
int mapping;
|
|
|
|
.br
|
2007-09-05 08:13:15 +00:00
|
|
|
unsigned int flags;
|
1999-02-08 19:57:30 +00:00
|
|
|
.br
|
2007-09-23 12:02:22 +00:00
|
|
|
} sensors_subfeature;\fP
|
1999-02-08 19:57:30 +00:00
|
|
|
.br
|
2007-09-05 08:13:15 +00:00
|
|
|
The flags field is a bitfield, its value is a combination of
|
2007-09-05 08:17:22 +00:00
|
|
|
SENSORS_MODE_R (readable), SENSORS_MODE_W (writable) and SENSORS_COMPUTE_MAPPING
|
|
|
|
(affected by the computation rules of the main feature).
|
1999-02-08 19:57:30 +00:00
|
|
|
|
2007-09-23 12:05:16 +00:00
|
|
|
\fBconst sensors_feature *sensors_get_features(const sensors_chip_name *name, int *nr);\fP
|
2007-07-24 08:19:59 +00:00
|
|
|
.br
|
2007-09-23 12:00:59 +00:00
|
|
|
This returns all main features of a specific chip. nr is an internally
|
|
|
|
used variable. Set it to zero to start at the begin of the list. If no
|
|
|
|
more features are found NULL is returned.
|
|
|
|
Do not try to change the returned structure; you will corrupt internal
|
|
|
|
data structures.
|
|
|
|
|
2007-09-23 12:05:16 +00:00
|
|
|
\fBconst sensors_subfeature *sensors_get_all_subfeatures(const sensors_chip_name *name, const sensors_feature *feature, int *nr);\fP
|
2007-09-23 12:00:59 +00:00
|
|
|
.br
|
2007-09-23 12:16:50 +00:00
|
|
|
This returns all subfeatures of a given main feature. nr is an internally
|
|
|
|
used variable. Set it to zero to start at the begin of the list. If no
|
|
|
|
more subfeatures are found NULL is returned.
|
2007-09-23 12:00:59 +00:00
|
|
|
Do not try to change the returned structure; you will corrupt internal
|
|
|
|
data structures.
|
1999-02-08 19:57:30 +00:00
|
|
|
|
2007-09-23 12:30:28 +00:00
|
|
|
\fBconst sensors_subfeature *sensors_get_subfeature(const sensors_chip_name *name, const sensors_feature *feature, sensors_subfeature_type type);\fP
|
|
|
|
.br
|
|
|
|
This returns the subfeature of the given type for a given main feature,
|
|
|
|
if it exists, NULL otherwise.
|
|
|
|
Do not try to change the returned structure; you will corrupt internal
|
|
|
|
data structures.
|
|
|
|
|
2007-07-10 19:55:06 +00:00
|
|
|
\fBconst char *libsensors_version;\fP
|
|
|
|
.br
|
|
|
|
A string representing the version of libsensors.
|
|
|
|
|
2007-10-25 09:48:18 +00:00
|
|
|
.SH FILES
|
2007-10-25 09:59:05 +00:00
|
|
|
.I /etc/sensors3.conf
|
|
|
|
.br
|
2007-10-25 09:48:18 +00:00
|
|
|
.I /etc/sensors.conf
|
|
|
|
.RS
|
|
|
|
The system-wide
|
|
|
|
.BR libsensors (3)
|
2007-10-25 09:59:05 +00:00
|
|
|
configuration file. /etc/sensors3.conf is tried first, and if it doesn't exist,
|
|
|
|
/etc/sensors.conf is used instead.
|
2009-02-15 17:22:38 +00:00
|
|
|
.RE
|
|
|
|
|
|
|
|
.I /etc/sensors.d
|
|
|
|
.RS
|
|
|
|
A directory where you can put additional libsensors configuration files.
|
|
|
|
Files found in this directory will be processed in alphabetical order after
|
|
|
|
the default configuration file. Files with names that start with a dot are
|
|
|
|
ignored.
|
|
|
|
.RE
|
2007-10-25 09:48:18 +00:00
|
|
|
|
1999-02-08 19:57:30 +00:00
|
|
|
.SH SEE ALSO
|
|
|
|
sensors.conf(5)
|
|
|
|
|
2004-04-20 01:25:22 +00:00
|
|
|
.SH AUTHOR
|
|
|
|
Frodo Looijaard and the lm_sensors group
|
2006-09-17 21:01:35 +00:00
|
|
|
http://www.lm-sensors.org/
|
1999-02-08 19:57:30 +00:00
|
|
|
|