| 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 "June 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 char *libsensors_version; |
|---|
| 50 | .fi |
|---|
| 51 | .SH DESCRIPTION |
|---|
| 52 | .B int sensors_init(FILE *input); |
|---|
| 53 | .br |
|---|
| 54 | Load the configuration file and the detected chips list. If this returns a |
|---|
| 55 | value unequal to zero, you are in trouble; you can not assume anything will |
|---|
| 56 | be initialized properly. If you want to reload the configuration file, call |
|---|
| 57 | sensors_cleanup() below before calling sensors_init() again. |
|---|
| 58 | |
|---|
| 59 | .B void sensors_cleanup(void); |
|---|
| 60 | .br |
|---|
| 61 | Clean-up function: You can't access anything after this, until the next sensors_init() call! |
|---|
| 62 | .br |
|---|
| 63 | |
|---|
| 64 | \fBint sensors_parse_chip_name(const char *orig_name, |
|---|
| 65 | sensors_chip_name *res);\fP |
|---|
| 66 | .br |
|---|
| 67 | Parse a chip name to the internal representation. Return 0 on succes, <0 on error. |
|---|
| 68 | |
|---|
| 69 | .B const char *sensors_get_adapter_name(int bus_nr); |
|---|
| 70 | .br |
|---|
| 71 | This function returns the adapter name of a bus number, as used within the |
|---|
| 72 | sensors_chip_name structure. If it could not be found, it returns NULL. |
|---|
| 73 | |
|---|
| 74 | \fBchar *sensors_get_label(const sensors_chip_name *name, const sensors_feature *feature);\fP |
|---|
| 75 | .br |
|---|
| 76 | Look up the label which belongs to this chip. Note that chip should not |
|---|
| 77 | contain wildcard values! The returned string is newly allocated (free it |
|---|
| 78 | yourself). On failure, NULL is returned. |
|---|
| 79 | If no label exists for this feature, its name is returned itself. |
|---|
| 80 | |
|---|
| 81 | \fBint sensors_get_value(const sensors_chip_name *name, int subfeat_nr, double *value);\fP |
|---|
| 82 | .br |
|---|
| 83 | Read the value of a subfeature of a certain chip. Note that chip should not |
|---|
| 84 | contain wildcard values! This function will return 0 on success, and <0 on |
|---|
| 85 | failure. |
|---|
| 86 | |
|---|
| 87 | \fBint sensors_set_value(const sensors_chip_name *name, int subfeat_nr, double value);\fP |
|---|
| 88 | .br |
|---|
| 89 | Set the value of a subfeature of a certain chip. Note that chip should not |
|---|
| 90 | contain wildcard values! This function will return 0 on success, and <0 on |
|---|
| 91 | failure. |
|---|
| 92 | |
|---|
| 93 | .B int sensors_do_chip_sets(const sensors_chip_name *name); |
|---|
| 94 | .br |
|---|
| 95 | Execute all set statements for this particular chip. The chip may contain wildcards! This function will return 0 on success, and <0 on failure. |
|---|
| 96 | |
|---|
| 97 | \fBconst sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name |
|---|
| 98 | *match, int *nr);\fP |
|---|
| 99 | .br |
|---|
| 100 | This function returns all detected chips that match a given chip name, |
|---|
| 101 | one by one. If no chip name is provided, all detected chips are returned. |
|---|
| 102 | To start at the beginning of the list, use 0 for nr; NULL is returned if |
|---|
| 103 | we are at the end of the list. Do not try to change these chip names, as |
|---|
| 104 | they point to internal structures! |
|---|
| 105 | |
|---|
| 106 | This structure contains information related to a given subfeature of a |
|---|
| 107 | specific chip. |
|---|
| 108 | .br |
|---|
| 109 | \fBtypedef struct sensors_subfeature { |
|---|
| 110 | .br |
|---|
| 111 | const char *name; |
|---|
| 112 | .br |
|---|
| 113 | int number; |
|---|
| 114 | .br |
|---|
| 115 | sensors_feature_type type; |
|---|
| 116 | .br |
|---|
| 117 | int mapping; |
|---|
| 118 | .br |
|---|
| 119 | unsigned int flags; |
|---|
| 120 | .br |
|---|
| 121 | } sensors_subfeature;\fP |
|---|
| 122 | .br |
|---|
| 123 | The flags field is a bitfield, its value is a combination of |
|---|
| 124 | SENSORS_MODE_R (readable), SENSORS_MODE_W (writable) and SENSORS_COMPUTE_MAPPING |
|---|
| 125 | (affected by the computation rules of the main feature). |
|---|
| 126 | |
|---|
| 127 | \fBconst sensors_feature *sensors_get_features(const sensors_chip_name *name, int *nr);\fP |
|---|
| 128 | .br |
|---|
| 129 | This returns all main features of a specific chip. nr is an internally |
|---|
| 130 | used variable. Set it to zero to start at the begin of the list. If no |
|---|
| 131 | more features are found NULL is returned. |
|---|
| 132 | Do not try to change the returned structure; you will corrupt internal |
|---|
| 133 | data structures. |
|---|
| 134 | |
|---|
| 135 | \fBconst sensors_subfeature *sensors_get_all_subfeatures(const sensors_chip_name *name, const sensors_feature *feature, int *nr);\fP |
|---|
| 136 | .br |
|---|
| 137 | This returns all subfeatures of a given main feature. nr is an internally |
|---|
| 138 | used variable. Set it to zero to start at the begin of the list. If no |
|---|
| 139 | more subfeatures are found NULL is returned. |
|---|
| 140 | Do not try to change the returned structure; you will corrupt internal |
|---|
| 141 | data structures. |
|---|
| 142 | |
|---|
| 143 | \fBconst char *libsensors_version;\fP |
|---|
| 144 | .br |
|---|
| 145 | A string representing the version of libsensors. |
|---|
| 146 | |
|---|
| 147 | .SH SEE ALSO |
|---|
| 148 | sensors.conf(5) |
|---|
| 149 | |
|---|
| 150 | .SH AUTHOR |
|---|
| 151 | Frodo Looijaard and the lm_sensors group |
|---|
| 152 | http://www.lm-sensors.org/ |
|---|
| 153 | |
|---|