diff options
author | khali <khali@7894878c-1315-0410-8ee3-d5d059ff63e0> | 2014-01-28 21:40:55 +0000 |
---|---|---|
committer | khali <khali@7894878c-1315-0410-8ee3-d5d059ff63e0> | 2014-01-28 21:40:55 +0000 |
commit | 50e6f2462a8938f5c952b97a050515931b9ef3bc (patch) | |
tree | 7cc1cc4381d88aa47d5123e06468ef9fccecff0a | |
parent | da9395f374906e325025adedd8ef7e1d9c2353eb (diff) | |
download | lm-sensors-50e6f2462a8938f5c952b97a050515931b9ef3bc.tar.gz |
fancontrol: Deal with moving hwmon attributes
Several kernel drivers have already moved their attributes from the
hardware device to the hwmon class device, and others will follow.
Teach fancontrol about this possibility and let it adjust the attribute
paths transparently.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6216 7894878c-1315-0410-8ee3-d5d059ff63e0
-rw-r--r-- | CHANGES | 1 | ||||
-rwxr-xr-x | prog/pwm/fancontrol | 63 |
2 files changed, 64 insertions, 0 deletions
@@ -2,6 +2,7 @@ lm-sensors CHANGES file ----------------------- SVN HEAD + fancontrol: Deal with moving hwmon attributes sensors-detect: Add detection of ADC128D818 3.3.5 "Happy Birthday Beddy" (2014-01-22) diff --git a/prog/pwm/fancontrol b/prog/pwm/fancontrol index 27711398..6ac0900a 100755 --- a/prog/pwm/fancontrol +++ b/prog/pwm/fancontrol @@ -206,6 +206,65 @@ function ValidateDevices() return $outdated } +function FixupDeviceFiles +{ + local DEVICE="$1" + local fcvcount pwmo tsen fan + + let fcvcount=0 + while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs + do + pwmo=${AFCPWM[$fcvcount]} + AFCPWM[$fcvcount]=${pwmo//$DEVICE\/device/$DEVICE} + if [ "${AFCPWM[$fcvcount]}" != "$pwmo" ] + then + echo "Adjusing $pwmo -> ${AFCPWM[$fcvcount]}" + fi + let fcvcount=$fcvcount+1 + done + + let fcvcount=0 + while (( $fcvcount < ${#AFCTEMP[@]} )) # go through all temp inputs + do + tsen=${AFCTEMP[$fcvcount]} + AFCTEMP[$fcvcount]=${tsen//$DEVICE\/device/$DEVICE} + if [ "${AFCTEMP[$fcvcount]}" != "$tsen" ] + then + echo "Adjusing $tsen -> ${AFCTEMP[$fcvcount]}" + fi + let fcvcount=$fcvcount+1 + done + + let fcvcount=0 + while (( $fcvcount < ${#AFCFAN[@]} )) # go through all fan inputs + do + fan=${AFCFAN[$fcvcount]} + AFCFAN[$fcvcount]=${fan//$DEVICE\/device/$DEVICE} + if [ "${AFCFAN[$fcvcount]}" != "$fan" ] + then + echo "Adjusing $fan -> ${AFCFAN[$fcvcount]}" + fi + let fcvcount=$fcvcount+1 + done +} + +# Some drivers moved their attributes from hard device to class device +function FixupFiles +{ + local DEVPATH="$1" + local entry device + + for entry in $DEVPATH + do + device=`echo "$entry" | sed -e 's/=[^=]*$//'` + + if [ -e "$device/name" ] + then + FixupDeviceFiles "$device" + fi + done +} + # Check that all referenced sysfs files exist function CheckFiles { @@ -306,6 +365,10 @@ then echo "Configuration appears to be outdated, please run pwmconfig again" >&2 exit 1 fi +if [ "$DIR" = "/sys/class/hwmon" ] +then + FixupFiles "$DEVPATH" +fi CheckFiles || exit 1 if [ -f "$PIDFILE" ] |