SUSE root Logo
 
SUSEroot.com

 Home -> SUSE Linux Adventures -> lm_sensors & I2C
 
 Main Menu
 Recent Blog Posts
KDE, WTF

NetIQ Video

Treo 700p Tether with Linux

SUSE 10.2 on Dell Optiplex 320

SUSE 10.2

...the blog

 lm_sensors & I2C

lm_sensors and I2C provide access to some of the monitoring features provided by some hardware. Some motherboards provide temperature, fan, and voltage sensors on the board itself and on the processor. You don't need to mess with any of this unless you are installing some software to monitor your hardware. Kernel versions 2.6.x come with I2C functionality, SUSE 9.1 Professional (and possibly Personal) come with sensors on the CD/DVD (which provides lm_sensors). There are several software packages available that take advantage of these sensors and can provide information about some of your hardware.

MotherboardDepending on your hardware and software configuration, getting I2C, lm_sensors, and software to use the sensors working correctly can be anywhere between fairly easy and the biggest headache you'll have this week. So you'll need to decide if you're really in the mood. You also need to realize that a lot of motherboard manufacturers use obscure sensors and some use none at all. Do a Google search for "your-mobo-model lm_sensors", you'll likely find a lot of good information. A good forum thread with slightly different instructions can be found here; If you're going to use their instructions, read through the thread once before you start to get some good tips.

I'll assume you're running a 2.6.x or later kernel. If you're not, you can still use the software, but you'll need to seek instructions elsewhere; the link mentioned above is a good place to start.

Still in? Great, here we go. First, go grab a recent sensors rpm. You can find some here or compile from source downloaded from the link mentioned above.

Next you'll need to configure I2C. Open a terminal and su to root. Then type sensors-detect. You'll get a series of questions. Unless you know otherwise, answering "yes" to all the questions is OK. One of the last questions will be about which kind of sensors you'd like to use. It has been my experience that either is OK. When it has stopped asking you questions, scroll up a little and you'll see a section similar to this:
To make the sensors modules behave correctly, add these lines to /etc/modules.conf:

#----cut here----
# I2C module options
alias char-major-89 i2c-dev
options it87 ignore=-1,0x290
#----cut here----

To load everything that is needed, add this to some /etc/rc* file:

#----cut here----
# I2C adapter drivers
modprobe i2c-viapro
modprobe i2c-isa
# I2C chip drivers
modprobe eeprom
modprobe it87
# sleep 2 # optional
/usr/bin/sensors -s # recommended
#----cut here----

Copy what is shown on your terminal and paste it into a text editor (or even OpenOffice is OK for this) and save it somewhere handy. You may not need it, but it's there in case you do. We'll come back to this in a minute.

The setup you just ran generated a file and we need to copy it to another location. So in the terminal (you're still root, right?) run this command:
cp /usr/share/doc/packages/sensors/prog/init/lm_sensors.init.suse /etc/init.d/

In the lower section of the data we pasted you'll see "modprobe xxwhateverxx". For each of those "modprobe statements" you'll need to run a command. So in my example above, I'd run the following in the terminal we still have open:
modprobe i2c-viapro
modprobe i2c-isa
modprobe eeprom
modprobe it87
You may have more or fewer statements to run; again, just run the "modprobe" commands.

I'll point out that these instructions are a little different than what you may see in the output of the I2C setup we ran. This is because SUSE handles this stuff a little differently. Now we'll need to modify some files with root privileges. If you're using KDE, go to the KMenu->System->File Manager->File Manager - Super User Mode. Or you can log out of your user account and log in as root, use vi to edit the files, etc. Again, the goal here is to put yourself in a position where you can modify files owned by root. I'll assume you're using KDE for the moment; navigate to /etc/, right-click on modprobe.conf.local and open with a text editor. This file will most likely be empty, all you need to do is add the first section of the data we pasted earlier. In my example above, I would add:
# I2C module options
alias char-major-89 i2c-dev
options it87 ignore=-1,0x290
Save the file and close it.

Now in Konq, navigate to /etc/init.d/, and open the boot.local file in a text editor. Again, in most cases this file will be empty with the exception of a few comments. Using my example above, I would add:
# I2C adapter drivers
modprobe i2c-viapro
modprobe i2c-isa
# I2C chip drivers
modprobe eeprom
modprobe it87
# sleep 2 # optional
/usr/bin/sensors -s # recommended
Save the file and close it.

Open YaST and go to the "system" section on the left and scroll down to "Runlevel Editor". Then find "lm_sensors" or "lm_sensors.init.suse", highlight it and select "Enable" then "Finish". This step starts the sensors during boot.

Now, theoretically you're done. If you see error messages during boot, it's a good sign something didn't go right. To undo this process, remove lm_sensors from the Runlevel Editor, remove the sections we added to the above files, and delete lm_sensors.init.suse from /etc/init.d/. Once that's done you can try running "sensors-detect" again.

SiteMap
SUSEroot.com © 2004 by Damian Smith. Trademark and copyleft information is covered on the About SUSEroot page. Contact me at damian@suseroot.com