1 fancontrol: Deal with moving hwmon attributes
3 Several kernel drivers have already moved their attributes from the
4 hardware device to the hwmon class device, and others will follow.
5 Teach fancontrol about this possibility and let it adjust the attribute
8 Patch by Jean Delvare <khali@linux-fr.org>.
9 See <http://www.lm-sensors.org/changeset/6216>.
11 --- lm-sensors/prog/pwm/fancontrol (revision 6172)
12 +++ lm-sensors/prog/pwm/fancontrol (revision 6216)
16 +function FixupDeviceFiles
19 + local fcvcount pwmo tsen fan
22 + while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs
24 + pwmo=${AFCPWM[$fcvcount]}
25 + AFCPWM[$fcvcount]=${pwmo//$DEVICE\/device/$DEVICE}
26 + if [ "${AFCPWM[$fcvcount]}" != "$pwmo" ]
28 + echo "Adjusing $pwmo -> ${AFCPWM[$fcvcount]}"
30 + let fcvcount=$fcvcount+1
34 + while (( $fcvcount < ${#AFCTEMP[@]} )) # go through all temp inputs
36 + tsen=${AFCTEMP[$fcvcount]}
37 + AFCTEMP[$fcvcount]=${tsen//$DEVICE\/device/$DEVICE}
38 + if [ "${AFCTEMP[$fcvcount]}" != "$tsen" ]
40 + echo "Adjusing $tsen -> ${AFCTEMP[$fcvcount]}"
42 + let fcvcount=$fcvcount+1
46 + while (( $fcvcount < ${#AFCFAN[@]} )) # go through all fan inputs
48 + fan=${AFCFAN[$fcvcount]}
49 + AFCFAN[$fcvcount]=${fan//$DEVICE\/device/$DEVICE}
50 + if [ "${AFCFAN[$fcvcount]}" != "$fan" ]
52 + echo "Adjusing $fan -> ${AFCFAN[$fcvcount]}"
54 + let fcvcount=$fcvcount+1
58 +# Some drivers moved their attributes from hard device to class device
64 + for entry in $DEVPATH
66 + device=`echo "$entry" | sed -e 's/=[^=]*$//'`
68 + if [ -e "$device/name" ]
70 + FixupDeviceFiles "$device"
75 # Check that all referenced sysfs files exist
78 echo "Configuration appears to be outdated, please run pwmconfig again" >&2
81 +if [ "$DIR" = "/sys/class/hwmon" ]
83 + FixupFiles "$DEVPATH"