mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-01 13:20:30 +00:00
* check that the user is root * check if the SMBus is already there * only load i2c-i801 if needed * show the SMBus device line on success git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4285 7894878c-1315-0410-8ee3-d5d059ff63e0
61 lines
1.4 KiB
Bash
Executable File
61 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# (C) Rudolf Marek <r.marek@assembler.cz>,
|
|
# Jean Delvare <khali@linux-fr.org>
|
|
#
|
|
# Thanks Jean Delvare and Oliver Dreier <oliver@dinux.de> 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!"
|