# # # Current versions of this micro-HowTo available from: # --------------------------------------------------- # http://www.Linux-1u.net/LCD/lm_sensors.Txt/i2c_lmsensors.uHowTo.txt # # # Other Similar Docs # ------------------ # http://www2.lm-sensors.nu/~lm78/cvs/lm_sensors2/doc/FAQ # http://www2.lm-sensors.nu/~lm78/cvs/lm_sensors2/QUICKSTART # http://www2.lm-sensors.nu/~lm78/cvs/lm_sensors2/doc/useful_addresses.html # # http://hints.linuxfromscratch.org/hints/lm_sensors.txt # http://people.redhat.com/harald/snmp-lmsensors/HOWTO-SENSORS-SNMPD.html # http://www.ibiblio.org/pub/Linux/docs/HOWTO/K7s5a-HOWTO # http://www.tldp.org/HOWTO/K7s5a-HOWTO-3.html # http://www.antbear.org/linux24_lm_sensors.html ( german ) # # " init.d/sensors stop ; init.d/sensors start " # http://www2.lm-sensors.nu/~lm78/cvs/browse.cgi/lm_sensors2/prog/init/sensors # # - working demo of all parameters # http://landau.mines.edu/cgi-bin/sensors # # # Contributed by: # Ray Olszewski ray@comarre.com,ray@Linux-Consulting.com # Alvin Oga alvin@linux-Consulting.com # # 06-May-00 rxo Author of lm_sensor uhow2 # Tested on Debian potato ( debian-2.2 ) - linux-2.2.15 # # 06-May-00 amo Tested on redhat-6.2 - linux-2.2.14 # 13-May-00 rxo Tested on suse-6.3, slack-7 - linux-2.2.14 # 19-May-00 amo Tested on suse-6.4 - linux-2.2.14 # Clean up documentation # 06-Jul-00 amo Tested documentation on SuperMicro - redhat-6.2 - linux-2.2.14 # # Latest version is i2c-2.5.1.tar.gz and lm_sensors-2.5.1.tar.gz # ( but only for linux-2.4.x kernels ??? # 09-Nov-01 amo Tested with linux-2.2.20 + *.2.6.1 # 20-May-02 amo Changed from netroedge.com to lm-sensors.nu for *.2.6.3 # # NOTE: The i2c package contains the older isa-bus kernel modules needed for sensor use. The lm_sensors package contains the newer isa-bus modules, some SMBus modules, and userspace utilities needed to probe for sensors and, if our custom perl program is not used, to access and interpret the data put by the sensors modules in /proc . In order to compile and install the i2c and lm-sensors packages on your Linux system, it needs to be running a 2.2.x kernel. Older versions of i2c and lm-sensors do support 2.0.x kernels, but this HowTo does not cover procedures for installing them. The system also needs to have the following: A. a copy of the source tree for the running kernel, symlinked to /usr/src/linux B. gcc and its usual support files C. bison and flex (for lm-sensors) Procedures for installing these packages are somewhat distribution specific, so follow the procedures appropriate for the distribution you are using. Once you have the necessary packages installed, you follow this procedure. 0. Reference URLs: http://www.linux-1U.net/LCD/i2c_lm_sensors.uHowTO.txt 1. Download the lm_sensors and i2c tarballs from http://www2.lm-sensors.nu/~lm78/ ##tp://www.netroedge.com/~lm78/download.html-- obsolete For 2.2.x kernels: lm_sensors-2.6.3.tar.gz i2c-2.6.3.tar.gz For 2.4.x kernels: lm_sensors-2.6.3.tar.gz Download the files into whatever directory you find convenient. I assume here that you use /usr/local/src . 2. Untar the tarballs as follows: root# cd /usr/local/src root# tar zxvfp lm_sensors-2.6.3.tar.gz root# tar zxvfp i2c-2.6.3.tar.gz 3. Install the i2c package. The package includes an INSTALL file that describes three methods of installing the package. The default method a assumed in the Makefile is simple and works on all systems we have tested. In all cases we tested, the Makefile itself needed no edits, though that might vary for some distributions. Then do a standard series of "make" commands, as below. - - if you change to a different kernel, - you must recompile and re-install these module - - use i2c-dev as modules ?? root# cd /usr/local/src/i2c-2.6.3 root# make clean <<<--- important root# make dep root# make all root# make install note: make install uses "grep UTS_RELEASE .../version.h" it should be installing its modules into /lib/modules//extra/misc root# ls -la /lib/modules/`uname -r`/misc/i2c* 4. Install the lm_sensors package. The package includes an INSTALL file that describes three methods of installing the package. The default method assumed in the Makefile is simple and works on all systems we have tested. In all cases we tested, the Makefile itself needed no edits, though that might vary for some distributions. (It does require bison and flex to make.) Then do a standard series of "make" commands, as below. - - if you change to a different kernel, - you must recompile and re-install these module - - use i2c-dev as modules ?? root# cd /usr/local/src/lm_sensors-2.6.3 root# make clean <<<--- important root# make dep root# make all root# make install note: make install uses "grep UTS_RELEASE .../version.h" it should be installing its modules into /lib/modules//extra/misc root# ls -la /lib/modules/`uname -r`/misc/lm* ... Be warned that the system does not install reliably. On one system, libsensors was installed into /usr/local/lib, where it was not detected. Adding a symlink to /usr/lib solved this problem. Often, some of the userspace utility programs did not properly install into their final directories and had to be moved to convenient locations (typically /usr/local/bin) by hand. 5. Run "depmod" to update module dependencies. Depending on which linux distribution you use, your modules are defined in /etc/modules.conf or /etc/conf.modules or ... root# vi /etc/modules.conf # path=/lib/modules//extra path[misc]=/lib/modules/`uname -r`/misc path[i2c]=/lib/modules/`uname -r`/drivers/fs/i2c root# /sbin/depmod -a root# vi /etc/ld.so.conf # add lm_sensor stuff /usr/local/lib root# ldconfig 6. Run ./lm-sensors-2.6.3/prog/mkdev/mkdev.sh to create the /dev entries needed to access the SMBus devices. root# cd /usr/local/src/lm_sensors-2.6.3 root# ./prog/mkdev/mkdev.sh root# ls -l /dev/i2c-* -- lists lots of devices 7. Run ./lm-sensors-2.6.3/prog/detect/sensors-detect to probe for the sensors on the system. Its results will vary (of course) depending on the actual hardware in your system. If it completes properly, it will provide a set of "modprobe" entries for you to add to the appropriate boot/init script on your system (see #8 below). root# ./lm-sensors-2.6.3/prog/detect/sensors-detect # # if you get this error .. # Couldn't open /proc/bus/i2c?!? at ./prog/detect/sensors-detect line 2735, chunk 8. # # than fix it by.. # In some cases, we found that the program failed before reaching the step of listing the needed "modprobe" lines, due to a problem interpreting a dummy entry used in the program. If you have this experience too, edit line 734 of the sensors-detect program (a perl program) to replace the string "?????" with "XXXXX". 8. Add the modules identified by sensors-detect to the boot/init script or file used by your system to add modules. In the examples we tested, the appropriate locations were: Debian--2.2 /etc/modules Red Hat-6.2 /etc.rc.d/rc.local Slackware-7.0 /etc/rc.d/rc.modules SuSE-6.4 /sbin/init.d/boot.local # # the drivers and modules are loaded here # /lib/modules/`uname -r`/misc The drivers you will need vary based on the chips used on the motherboard: ( you should put this into your "rc.local" bootup files.... SuperMicro 370SEA modprobe i2c-isa modprobe w83781d Intel CA810EAL no temp sensors ??? Asus Super810 modprobe i2c-isa modprobe w83781d Tyan Tomcat i810 Asus A7K266N w/ 2.4.18 alias char-major-89 i2c-dev i2c-dev i2c-core.o i2c-proc.o i2c-dev.o -- dies i2c-elektor.o - dies i2c-algo-pcf.o i2c-algo-bit.o 9. Reboot the system to test your modified boot/init script, or run the appropriate "modprobe" commands bvy hand from the command line. root# modprobe i2c-isa root# modprobe w83781d # # See what we can read # root# sensors 10. At this point, you should have a pseudo-file /etc/bus/i2c that lists the i2c devices found, and a directory in /proc/sys/dev/sensors named after the CHIP type listed in /proc/bus/i2c . This last directory will contain a pseudo-file entry for each sensor line supported by the chip (whether or not that line reports valid data). 11. Access the data using the tools provided by the lm-sensors package or my perl program (currently supporting only a few motherboards). Perl Program http://www.Linux-1U.net/LCD/record_sensors.pl Examples: To see the temperature.....and other system measures: SuperMicro cat /proc/sys/dev/sensors/w83627hf-isa-0290/temp1 temperature cat /proc/sys/dev/sensors/w83627hf-isa-0290/fan1 fan speed Asus: cat /proc/sys/dev/sensors/as99127f-i2c-0-2d/temp1 temperature cat /proc/sys/dev/sensors/as99127f-i2c-0-2d/fan1 fan speed 12. For Logging into a file the temperature and voltages sensed. from cron run the sensors_record.pl script found at htt://www.linux-1u.net/LCD root# crontab -e ... # # Record Temp and check fans every 5 minutes # 0,5,10,15,20,25,30,35,40,45,50,55 * * * * ...../LCD/sensor_record.pl # ... The data that is recorded is defined in /etc/sensors.cf You can view the temperature and fan speeds, etc of the system: http://www.Linux-1U.net/Monitor.Sensors/ #--------------------------------------------- # Version History: # # 2000-May-06 RO Created lm_sensor uhow2 # 2000-May-06 RO Tested on -- # Debian potato (2.2) kernel 2.2.15 ASUS MEW motherboard # # 06-May-00 amo Tested on -- # redhat-6.2 linux-2.2.14 ??? motherboard # # 2000-May-13 RO Tested on -- # Red Hat 6.2 kernel 2.2.14 ASUS MEW motherboard # Slackware 7.0 kernel 2.2.15 ASUS MEW motherboard # SuSE 6.3 kernel 2.2.14 ASUS MEW motherrboard # # # ----- END OF DOCUMENT-----------------------