gnu: emacs-undohist-el: Update to 0.2.1.
[jackhill/guix/guix.git] / gnu / packages / patches / lm-sensors-hwmon-attrs.patch
1 fancontrol: Deal with moving hwmon attributes
2
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
6 paths transparently.
7
8 Patch by Jean Delvare <khali@linux-fr.org>.
9 See <http://www.lm-sensors.org/changeset/6216>.
10
11 --- lm-sensors/prog/pwm/fancontrol (revision 6172)
12 +++ lm-sensors/prog/pwm/fancontrol (revision 6216)
13 @@ -207,4 +207,63 @@
14 }
15
16 +function FixupDeviceFiles
17 +{
18 + local DEVICE="$1"
19 + local fcvcount pwmo tsen fan
20 +
21 + let fcvcount=0
22 + while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs
23 + do
24 + pwmo=${AFCPWM[$fcvcount]}
25 + AFCPWM[$fcvcount]=${pwmo//$DEVICE\/device/$DEVICE}
26 + if [ "${AFCPWM[$fcvcount]}" != "$pwmo" ]
27 + then
28 + echo "Adjusing $pwmo -> ${AFCPWM[$fcvcount]}"
29 + fi
30 + let fcvcount=$fcvcount+1
31 + done
32 +
33 + let fcvcount=0
34 + while (( $fcvcount < ${#AFCTEMP[@]} )) # go through all temp inputs
35 + do
36 + tsen=${AFCTEMP[$fcvcount]}
37 + AFCTEMP[$fcvcount]=${tsen//$DEVICE\/device/$DEVICE}
38 + if [ "${AFCTEMP[$fcvcount]}" != "$tsen" ]
39 + then
40 + echo "Adjusing $tsen -> ${AFCTEMP[$fcvcount]}"
41 + fi
42 + let fcvcount=$fcvcount+1
43 + done
44 +
45 + let fcvcount=0
46 + while (( $fcvcount < ${#AFCFAN[@]} )) # go through all fan inputs
47 + do
48 + fan=${AFCFAN[$fcvcount]}
49 + AFCFAN[$fcvcount]=${fan//$DEVICE\/device/$DEVICE}
50 + if [ "${AFCFAN[$fcvcount]}" != "$fan" ]
51 + then
52 + echo "Adjusing $fan -> ${AFCFAN[$fcvcount]}"
53 + fi
54 + let fcvcount=$fcvcount+1
55 + done
56 +}
57 +
58 +# Some drivers moved their attributes from hard device to class device
59 +function FixupFiles
60 +{
61 + local DEVPATH="$1"
62 + local entry device
63 +
64 + for entry in $DEVPATH
65 + do
66 + device=`echo "$entry" | sed -e 's/=[^=]*$//'`
67 +
68 + if [ -e "$device/name" ]
69 + then
70 + FixupDeviceFiles "$device"
71 + fi
72 + done
73 +}
74 +
75 # Check that all referenced sysfs files exist
76 function CheckFiles
77 @@ -306,4 +365,8 @@
78 echo "Configuration appears to be outdated, please run pwmconfig again" >&2
79 exit 1
80 +fi
81 +if [ "$DIR" = "/sys/class/hwmon" ]
82 +then
83 + FixupFiles "$DEVPATH"
84 fi
85 CheckFiles || exit 1