sensors/lm_sensors-r6216-fancontrol-moving-hwmon-attributes.patch
Jean Delvare caff03032d - lm_sensors-r6216-fancontrol-moving-hwmon-attributes.patch:
fancontrol: Deal with moving hwmon attributes.
- lm_sensors-r6237-default-config-NCT6779-NCT6791.patch:
  sensors.conf.default: Add support for NCT6779 and NCT6791.
- lm_sensors-r6254-detect-print-kernel-cpu.patch: Print kernel
  version and processor information.
- lm_sensors-r6255-fix-shell-error-FCFANS.patch: fancontrol: Fix
  shell error when FCFANS is not set (bnc#903520).

OBS-URL: https://build.opensuse.org/package/show/Base:System/sensors?expand=0&rev=82
2014-11-05 10:45:39 +00:00

92 lines
2.3 KiB
Diff

From: Jean Delvare <jdelvare@suse.de>
Subject: fancontrol: Deal with moving hwmon attributes
Upstream: Committed (http://www.lm-sensors.org/changeset/6216)
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.
---
prog/pwm/fancontrol | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+)
--- lm_sensors-3.3.5.orig/prog/pwm/fancontrol 2014-11-05 11:39:50.709481711 +0100
+++ lm_sensors-3.3.5/prog/pwm/fancontrol 2014-11-05 11:39:55.983598361 +0100
@@ -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" ]