Friday, 15 June 2007

Installing lm-sensors on a Presario 1500

I continue configuring and tweaking my ubuntu 7.04 Feisty Fawn on my Compaq presario 1500US.
Yesterday I configured the lm-sensors package in order to install a desklet or an application to see the current motherboard temperature. Because this laptop has a tendency to overheat! (see my other post :
Notebook overheat problem or Frying Eggs on Presario 1500)

First of all I launched Synaptic and searched "lm-sensors" and installed the package without problem.
(another option is to run in a terminal : sudo apt-get install lm-sensors)
Then I Ran the command :
sudo sensors-detect
and I obtained the following text :

ubuntu@horus:~$ sudo sensors-detect
Password:
# sensors-detect revision 4171 (2006-09-24 03:37:01 -0700)

This program will help you determine which kernel modules you need
to load to use lm_sensors most effectively. It is generally safe
and recommended to accept the default answers to all questions,
unless you know what you're doing.

We can start with probing for (PCI) I2C or SMBus adapters.
Do you want to probe now? (YES/no): yes
Probing for PCI bus adapters...
Sorry, no known PCI bus adapters found.

We will now try to load each adapter module in turn.
If you have undetectable or unsupported adapters, you can have them
scanned by manually loading the modules before running this script.

To continue, we need module `i2c-dev' to be loaded.
Do you want to load `i2c-dev' now? (YES/no): yes
Module loaded successfully.

We are now going to do the I2C/SMBus adapter probings. Some chips may
be double detected; we choose the one with the highest confidence
value in that case.
If you found that the adapter hung after probing a certain address,
you can specify that address to remain unprobed.

Some chips are also accessible through the ISA I/O ports. We have to
write to arbitrary I/O ports to probe them. This is usually safe though.
Yes, you do have ISA I/O ports even if you do not have any ISA slots!
Do you want to scan the ISA I/O ports? (YES/no): yes
Probing for `National Semiconductor LM78' at 0x290... No
Probing for `National Semiconductor LM78-J' at 0x290... No
Probing for `National Semiconductor LM79' at 0x290... No
Probing for `Winbond W83781D' at 0x290... No
Probing for `Winbond W83782D' at 0x290... No
Probing for `Winbond W83627HF' at 0x290... No
Probing for `Silicon Integrated Systems SIS5595'... No
Probing for `VIA VT82C686 Integrated Sensors'... No
Probing for `VIA VT8231 Integrated Sensors'... No
Probing for `AMD K8 thermal sensors'... No
Probing for `IPMI BMC KCS' at 0xca0... No
Probing for `IPMI BMC SMIC' at 0xca8... No

