fancontrol: Support setup where one PWM output controls several fans

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6000 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2011-12-04 16:53:10 +00:00
1 parent 4b809e1ff1
commit bd21ec1ee4
2 files changed
+37 -13

No files matched your search

+1
View File
@@ -2,6 +2,7 @@ lm-sensors CHANGES file
-----------------------
SVN HEAD
fancontrol: Support setup where one PWM output controls several fans
sensors-detect: Stop calling for PIIX5 SMBus testers
Improve filtering of fake DMI data
Print DMI system/product version if available
+36 -13
View File
@@ -236,12 +236,15 @@ function CheckFiles {
let fcvcount=0
while (( $fcvcount < ${#AFCFAN[@]} )) # go through all fan inputs
do
fan=${AFCFAN[$fcvcount]}
if [ ! -r $fan ]
then
echo "Error: file $fan doesn't exist"
outdated=1
fi
# A given PWM output can control several fans
for fan in $(echo ${AFCFAN[$fcvcount]} | sed -e 's/+/ /')
do
if [ ! -r $fan ]
then
echo "Error: file $fan doesn't exist"
outdated=1
fi
done
let fcvcount=$fcvcount+1
done
@@ -405,12 +408,31 @@ function UpdateFanSpeeds {
# If fanspeed-sensor output shall be used, do it
if [[ -n ${fan} ]]
then
read fanval < ${fan}
if [ $? -ne 0 ]
then
echo "Error reading Fan value from $DIR/$fan"
restorefans 1
fi
min_fanval=100000
fanval=
# A given PWM output can control several fans
for one_fan in $(echo $fan | sed -e 's/+/ /')
do
read one_fanval < ${one_fan}
if [ $? -ne 0 ]
then
echo "Error reading Fan value from $DIR/$one_fan"
restorefans 1
fi
# Remember the minimum, it only matters if it is 0
if [ $one_fanval -lt $min_fanval ]
then
min_fanval=$one_fanval
fi
if [ -z "$fanval" ]
then
fanval=$one_fanval
else
fanval="$fanval/$one_fanval"
fi
done
else
fanval=1 # set it to a non zero value, so the rest of the script still works
fi
@@ -430,6 +452,7 @@ function UpdateFanSpeeds {
echo "tval=$tval"
echo "pwmpval=$pwmpval"
echo "fanval=$fanval"
echo "min_fanval=$min_fanval"
fi
if (( $tval <= $mint ))
@@ -439,7 +462,7 @@ function UpdateFanSpeeds {
else
# calculate the new value from temperature and settings
pwmval="(${tval}-${mint})*(${maxpwm}-${minso})/(${maxt}-${mint})+${minso}"
if [ $pwmpval -eq 0 -o $fanval -eq 0 ]
if [ $pwmpval -eq 0 -o $min_fanval -eq 0 ]
then # if fan was stopped start it using a safe value
echo $minsa > $pwmo
# Sleep while still handling signals