| 1 | This package consists of many parts. This document offers a small tour |
|---|
| 2 | around the most important pieces. Not all aspects are discussed |
|---|
| 3 | exhaustively, but it should be enough to give you the feeling you |
|---|
| 4 | understand what you are seeing happen. |
|---|
| 5 | |
|---|
| 6 | When you want to communicate with a piece of hardware, you need a kernel |
|---|
| 7 | driver (well, that is not quite true, but it is in most cases the only |
|---|
| 8 | way to do it safely). In the past, this meant you had to patch the kernel |
|---|
| 9 | and recompile it. These days, you can use kernel modules. We support both |
|---|
| 10 | approaches. |
|---|
| 11 | |
|---|
| 12 | We have chooses for a very modular (no pun intended) setup. There are a |
|---|
| 13 | few general-purpose base kernel modules, which you always need. In |
|---|
| 14 | addition, there is one kernel module for each piece of hardware - whether |
|---|
| 15 | this is an I2C bus adapter, an SMBus adapter or a sensors chip. |
|---|
| 16 | |
|---|
| 17 | The kernel modules communicate their information through both the /proc |
|---|
| 18 | and sysctl interfaces (Linux 2.4) or the /sys interface (Linux 2.6). To |
|---|
| 19 | keep things uncomplicated, the sensor chips always advert their |
|---|
| 20 | measurements 'as is'. This means that the values they report are not |
|---|
| 21 | immediately relevant to you - they must first be scaled and translated |
|---|
| 22 | to correspond to the real world. |
|---|
| 23 | |
|---|
| 24 | It is also possible to communicate directly with chips on an I2C bus |
|---|
| 25 | or SMBus. This is done through /dev files. This is useful if you |
|---|
| 26 | quickly want to test how a certain chip behaves, without having to |
|---|
| 27 | write a kernel driver. |
|---|
| 28 | |
|---|
| 29 | Note that all other parts of this package function in so-called user-space. |
|---|
| 30 | This is important, because bugs in kernel-space might crash your |
|---|
| 31 | computer or do other bad things. And kernel memory can not be swapped out! |
|---|
| 32 | |
|---|
| 33 | Applications could (and can) directly read the sensor values through the |
|---|
| 34 | /proc, sysctl or /sys interfaces. This is harder than it sounds; because |
|---|
| 35 | no two chips are the same, the information they communicate may also |
|---|
| 36 | be very unlike. This would mean that every application would have to know |
|---|
| 37 | about every type of chip. But there is a better solution. |
|---|
| 38 | |
|---|
| 39 | libsensors is a (shared or static) library of access functions. It |
|---|
| 40 | knows about every type of chip supported by the kernel modules (or it |
|---|
| 41 | should, if it is up-to-date). It offers a simple-to-use interface for |
|---|
| 42 | applications to access the sensor chip readings, to set new limits, |
|---|
| 43 | and all other commonly needed things. From the application's point of |
|---|
| 44 | view, there is no need to know very much about a specific sensors chip. |
|---|
| 45 | Having some inside information can still be useful, but it is possible to |
|---|
| 46 | write a generic fall-back function that takes care of newer, unknown |
|---|
| 47 | chips, and to display all really important information. |
|---|
| 48 | |
|---|
| 49 | libsensors takes care of one other thing. The kernel modules report |
|---|
| 50 | so-called 'as is' values. They have to be scaled or translated to be |
|---|
| 51 | relevant in the real world. libsensors reads a configuration file |
|---|
| 52 | (usually /etc/sensors.conf) which specifies how this translation should |
|---|
| 53 | be done (with some other things). Again, the application does not have |
|---|
| 54 | to know about it. And because the configuration file is reread each time |
|---|
| 55 | a new application is started, you can change configuration values without |
|---|
| 56 | having to recompile anything. |
|---|
| 57 | |
|---|
| 58 | This package does not contain a nice graphical monitor. Look at the file |
|---|
| 59 | doc/useful_addresses.html for pointers to such programs. It does contain |
|---|
| 60 | an example console program that reports all current sensors values. This |
|---|
| 61 | program is called 'sensors'. You can use it as a reference implementation |
|---|
| 62 | for more intricate programs. |
|---|
| 63 | |
|---|
| 64 | There are many, many kernel modules in this package, and there are lots |
|---|
| 65 | of different sensor chips supported. Sometimes, it can be hard to |
|---|
| 66 | determine what chips and adapters you have, and which modules correspond |
|---|
| 67 | to them. Fortunately, there is a user-space application 'sensors-detect' |
|---|
| 68 | that should tell you exactly what is available, and what you need to |
|---|
| 69 | do. This perl script uses the /dev interface, and you may use it as an |
|---|
| 70 | example how you can do this. |
|---|