summary refs log tree commit diff
path: root/gnu/packages/patches/lm-sensors-hwmon-attrs.patch
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2014-08-07 20:29:32 -0400
committerMark H Weaver <mhw@netris.org>2014-08-07 20:41:39 -0400
commit30016044e034945ae426e674880ba5e7485a48d0 (patch)
treeb29d0ab2a2194f3a2df898cc2be1084f38aeb87f /gnu/packages/patches/lm-sensors-hwmon-attrs.patch
parent13e7ce857c6995950f5694a4bd9869bac42918f4 (diff)
downloadguix-30016044e034945ae426e674880ba5e7485a48d0.tar.gz
gnu: Add lm-sensors.
* gnu/packages/patches/lm-sensors-hwmon-attrs.patch: New file.
* gnu-system.am (dist_patch_DATA): Add it.
* gnu/packages/linux.scm (lm-sensors): New variable.
Diffstat (limited to 'gnu/packages/patches/lm-sensors-hwmon-attrs.patch')
-rw-r--r--gnu/packages/patches/lm-sensors-hwmon-attrs.patch85
1 files changed, 85 insertions, 0 deletions
diff --git a/gnu/packages/patches/lm-sensors-hwmon-attrs.patch b/gnu/packages/patches/lm-sensors-hwmon-attrs.patch
new file mode 100644
index 0000000000..12979e7bd1
--- /dev/null
+++ b/gnu/packages/patches/lm-sensors-hwmon-attrs.patch
@@ -0,0 +1,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