Some Super I/O chips may also contain sensors. We have to write to
standard I/O ports to probe them. This is usually safe.
Do you want to scan for Super I/O sensors? (YES/no): yes
Probing for Super-I/O at 0x2e/0x2f
Trying family `ITE'... Yes
Found unknown chip with ID 0xea11
Trying family `National Semiconductor'... Yes
Found `Nat. Semi. PC8739x Super IO'
(no hardware monitoring capabilities)
Trying family `SMSC'... Yes
Found unknown chip with ID 0xea11
Trying family `VIA/Winbond/Fintek'... Yes
Found unknown chip with ID 0xea11
Probing for Super-I/O at 0x4e/0x4f
Trying family `ITE'... No
Trying family `National Semiconductor'... No
Trying family `SMSC'... No
Trying family `VIA/Winbond/Fintek'... No

Sorry, no sensors were detected.
Either your sensors are not supported, or they are connected to an
I2C or SMBus adapter that is not supported. See doc/FAQ,
doc/lm_sensors-FAQ.html or http://www.lm-sensors.org/wiki/FAQ
(FAQ #4.24.3) for further information.
If you find out what chips are on your board, check
http://www.lm-sensors.org/wiki/Devices for driver status.


So, basically the sensors package didn't detect the sensors.
I read an installation instruction and ran the commands :
sudo gedit makedev.sh
Copy the next lines :

#!/bin/bash
# Here you can set several defaults.
# The number of devices to create (max: 256)
NUMBER=32

# The owner and group of the devices
OUSER=root
OGROUP=root
# The mode of the devices
MODE=600

# This script doesn't need to be run if devfs is used
if [ -r /proc/mounts ] ; then
if grep -q "/dev devfs" /proc/mounts ; then
echo "You do not need to run this script as your system uses devfs."
exit;
fi
fi

i=0;

while [ $i -lt $NUMBER ] ; do
echo /dev/i2c-$i
mknod -m $MODE /dev/i2c-$i c 89 $i exit
chown "$OUSER:$OGROUP" /dev/i2c-$i exit
i=$[$i + 1]
done
#end of file


Then :

sudo chmod +x makedev.sh
sudo ./makedev.sh

Afterwards I ran again sensors-detect but nothing changed... then I remembered that in my M$ Windows I used the motherboard monitor and later the speedfan so I booted M$ Windows and obtained the Speedfan output :

Win9x:NO 64Bit:NO GiveIO:YES SpeedFan:YES
I/O properly initialized
Linked ISA BUS at $0290
SMBus successfully enabled
Linked Intel 82801CAM ICH3 SMBUS at $1200
Scanning ISA BUS at $0290...
SuperIO Chip=PC8739x
Scanning Intel SMBus at $1200...
ADM1031 (ID=$31) found on SMBus at $2C
SMART Enabled for drive 0
Found TOSHIBA MK4018GAP (40,0GB)
Found ACPI temperature (59,0C)
End of detection


After that I found out the chip/sensor for my laptop an Intel 82801CAM ICH3 with an ADM1031. So I checked the www.lm-sensors.org and found that that chip/sensor is supported.
After searching and trying many things I finally found the script "unhide_ICH_SMBus" that show my chip/sensor :
You can download it from :
unhide_ICH_SMBus

Just in case here is the script (you can cut and paste using the gedit) :


#!/bin/bash
# (C) Rudolf Marek ,
# Jean Delvare
#
# Thanks Jean Delvare and Oliver Dreier for testing.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation

pcibus="/sys/bus/pci/slots/"
device="00:1f"

if [ "$UID" -ne 0 ] ; then
echo "You need to be root to run this script!"
exit 252
fi

smbus=`lspci -n -s $device.3 grep -i '0c05: *8086'`
if [ -n "$smbus" ] ; then
echo "ICH SMBus is already there!"
lspci -s $device.3
exit
fi

intel=`lspci -n -s $device.0 grep 8086`

if [ -z "$intel" ] ; then
echo "Not for your chipset - Intel (ICH) only"
exit 255;
fi
modprobe fakephp &> /dev/null

if [ ! -d "$pcibus" ] ; then
echo "You need the fake PCI hotplug driver! (fakephp.ko and 2.6 kernel)"
exit 255;
fi

echo "Enabling SMBus PCI device ..."

newval=$( printf '%x' $((0x$(setpci -s $device.0 f2.w) & 0xfff7)))
setpci -s $device.0 f2.w=$newval

echo "Rescanning the bus ..."
echo 1 > $pcibus/0000:$device.0/power 2>/dev/null
if [ ! -d "$pcibus/0000:$device.3" ] ; then
echo "Failed to enable the SMBUS"
exit 253;
fi

if [ ! -d "/sys/bus/pci/drivers/i801_smbus" ] ; then
echo "Loading i2c-i801 ..."
modprobe i2c-i801
if [ $? -ne 0 ] ; then
exit 251
fi
fi

lspci -s $device.3
echo "Done!"


-----------------------------
I ran the script :
ubuntu@horus:~$ sudo ./unhide_ICH_SMBus
Password:
Enabling SMBus PCI device ...
Rescanning the bus ...
Loading i2c-i801 ...
00:1f.3 SMBus: Intel Corporation 82801CA/CAM SMBus Controller (rev 02)
Done!


Afterwards I ran again :
sudo sensors-detect
And this time it ran Ok.
Here the output :

ubuntu@horus:~$ sudo sensors-detect
Password:
# sensors-detect revision 4171 (2006-09-24 03:37:01 -0700)

This program will help you determine which kernel modules you need
to load to use lm_sensors most effectively. It is generally safe
and recommended to accept the default answers to all questions,
unless you know what you're doing.

We can start with probing for (PCI) I2C or SMBus adapters.
Do you want to probe now? (YES/no): yes
Probing for PCI bus adapters...
Use driver `i2c-i801' for device 0000:00:1f.3: Intel 82801CA/CAM ICH3

