~ruther/guix-local

ref: e970b09a7530cde757dfd71586486fc2d09a2fa2 guix-local/gnu/packages/patches/lm-sensors-hwmon-attrs.patch -rw-r--r-- 2.1 KiB
e970b09a — Nicolas Graves gnu: python-mf2py: Update to 2.0.1. 1 year, 1 month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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.

Patch by Jean Delvare <khali@linux-fr.org>.
See <http://www.lm-sensors.org/changeset/6216>.

--- lm-sensors/prog/pwm/fancontrol	(revision 6172)
+++ lm-sensors/prog/pwm/fancontrol	(revision 6216)
@@ -207,4 +207,63 @@
 }
 
+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,4 +365,8 @@
 	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