wiki:plugin_i2c_sensors

I2C Sensors plugin

This plugin provides an interface to the I2C Sensors system.


Overview

This plugin is able to retreive informations from the I2C Sensors system, using the procfs or the sysfs interface depending on what's available on your system. In general, you'll want to use the old procfs interface on 2.4 kernel (as sysfs isn't suported) and the new sysfs on 2.6 kernels (although you can still use the procfs interface if the plugin can't find the sensors within sysfs).


How it works

First, you should read /usr/src/linux/Documentation/i2c/sysfs-interface (on 2.6 kernels) or (lm_sensors official website ?) to learn more about lm_sensors and how it works. Your mainboard is full of sensors measuring temperatures, voltages, fan speed, and other. I2C Sensors modules get theses informations and make them available in :

  • /proc/sys/dev/sensors/[sensor name] for the procfs interface (deprecated)
  • /sys/bus/i2c/devices/[i2c bus identifier] for the sysfs interface

This plugin supplies a transparent interface for both methods so that the same configuration works in (mostly) all cases. In fact, available tokens correspond to single files via the sysfs interface. The procfs method emulates the sysfs files from the few available ones in /proc/sys/dev/sensors/...


Configuration Parameters

If you get error messages like i2c_sensors: unable to autodetect i2c sensors! then your system may not use the standard paths mentioned above. You can direct i2c_sensors to the right path by adding the parameter "i2c_sensors-path '/path/to/your/i2c/devices'" right before widget configuration in lcd4linux.conf. For example on Ubuntu 8.04 it should be "i2c_sensors-path '/sys/class/hwmon/hwmon0/device/'".


Functions

i2c_sensors(key)return the value of sensor <key> if available

The following keys are valid: (# represents an integer from 1 to 3 (or maybe more)

temp#_inputtemperature of sensor # (in °C)
temp_max# and temp_hyst#max and min of sensor #
in_input#voltages
in_min# and in_max#voltages limits
fan_input#speed (in RPM) of fan #
fan_min#minimum speed of fan #
fan_div#speed divider for fan #

Tokens avaible only via sysfs if suported by your sensors:

curr_input#value of currents (in amps)
curr_min# and curr_max#limits
pwm#value of pulse width modulation for fans
temp_crit#critical value of sensor #
vidcpu core voltage
and maybe others ...see /usr/src/linux/Documentation/i2c/sysfs-interface on linux 2.6

Example

Widget Temp {
    class      'Text'
    expression  i2c_sensors('temp3_input')*1.0324-67
    prefix     'Temp'
    width       9
    precision   1
    align      'R'
    update      500
}

Widget TempBar {
    class      'Bar'
    expression  i2c_sensors('temp3_input')*1.0324-67
    min         40
    max         80
    length      10
    direction  'E'
    update      200
}

Last modified 10 years ago Last modified on 07/08/09 12:43:05