We will now try to load each adapter module in turn.
Module `i2c-i801' already loaded.
If you have undetectable or unsupported adapters, you can have them
scanned by manually loading the modules before running this script.

To continue, we need module `i2c-dev' to be loaded.
Do you want to load `i2c-dev' now? (YES/no): yes
Module loaded successfully.

We are now going to do the I2C/SMBus adapter probings. Some chips may
be double detected; we choose the one with the highest confidence
value in that case.
If you found that the adapter hung after probing a certain address,
you can specify that address to remain unprobed.

Next adapter: SMBus I801 adapter at 1200
Do you want to scan it? (YES/no/selectively): yes
Client found at address 0x2c
Probing for `Myson MTP008'... No
Probing for `National Semiconductor LM78'... No
Probing for `National Semiconductor LM78-J'... No
Probing for `National Semiconductor LM79'... No
Probing for `National Semiconductor LM80'... No
Probing for `National Semiconductor LM85 or LM96000'... No
Probing for `Analog Devices ADM1027, ADT7460 or ADT7463'... No
Probing for `SMSC EMC6D100, EMC6D101 or EMC6D102'... No
Probing for `Analog Devices ADT7462'... No
Probing for `Analog Devices ADT7470'... No
Probing for `Analog Devices ADT7476'... No
Probing for `National Semiconductor LM87'... No
Probing for `National Semiconductor LM93'... No
Probing for `Winbond W83781D'... No
Probing for `Winbond W83782D'... No
Probing for `Winbond W83792D'... No
Probing for `Winbond W83793R/G'... No
Probing for `Winbond W83791SD'... No
Probing for `Winbond W83627HF'... No
Probing for `Winbond W83627EHF'... No
Probing for `Winbond W83627DHG'... No
Probing for `Asus AS99127F (rev.1)'... No
Probing for `Asus AS99127F (rev.2)'... No
Probing for `Asus ASB100 Bach'... No
Probing for `Genesys Logic GL518SM Revision 0x00'... No
Probing for `Genesys Logic GL518SM Revision 0x80'... No
Probing for `Genesys Logic GL520SM'... No
Probing for `Analog Devices ADM9240'... No
Probing for `Dallas Semiconductor DS1780'... No
Probing for `National Semiconductor LM81'... No
Probing for `Analog Devices ADM1026'... No
Probing for `Analog Devices ADM1025'... No
Probing for `Philips NE1619'... No
Probing for `Analog Devices ADM1024'... No
Probing for `Analog Devices ADM1029'... No
Probing for `Analog Devices ADM1030'... No
Probing for `Analog Devices ADM1031'... Success!
(confidence 7, driver `adm1031')
Probing for `Analog Devices ADM1022'... No
Probing for `Texas Instruments THMC50'... No
Probing for `ITE IT8712F'... No
Probing for `ALi M5879'... No
Probing for `SMSC LPC47M15x, LPC47M192 or LPC47M997'... No
Probing for `Winbond W83791D'... No
Client found at address 0x50
Probing for `Analog Devices ADM1033'... No
Probing for `Analog Devices ADM1034'... No
Probing for `SPD EEPROM'... Success!
(confidence 8, driver `eeprom')
Probing for `EDID EEPROM'... No
Probing for `Maxim MAX6900'... No
Client found at address 0x51
Probing for `Analog Devices ADM1033'... No
Probing for `Analog Devices ADM1034'... No
Probing for `SPD EEPROM'... Success!
(confidence 8, driver `eeprom')
Client found at address 0x69

Some chips are also accessible through the ISA I/O ports. We have to
write to arbitrary I/O ports to probe them. This is usually safe though.
Yes, you do have ISA I/O ports even if you do not have any ISA slots!
Do you want to scan the ISA I/O ports? (YES/no): yes
Probing for `National Semiconductor LM78' at 0x290... No
Probing for `National Semiconductor LM78-J' at 0x290... No
Probing for `National Semiconductor LM79' at 0x290... No
Probing for `Winbond W83781D' at 0x290... No
Probing for `Winbond W83782D' at 0x290... No
Probing for `Winbond W83627HF' at 0x290... No
Probing for `Silicon Integrated Systems SIS5595'... No
Probing for `VIA VT82C686 Integrated Sensors'... No
Probing for `VIA VT8231 Integrated Sensors'... No
Probing for `AMD K8 thermal sensors'... No
Probing for `IPMI BMC KCS' at 0xca0... No
Probing for `IPMI BMC SMIC' at 0xca8... No

Some Super I/O chips may also contain sensors. We have to write to
standard I/O ports to probe them. This is usually safe.
Do you want to scan for Super I/O sensors? (YES/no): yes
Probing for Super-I/O at 0x2e/0x2f
Trying family `ITE'... Yes
Found unknown chip with ID 0xea11
Trying family `National Semiconductor'... Yes
Found `Nat. Semi. PC8739x Super IO'
(no hardware monitoring capabilities)
Trying family `SMSC'... Yes
Found unknown chip with ID 0xea11
Trying family `VIA/Winbond/Fintek'... Yes
Found unknown chip with ID 0xea11
Probing for Super-I/O at 0x4e/0x4f
Trying family `ITE'... No
Trying family `National Semiconductor'... No
Trying family `SMSC'... No
Trying family `VIA/Winbond/Fintek'... No

Now follows a summary of the probes I have just done.
Just press ENTER to continue:

Driver `adm1031' (should be inserted):
Detects correctly:
* Bus `SMBus I801 adapter at 1200'
Busdriver `i2c-i801', I2C address 0x2c
Chip `Analog Devices ADM1031' (confidence: 7)

Driver `eeprom' (should be inserted):
Detects correctly:
* Bus `SMBus I801 adapter at 1200'
Busdriver `i2c-i801', I2C address 0x50
Chip `SPD EEPROM' (confidence: 8)
* Bus `SMBus I801 adapter at 1200'
Busdriver `i2c-i801', I2C address 0x51
Chip `SPD EEPROM' (confidence: 8)

EEPROMs are *NOT* sensors! They are data storage chips commonly
found on memory modules (SPD), in monitors (EDID), or in some
laptops, for example.

I will now generate the commands needed to load the required modules.
Just press ENTER to continue:

To make the sensors modules behave correctly, add these lines to
/etc/modules:

#----cut here----
# I2C adapter drivers
i2c-i801
# Chip drivers
adm1031
eeprom
#----cut here----


Do you want to add these lines to /etc/modules automatically? (yes/NO)


I selected "Yes".
Then in order to test it I ran the commands :

root@horus:/home/ubuntu# sudo modprobe i2c-i801
Password:
root@horus:/home/ubuntu# sudo modprobe adm1031
Password:
root@horus:/home/ubuntu# sudo modprobe eeprom
Password:
root@horus:/home/ubuntu# sudo depmod -a
Password:
root@horus:/home/ubuntu# sudo update-modules
Password:
root@horus:/home/ubuntu# sudo sensors
Password:
adm1031-i2c-0-2c
Adapter: SMBus I801 adapter at 1200
CPU Fan: 12053 RPM (min = 661 RPM, div = 4)
Case Fan: 16875 RPM (min = 661 RPM, div = 4)
SYS Temp: +57.0°C (low = +51°C, high = +70°C)
SYS Crit: +87°C
CPU Temp: +52.5°C (low = +46°C, high = +60°C)
CPU Crit: +75°C
AUX Temp: +0.0°C (low = +0°C, high = +80°C) DISCONNECT
AUX Crit: +100°C


I checked the /etc/modules file and all was correct. So I restarted Ubuntu and after booting I ran :
sudo sensors
But only got "No sensors detected".
To make the sensors work I had to run the unhide_ICH_SMBus first. In order to run the command in every boot I edited the file /etc/init.d/rc.local:
sudo gedit /etc/init.d/rc.local
Then I added the line calling unhide_ICH_SMBus first :

#! /bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/bin
[ -f /etc/default/rcS ] && . /etc/default/rcS
. /lib/lsb/init-functions

do_start() {
if [ -x /etc/rc.local ]; then
log_begin_msg "Running local boot scripts (/etc/rc.local)"
/etc/rc.local
log_end_msg $?
/home/ubuntu/unhide_ICH_SMBus
fi
}

case "$1" in
start)
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac

Afterwards I restarted Ubuntu and this time the sensors worked!

I decided to install a gdesklet to see the mother/cpu temperature in the desktop, unfortunately after trying every gDesklet that show sensors/temperature I gave up... none of them worked!!!
Finally I found the application that I wanted :

Computer Temperature Monitor


You can download the .deb package for Ubuntu Feisty here :
computertemp_0.9.6.1-0ubuntu1_all.deb
After installed with a simple double-click I right clicked in the task-bar and select "Add to panel" then browsed to
"System and Hardware" and selected "Computer temperature monitor".


Then the temperature reading appeared in the task bar :