Jump to content
  • 0

Helios64 Upgrade from Debian10/OMV5 to Debian11/OMV6?


greg396
 Share

Question

Dear Forum,

I am using a Helios64 with armbian Debian 10 (Buster) Linux-Kernel 5.15.52 and OMV 5.6.26-1.
If I want to have further Updates from OMV I need to upgrade to Debian 11, because OMV6 isn't compatible to Buster.

Any recomendations how I should upgrade?
The H64-System is on a SDD. Should I try a cli system upgrade or installing everything new with a bullseye image, if this is available (Where?)?

 

Best wishes, Greg

Link to comment
Share on other sites

19 answers to this question

Recommended Posts

  • 0

Hi

 

1 hour ago, greg396 said:

if this is available (Where?)?

No pre-built image available since it is unmaintained. You can use the build framework to build your own image with Bullseye userspace.

 

 

1 hour ago, greg396 said:

try a cli system upgrade

Userspace upgrades are neither tested nor supported. You can try but you are on your own if something breaks. Create proper backups first.

Good luck.

 

 

 

Link to comment
Share on other sites

Armbian Linux community supported weekly builds download

  • 0

@Werner "You can try but you are on your own if something breaks" do You mean side software or side hardware? If openmediavault, armbian and all other packages are opensource the only limit can be represented from the driver that interface with kernel ...is right? (Note: I don't know Linux very well, I have only theoretical notion on operating system)

Edited by n3o
Link to comment
Share on other sites

  • 0

so best way is make a backup of image on other microsd with Linux-Kernel 5.15.52 and OMV 5.6.26-1 and update both Linux and OMV... if there are problems then switch to other microSD

Link to comment
Share on other sites

  • 0

Have upgrade Helios64 from OMV5 to OMV6 2 weeks ago.

 

System runs normal.

Only issue; fans became quite noisy since upgrade, guess maxrpm fancontrol is not working without hdd temp sensors.

 

Some info on config;

root@helios64:~# uname -a
Linux helios64 5.15.52-rockchip64  #22.05.4

 

Upgrade procedure;

- Linux updates

apt-get update && apt-get upgrade && apt-get dist-upgrade && apt-get --purge autoremove

 

- OMV update

omv-update

follow questions

reboot, hope for the best ;-)

Link to comment
Share on other sites

  • 0

The Helios64 documentation was a little unclear;

with these commands I found a (temp) solution for the RPM;

Get hardware addresses (find fan 6 and 7):

ls -l /sys/class/hwmon/

 

Read pwm setting (255 is max, possibly your hwmon-address is different)
cat /sys/class/hwmon/hwmon5/pwm1
cat /sys/class/hwmon/hwmon6/pwm1

 

Manual change rpm for Helios64 fans (value 60 is safe and quiet);
echo 70 > /sys/class/hwmon/hwmon5/pwm1
echo 70 > /sys/class/hwmon/hwmon6/pwm1

 

Link to comment
Share on other sites

  • 0

Hi,

 

maybe you want to modify some lines,

 

/usr/sbin/fancontrol

Divulgacher

Ligne 44 > MAX=

my value is MAX=80 because when it comes to restart or shutdown I want to hear it

 

/etc/fancontrol

Divulgacher

# Helios64 PWM Fan Control Configuration
# /etc/fancontrol

# /usr/sbin/fancontrol
# /var/run/fancontrol.pid

 

# Command
# ls -l /sys/class/hwmon | grep fan
# cat /sys/class/hwmon/hwmon4/pwm1 && cat /sys/class/hwmon/hwmon5/pwm1
# systemctl stop fancontrol.service
# systemctl start fancontrol.service
# echo 255 > /sys/class/hwmon/hwmon4/pwm1 && echo 255 > /sys/class/hwmon/hwmon5/pwm1
# hdparm -H /dev/sdd | grep celsius
# hddtemp /dev/sd[a-e]

 

INTERVAL=10


# Temp source : /dev/thermal-cpu
FCTEMPS=/dev/fan-p6/pwm1=/dev/thermal-cpu/temp1_input /dev/fan-p7/pwm1=/dev/thermal-cpu/temp1_input

# temp1_critique = 85° < big downclock 1.8Ghz => 1.62Ghz/400Mhz


# P6 => Fan Right (2SATA+CPU) | P7 => Fan Left (3SATA)
#Temp Limit >> PWM => MINPWM 
MINTEMP=/dev/fan-p6/pwm1=50 /dev/fan-p7/pwm1=50
#Temp Limit >> PWM => MAXPWM
MAXTEMP=/dev/fan-p6/pwm1=60 /dev/fan-p7/pwm1=60

 

#Fan Type "C" 350-3600RPM

#PWM < 20 => 0RPM | PWM = 25 => 350 RPM | PWM = 255 => 3600RPM
#Fan Start PWM = 25
MINSTART=/dev/fan-p6/pwm1=30 /dev/fan-p7/pwm1=25
#Fan Stop PWM = 15
MINSTOP=/dev/fan-p6/pwm1=35 /dev/fan-p7/pwm1=15

 

#PWM Minimal < MINSTOP (SSD P7 = 0 / HDD P7 = 35)
MINPWM=/dev/fan-p6/pwm1=35 /dev/fan-p7/pwm1=0
#PWM Maximal (75°< PWM for Tcpu100% <80°) 

#T = 20° PWM = 0 (Fanless with Gelid PAD) | T = 25° PWM = ?? | T = 30° PWM = ??
MAXPWM=/dev/fan-p6/pwm1=60 /dev/fan-p7/pwm1=60

my fancontrol setup with special setting with high quality thermal paste (With Gelid Solutions GP-Ultimate my unit is without thermal bottleneck Fanless) and use only SSDs.

MAXPWM is the key to silence but you have to find the max hwmonX/pwm1 value for CPU100%/Thermal PAD/Heatshink solution = temp1_input ≤ 80°C , otherwise you risk reaching the value of temp1_crit under heavy load.

 

Ex: With the original thermal PAD my old MAXPWM=120

Link to comment
Share on other sites

  • 0

I just use the Usb-backup plugin.

I tried the upgrade but had some errors which I couldn't solve ending up in installing the latest bullseye image from here https://armbian.hosthatch.com/archive/helios64/archive/ first to SD then to eMMC and then the system to a SSD while booting from eMMC - which works now really good again with having actual OMV6. The only trouble is that I won't get the fan quiet :) Thank you allen--smithee for your modification which doesn't work for me, sorry! I can only manual set it quiet with Daniel Helios64 commands

echo 70 > /sys/class/hwmon/hwmon5/pwm1
echo 70 > /sys/class/hwmon/hwmon6/pwm1

Link to comment
Share on other sites

  • 0

I'm curious 

what is the result of this command

systemctl status fancontrol.service
 

and what does the next command say

systemctl start fancontrol.service

 

if the configuration file /etc/fancontrol contains it a syntax error or wrong variable fancontrol will not run.

also check 

ls -l /sys/class/hwmon | grep fan

ls -l /etc/udev/rules.d/

cat /etc/udev/rules.d/90-helios64-hwmon.rules

ls -l /dev/thermal-cpu/

 

Have you read old threads on the subject?

 

 

Link to comment
Share on other sites

  • 0

Dear allen--smithee, thank you for taking you time! Yes, indeed the service won't start automatic after a reboot

 

status fancontrol.service shows these errors:

Error: file /dev/fan-p5/pwm1 doesn't exist
Error: file /dev/thermal-cpu/temp1_input doesn't exist
Error: file /dev/thermal-cpu/temp1_input doesn't exist

 

I could fix it with

sudo ln -s /sys/devices/virtual/thermal/thermal_zone0/hwmon0 /dev/thermal-cpu

and then starting the service manual

but after a reboot it's gone

I don't understand how I can apply it permantent

 

 

fancontrol.service
● fancontrol.service - fan speed regulator
     Loaded: loaded (/lib/systemd/system/fancontrol.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/fancontrol.service.d
             └─pid.conf
     Active: failed (Result: exit-code) since Fri 2022-09-16 17:53:17 UTC; 4s ago
       Docs: man:fancontrol(8)
             man:pwmconfig(8)
    Process: 3011 ExecStartPre=/usr/sbin/fancontrol --check (code=exited, status=0/SUCCESS)
    Process: 3144 ExecStart=/usr/sbin/fancontrol (code=exited, status=1/FAILURE)
   Main PID: 3144 (code=exited, status=1/FAILURE)
        CPU: 1.362s

Sep 16 17:53:17 helios64 fancontrol[3144]:   AVERAGE=1
Sep 16 17:53:17 helios64 fancontrol[3144]: Error: file /dev/fan-p5/pwm1 doesn't exist
Sep 16 17:53:17 helios64 fancontrol[3144]: Error: file /dev/thermal-cpu/temp1_input doesn't exist
Sep 16 17:53:17 helios64 fancontrol[3144]: Error: file /dev/thermal-cpu/temp1_input doesn't exist
Sep 16 17:53:17 helios64 fancontrol[3144]: At least one referenced file is missing. Either some req>
Sep 16 17:53:17 helios64 fancontrol[3144]: modules haven't been loaded, or your configuration file >
Sep 16 17:53:17 helios64 fancontrol[3144]: In the latter case, you should run pwmconfig again.
Sep 16 17:53:17 helios64 systemd[1]: fancontrol.service: Main process exited, code=exited, status=1>
Sep 16 17:53:17 helios64 systemd[1]: fancontrol.service: Failed with result 'exit-code'.
Sep 16 17:53:17 helios64 systemd[1]: fancontrol.service: Consumed 1.362s CPU time.
lines 1-22/22 (END)

 

s -l /sys/class/hwmon | grep fan
lrwxrwxrwx 1 root root 0 Sep 16 17:55 hwmon4 -> ../../devices/platform/p7-fan/hwmon/hwmon4
lrwxrwxrwx 1 root root 0 Sep 16 17:51 hwmon5 -> ../../devices/platform/p6-fan/hwmon/hwmon5

 

ls -l /etc/udev/rules.d/
total 56
-rw-r--r-- 1 root root    70 Nov 19  2020 10-wifi-disable-powermanagement.rules
-rw-r--r-- 1 root root    45 Feb  3  2021 50-mali.rules
-rw-r--r-- 1 root root   138 Feb  3  2021 50-rk3399-vpu.rules
-rw-r--r-- 1 root root  3132 Feb  3  2021 50-usb-realtek-net.rules
-rw-r--r-- 1 root root 20275 Aug 31 20:17 61-openmediavault-dev-disk-by-id.rules
-rw-r--r-- 1 root root    79 Feb  3  2021 70-keep-usb-lan-as-eth1.rules
-rw-r--r-- 1 root root   866 Feb  3  2021 90-helios64-hwmon.rules
-rw-r--r-- 1 root root   424 Feb  3  2021 90-helios64-ups.rules
-rw-r--r-- 1 root root  1348 Jan 20  2022 99-openmediavault-md-raid.rules
-rw-r--r-- 1 root root  1647 Jan 20  2022 99-openmediavault-nonrot.rules

 

 

cat /etc/udev/rules.d/90-helios64-hwmon.rules
# Helios64 persistent hwmon

ACTION=="remove", GOTO="helios64_hwmon_end"

#
KERNELS=="p6-fan", SUBSYSTEMS=="platform", ENV{_HELIOS64_FAN_}="p6", ENV{_IS_HELIOS64_FAN_}="1", ENV{IS_HELIOS64_HWMON}="1"
KERNELS=="p7-fan", SUBSYSTEMS=="platform", ENV{_HELIOS64_FAN_}="p7", ENV{_IS_HELIOS64_FAN_}="1", ENV{IS_HELIOS64_HWMON}="1"
KERNELS=="2-004c", SUBSYSTEMS=="i2c", DRIVERS=="lm75", ENV{IS_HELIOS64_HWMON}="1"

SUBSYSTEM!="hwmon", GOTO="helios64_hwmon_end"

ENV{HWMON_PATH}="/sys%p"
#
ATTR{name}=="cpu", ENV{IS_HELIOS64_HWMON}="1", ENV{HELIOS64_SYMLINK}="/dev/thermal-cpu"
#
ENV{IS_HELIOS64_HWMON}=="1", ATTR{name}=="lm75", ENV{HELIOS64_SYMLINK}="/dev/thermal-board"
ENV{_IS_HELIOS64_FAN_}=="1", ENV{HELIOS64_SYMLINK}="/dev/fan-$env{_HELIOS64_FAN_}"

#
ENV{IS_HELIOS64_HWMON}=="1", RUN+="/bin/ln -sf $env{HWMON_PATH} $env{HELIOS64_SYMLINK}"

LABEL="helios64_hwmon_end"


ls -l /dev/thermal-cpu/
ls: cannot access '/dev/thermal-cpu/': No such file or directory

 

/usr/sbin/pwmconfig: There are no fan-capable sensor modules installed

Link to comment
Share on other sites

  • 0

p5-fan and /dev/thermal-cpu doesn't exist, try with these changes

 

copy paste /etc/udev/rules.d/90-helios64-hwmon.rules

Spoiler

# Helios64 persistent hwmon 

ACTION=="remove", GOTO="helios64_hwmon_end"

#
KERNELS=="p6-fan", SUBSYSTEMS=="platform", ENV{_HELIOS64_FAN_}="p6", ENV{_IS_HELIOS64_FAN_}="1", ENV{IS_HELIOS64_HWMON}="1"
KERNELS=="p7-fan", SUBSYSTEMS=="platform", ENV{_HELIOS64_FAN_}="p7", ENV{_IS_HELIOS64_FAN_}="1", ENV{IS_HELIOS64_HWMON}="1"
KERNELS=="2-004c", SUBSYSTEMS=="i2c", DRIVERS=="lm75", ENV{IS_HELIOS64_HWMON}="1"
KERNELS=="thermal_zone0", SUBSYSTEMS=="thermal", ENV{IS_HELIOS64_HWMON}="1"

SUBSYSTEM!="hwmon|thermal", GOTO="helios64_hwmon_end"

ENV{HWMON_PATH}="/sys%p"
#
ATTR{type}=="soc-thermal", ENV{HWMON_PATH}="/sys%p/temp", ENV{HELIOS64_SYMLINK}="/dev/thermal-cpu/temp1_input", RUN+="/usr/bin/mkdir /dev/thermal-cpu/"
ATTR{name}=="cpu", ENV{IS_HELIOS64_HWMON}="1", ENV{HELIOS64_SYMLINK}="/dev/thermal-cpu"
#
ENV{IS_HELIOS64_HWMON}=="1", ATTR{name}=="lm75", ENV{HELIOS64_SYMLINK}="/dev/thermal-board"
ENV{_IS_HELIOS64_FAN_}=="1", ENV{HELIOS64_SYMLINK}="/dev/fan-$env{_HELIOS64_FAN_}"

#
ENV{IS_HELIOS64_HWMON}=="1", RUN+="/bin/ln -sf $env{HWMON_PATH} $env{HELIOS64_SYMLINK}"

LABEL="helios64_hwmon_end"

 

copy paste /etc/fancontrol

Spoiler
# Helios64 PWM Fan Control Configuration
# /etc/fancontrol

INTERVAL=10
# Temp source : /dev/thermal-cpu
FCTEMPS=/dev/fan-p6/pwm1=/dev/thermal-cpu/temp1_input /dev/fan-p7/pwm1=/dev/thermal-cpu/temp1_input

MINTEMP=/dev/fan-p6/pwm1=45 /dev/fan-p7/pwm1=45
MAXTEMP=/dev/fan-p6/pwm1=80 /dev/fan-p7/pwm1=80

MINSTART=/dev/fan-p6/pwm1=25 /dev/fan-p7/pwm1=25
MINSTOP=/dev/fan-p6/pwm1=15 /dev/fan-p7/pwm1=15

MINPWM=/dev/fan-p6/pwm1=0 /dev/fan-p7/pwm1=0
MAXPWM=/dev/fan-p6/pwm1=120 /dev/fan-p7/pwm1=120

 

 

shutdown 0

 

Start

ls -l /dev/thermal-cpu/

systemctl status fancontrol.service

Link to comment
Share on other sites

  • 0

Thank you.

You just need to exchange this fix here

https://github.com/useful64/build/commit/b9f17bdffa24cc3309dc20de487aaa19bb5c481d

 

-> ATTR{name}=="cpu|cpu_thermal", ENV{IS_HELIOS64_HWMON}="1", ENV{HELIOS64_SYMLINK}="/dev/thermal-cpu" is missing above

 

et voila

ls -l /dev/thermal-cpu/
total 0
device -> ../../thermal_zone0
subsystem -> ../../../../../class/hwmon
temp1_crit
temp1_input
uevent

 

so the working /etc/udev/rules.d/90-helios64-hwmon.rules looks like

 

# Helios64 persistent hwmon

 ACTION=="remove", GOTO="helios64_hwmon_end"

#
KERNELS=="p6-fan", SUBSYSTEMS=="platform", ENV{_HELIOS64_FAN_}="p6", ENV{_IS_HELIOS64_FAN_}="1", EN>
KERNELS=="p7-fan", SUBSYSTEMS=="platform", ENV{_HELIOS64_FAN_}="p7", ENV{_IS_HELIOS64_FAN_}="1", EN>
KERNELS=="2-004c", SUBSYSTEMS=="i2c", DRIVERS=="lm75", ENV{IS_HELIOS64_HWMON}="1"
KERNELS=="thermal_zone0", SUBSYSTEMS=="thermal", ENV{IS_HELIOS64_HWMON}="1"

SUBSYSTEM!="hwmon|thermal", GOTO="helios64_hwmon_end"

ENV{HWMON_PATH}="/sys%p"
#
ATTR{type}=="soc-thermal", ENV{HWMON_PATH}="/sys%p/temp", ENV{HELIOS64_SYMLINK}="/dev/thermal-cpu/t>
ATTR{name}=="cpu", ENV{IS_HELIOS64_HWMON}="1", ENV{HELIOS64_SYMLINK}="/dev/thermal-cpu"
ATTR{name}=="cpu|cpu_thermal", ENV{IS_HELIOS64_HWMON}="1", ENV{HELIOS64_SYMLINK}="/dev/thermal-cpu"
#
ENV{IS_HELIOS64_HWMON}=="1", ATTR{name}=="lm75", ENV{HELIOS64_SYMLINK}="/dev/thermal-board"
ENV{_IS_HELIOS64_FAN_}=="1", ENV{HELIOS64_SYMLINK}="/dev/fan-$env{_HELIOS64_FAN_}"

#
ENV{IS_HELIOS64_HWMON}=="1", RUN+="/bin/ln -sf $env{HWMON_PATH} $env{HELIOS64_SYMLINK}"

LABEL="helios64_hwmon_end"

Link to comment
Share on other sites

  • 0
20 hours ago, allen--smithee said:

shutdown are no longer noisy

 

I think shutdowns will always be noisy, because the script ends and there is a TRAP signal that turns it to 100% .

 

But not sure if MAXPWN affects the AFCPWM values in that script.

 

Just look at the `/usr/sbin/fancontrol`

 

```

function restorefans()
{
        local status=$1 fcvcount pwmo

        echo 'Aborting, restoring fans...'
        let fcvcount=0
        while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs
        do
                pwmo=${AFCPWM[$fcvcount]}
                pwmdisable $pwmo
                let fcvcount=$fcvcount+1
        done
        echo 'Verify fans have returned to full speed'
        rm -f "$PIDFILE"
        exit $status
}

trap 'restorefans 0' SIGQUIT SIGTERM
trap 'restorefans 1' SIGHUP SIGINT

```

Link to comment
Share on other sites

  • 0

 

/usr/sbin/fancontrol

line 44 >> Max=

precisely defines the nominal speed when fancontrol is inactive,

which means, at the ignition of the device before the launching of the processes (including fancontrol) and at the extintion of the device when the processes are interrupted (including fancontrol)

and it can last several minutes when you have installed OMV and some containers.

But yes indeed you hear the fans roar for a second at the start and the end before the unit shuts down completely.

 

I leave MAX=80 because from memory during my previous tests, the fans make an audible noise, which allowed me to verify that my unit restarted or turned off when I sent a command from my phone.

A memory because it's been a while...

 

Screenshot_20220918_174423.jpg

 

 

/usr/sbin/fancontrol

Spoiler

 

#!/bin/bash
#
# Simple script implementing a temperature dependent fan speed control
# Supported Linux kernel versions: 2.6.5 and later
#
# Version 0.71
#
# Usage: fancontrol [CONFIGFILE]
#
# Dependencies:
#   bash, grep, sed, cut, sleep, readlink, lm_sensors :)
#
# Please send any questions, comments or success stories to
# marius.reiner@hdev.de
# Thanks!
#
# For configuration instructions and warnings please see fancontrol.txt, which
# can be found in the doc/ directory or at the website mentioned above.
#
#
#    Copyright 2003 Marius Reiner <marius.reiner@hdev.de>
#    Copyright (C) 2007-2014 Jean Delvare <jdelvare@suse.de>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#    MA 02110-1301 USA.
#
#

PIDFILE="/var/run/fancontrol.pid"

#DEBUG=1
MAX=80

function LoadConfig
{
	local fcvcount fcv

	echo "Loading configuration from $1 ..."
	if [ ! -r "$1" ]
	then
		echo "Error: Can't read configuration file" >&2
		exit 1
	fi

	# grep configuration from file
	INTERVAL=$(grep -E '^INTERVAL=.*$' $1 | sed -e 's/INTERVAL=//g')
	DEVPATH=$(grep -E '^DEVPATH=.*$' $1 | sed -e 's/DEVPATH= *//g')
	DEVNAME=$(grep -E '^DEVNAME=.*$' $1 | sed -e 's/DEVNAME= *//g')
	FCTEMPS=$(grep -E '^FCTEMPS=.*$' $1 | sed -e 's/FCTEMPS=//g')
	MINTEMP=$(grep -E '^MINTEMP=.*$' $1 | sed -e 's/MINTEMP=//g')
	MAXTEMP=$(grep -E '^MAXTEMP=.*$' $1 | sed -e 's/MAXTEMP=//g')
	MINSTART=$(grep -E '^MINSTART=.*$' $1 | sed -e 's/MINSTART=//g')
	MINSTOP=$(grep -E '^MINSTOP=.*$' $1 | sed -e 's/MINSTOP=//g')
	# optional settings:
	FCFANS=$(grep -E '^FCFANS=.*$' $1 | sed -e 's/FCFANS=//g')
	MINPWM=$(grep -E '^MINPWM=.*$' $1 | sed -e 's/MINPWM=//g')
	MAXPWM=$(grep -E '^MAXPWM=.*$' $1 | sed -e 's/MAXPWM=//g')

	# Check whether all mandatory settings are set
	if [[ -z ${INTERVAL} || -z ${FCTEMPS} || -z ${MINTEMP} || -z ${MAXTEMP} || -z ${MINSTART} || -z ${MINSTOP} ]]
	then
		echo "Some mandatory settings missing, please check your config file!" >&2
		exit 1
	fi
	if [ "$INTERVAL" -le 0 ]
	then
		echo "Error in configuration file:" >&2
		echo "INTERVAL must be at least 1" >&2
		exit 1
	fi

	# write settings to arrays for easier use and print them
	echo
	echo "Common settings:"
	echo "  INTERVAL=$INTERVAL"

	let fcvcount=0
	for fcv in $FCTEMPS
	do
		if ! echo $fcv | grep -E -q '='
		then
			echo "Error in configuration file:" >&2
			echo "FCTEMPS value is improperly formatted" >&2
			exit 1
		fi

		AFCPWM[$fcvcount]=$(echo $fcv |cut -d'=' -f1)
		AFCTEMP[$fcvcount]=$(echo $fcv |cut -d'=' -f2)
		AFCFAN[$fcvcount]=$(echo $FCFANS |sed -e 's/ /\n/g' |grep -E "${AFCPWM[$fcvcount]}" |cut -d'=' -f2)
		AFCMINTEMP[$fcvcount]=$(echo $MINTEMP |sed -e 's/ /\n/g' |grep -E "${AFCPWM[$fcvcount]}" |cut -d'=' -f2)
		AFCMAXTEMP[$fcvcount]=$(echo $MAXTEMP |sed -e 's/ /\n/g' |grep -E "${AFCPWM[$fcvcount]}" |cut -d'=' -f2)
		AFCMINSTART[$fcvcount]=$(echo $MINSTART |sed -e 's/ /\n/g' |grep -E "${AFCPWM[$fcvcount]}" |cut -d'=' -f2)
		AFCMINSTOP[$fcvcount]=$(echo $MINSTOP |sed -e 's/ /\n/g' |grep -E "${AFCPWM[$fcvcount]}" |cut -d'=' -f2)
		AFCMINPWM[$fcvcount]=$(echo $MINPWM |sed -e 's/ /\n/g' |grep -E "${AFCPWM[$fcvcount]}" |cut -d'=' -f2)
		[ -z "${AFCMINPWM[$fcvcount]}" ] && AFCMINPWM[$fcvcount]=0
		AFCMAXPWM[$fcvcount]=$(echo $MAXPWM |sed -e 's/ /\n/g' |grep -E "${AFCPWM[$fcvcount]}" |cut -d'=' -f2)
		[ -z "${AFCMAXPWM[$fcvcount]}" ] && AFCMAXPWM[$fcvcount]=255

		# verify the validity of the settings
		if [ "${AFCMINTEMP[$fcvcount]}" -ge "${AFCMAXTEMP[$fcvcount]}" ]
		then
			echo "Error in configuration file (${AFCPWM[$fcvcount]}):" >&2
			echo "MINTEMP must be less than MAXTEMP" >&2
			exit 1
		fi
		if [ "${AFCMAXPWM[$fcvcount]}" -gt 255 ]
		then
			echo "Error in configuration file (${AFCPWM[$fcvcount]}):" >&2
			echo "MAXPWM must be at most 255" >&2
			exit 1
		fi
		if [ "${AFCMINSTOP[$fcvcount]}" -ge "${AFCMAXPWM[$fcvcount]}" ]
		then
			echo "Error in configuration file (${AFCPWM[$fcvcount]}):" >&2
			echo "MINSTOP must be less than MAXPWM" >&2
			exit 1
		fi
		if [ "${AFCMINSTOP[$fcvcount]}" -lt "${AFCMINPWM[$fcvcount]}" ]
		then
			echo "Error in configuration file (${AFCPWM[$fcvcount]}):" >&2
			echo "MINSTOP must be greater than or equal to MINPWM" >&2
			exit 1
		fi
		if [ "${AFCMINPWM[$fcvcount]}" -lt 0 ]
		then
			echo "Error in configuration file (${AFCPWM[$fcvcount]}):" >&2
			echo "MINPWM must be at least 0" >&2
			exit 1
		fi

		echo
		echo "Settings for ${AFCPWM[$fcvcount]}:"
		echo "  Depends on ${AFCTEMP[$fcvcount]}"
		echo "  Controls ${AFCFAN[$fcvcount]}"
		echo "  MINTEMP=${AFCMINTEMP[$fcvcount]}"
		echo "  MAXTEMP=${AFCMAXTEMP[$fcvcount]}"
		echo "  MINSTART=${AFCMINSTART[$fcvcount]}"
		echo "  MINSTOP=${AFCMINSTOP[$fcvcount]}"
		echo "  MINPWM=${AFCMINPWM[$fcvcount]}"
		echo "  MAXPWM=${AFCMAXPWM[$fcvcount]}"
		let fcvcount=fcvcount+1
	done
	echo
}

function DevicePath()
{
	if [ -h "$1/device" ]
	then
		readlink -f "$1/device" | sed -e 's/^\/sys\///'
	fi
}

function DeviceName()
{
	if [ -r "$1/name" ]
	then
		cat "$1/name" | sed -e 's/[[:space:]=]/_/g'
	elif [ -r "$1/device/name" ]
	then
		cat "$1/device/name" | sed -e 's/[[:space:]=]/_/g'
	fi
}

function ValidateDevices()
{
	local OLD_DEVPATH="$1" OLD_DEVNAME="$2" outdated=0
	local entry device name path

	for entry in $OLD_DEVPATH
	do
		device=$(echo "$entry" | sed -e 's/=[^=]*$//')
		path=$(echo "$entry" | sed -e 's/^[^=]*=//')

		if [ "$(DevicePath "$device")" != "$path" ]
		then
			echo "Device path of $device has changed" >&2
			outdated=1
		fi
	done

	for entry in $OLD_DEVNAME
	do
		device=$(echo "$entry" | sed -e 's/=[^=]*$//')
		name=$(echo "$entry" | sed -e 's/^[^=]*=//')

		if [ "$(DeviceName "$device")" != "$name" ]
		then
			echo "Device name of $device has changed" >&2
			outdated=1
		fi
	done

	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
{
	local outdated=0 fcvcount pwmo tsen fan

	let fcvcount=0
	while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs
	do
		pwmo=${AFCPWM[$fcvcount]}
		if [ ! -w $pwmo ]
		then
			echo "Error: file $pwmo doesn't exist" >&2
			outdated=1
		fi
		let fcvcount=$fcvcount+1
	done

	let fcvcount=0
	while (( $fcvcount < ${#AFCTEMP[@]} )) # go through all temp inputs
	do
		tsen=${AFCTEMP[$fcvcount]}
		if [ ! -r $tsen ]
		then
			echo "Error: file $tsen doesn't exist" >&2
			outdated=1
		fi
		let fcvcount=$fcvcount+1
	done

	let fcvcount=0
	while (( $fcvcount < ${#AFCFAN[@]} )) # go through all fan inputs
	do
		# A given PWM output can control several fans
		for fan in $(echo ${AFCFAN[$fcvcount]} | sed -e 's/+/ /')
		do
			if [ ! -r $fan ]
			then
				echo "Error: file $fan doesn't exist" >&2
				outdated=1
			fi
		done
		let fcvcount=$fcvcount+1
	done

	if [ $outdated -eq 1 ]
	then
		echo >&2
		echo "At least one referenced file is missing. Either some required kernel" >&2
		echo "modules haven't been loaded, or your configuration file is outdated." >&2
		echo "In the latter case, you should run pwmconfig again." >&2
	fi

	return $outdated
}

if [ "$1" == "--check" ]
then
	if [ -f "$2" ]
	then
		LoadConfig $2
	else
		LoadConfig /etc/fancontrol
	fi
	exit 0
fi

if [ -f "$1" ]
then
	LoadConfig $1
else
	LoadConfig /etc/fancontrol
fi

# Detect path to sensors
if echo "${AFCPWM[0]}" | grep -E -q '^/'
then
	DIR=/
elif echo "${AFCPWM[0]}" | grep -E -q '^hwmon[0-9]'
then
	DIR=/sys/class/hwmon
elif echo "${AFCPWM[0]}" | grep -E -q '^[1-9]*[0-9]-[0-9abcdef]{4}'
then
	DIR=/sys/bus/i2c/devices
else
	echo "$0: Invalid path to sensors" >&2
	exit 1
fi

if [ ! -d $DIR ]
then
	echo $0: 'No sensors found! (did you load the necessary modules?)' >&2
	exit 1
fi
cd $DIR

# Check for configuration change
if [ "$DIR" != "/" ] && [ -z "$DEVPATH" -o -z "$DEVNAME" ]
then
	echo "Configuration is too old, please run pwmconfig again" >&2
	exit 1
fi
if [ "$DIR" = "/" -a -n "$DEVPATH" ]
then
	echo "Unneeded DEVPATH with absolute device paths" >&2
	exit 1
fi
if ! ValidateDevices "$DEVPATH" "$DEVNAME"
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" ]
then
	echo "File $PIDFILE exists, is fancontrol already running?" >&2
	exit 1
fi
echo $$ > "$PIDFILE"

# associative arrays to hold pwmN device name as key, and as value the
# pwmN_enable and pwmN values as they were before fancontrol was started
declare -A PWM_ENABLE_ORIG_STATE
declare -A PWM_ORIG_STATE

# $1 = pwm file name
function pwmdisable()
{
	local ENABLE=${1}_enable

	# No enable file? Just set to max
	if [ ! -f $ENABLE ]
	then
		echo $MAX > $1
		return 0
	fi

	# Try to restore pwmN and pwmN_enable value to the same state as before
	# fancontrol start. Restoring the pwmN value is tried first, before the
	# pwmN_enable mode switch.
	# Some chips seem to need this to properly restore fan operation,
	# when activating automatic (2) mode.
	if [ ${PWM_ENABLE_ORIG_STATE[${1}]} ]
	then
		#restore the pwmN value
		if [ "$DEBUG" != "" ]
		then
			echo "Restoring ${1} original value of ${PWM_ORIG_STATE[${1}]}"
		fi
		echo ${PWM_ORIG_STATE[${1}]} > ${1} 2> /dev/null
		# restore the pwmN_enable value, if it is not 1.
		# 1 is already set through fancontrol and setting it again might just
		# reset the pwmN value.
		if [ ${PWM_ENABLE_ORIG_STATE[${1}]} != 1 ]
		then
			if [ "$DEBUG" != "" ]
			then
				echo "Restoring $ENABLE original value of ${PWM_ENABLE_ORIG_STATE[${1}]}"
			fi
			echo ${PWM_ENABLE_ORIG_STATE[${1}]} > $ENABLE 2> /dev/null
			# check if setting pwmN_enable value was successful. Checking the
			# pwmN value makes no sense, as it might already have been altered
			# by the chip.
			if [ "$(cat $ENABLE)" = ${PWM_ENABLE_ORIG_STATE[${1}]} ]
			then
				return 0
			fi
		# if pwmN_enable is manual (1), check if restoring the pwmN value worked
		elif [ "$(cat ${1})" = ${PWM_ORIG_STATE[${1}]} ]
		then
			return 0
		fi
	fi

	# Try pwmN_enable=0
	echo 0 > $ENABLE 2> /dev/null
	if [ "$(cat $ENABLE)" -eq 0 ]
	then
		# Success
		return 0
	fi

	# It didn't work, try pwmN_enable=1 pwmN=255
	echo 1 > $ENABLE 2> /dev/null
	echo $MAX > $1
	if [ "$(cat $ENABLE)" -eq 1 -a "$(cat $1)" -ge 190 ]
	then
		# Success
		return 0
	fi

	# Nothing worked
	echo "$ENABLE stuck to" "$(cat $ENABLE)" >&2
	return 1
}

# $1 = pwm file name
function pwmenable()
{
	local ENABLE=${1}_enable

	if [ -f $ENABLE ]
	then
		# save the original pwmN_control state, e.g. 1 for manual or 2 for auto,
		# and the value from pwmN
		local PWM_CONTROL_ORIG=$(cat $ENABLE)
		local PWM_ORIG=$(cat ${1})
		if [ "$DEBUG" != "" ]
		then
			echo "Saving $ENABLE original value as $PWM_CONTROL_ORIG"
			echo "Saving ${1} original value as $PWM_ORIG"
		fi
		#check for degenerate case where these values might be empty
		if [ $PWM_CONTROL_ORIG ] && [ $PWM_ORIG ]
		then
			PWM_ENABLE_ORIG_STATE[${1}]=$PWM_CONTROL_ORIG
			PWM_ORIG_STATE[${1}]=$PWM_ORIG
		fi
		# enable manual control by fancontrol
		echo 1 > $ENABLE 2> /dev/null
		if [ $? -ne 0 ]
		then
			return 1
		fi
	fi
	echo $MAX > $1
}

function restorefans()
{
	local status=$1 fcvcount pwmo

	echo 'Aborting, restoring fans...'
	let fcvcount=0
	while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs
	do
		pwmo=${AFCPWM[$fcvcount]}
		pwmdisable $pwmo
		let fcvcount=$fcvcount+1
	done
	echo 'Verify fans have returned to full speed'
	rm -f "$PIDFILE"
	exit $status
}

trap 'restorefans 0' SIGQUIT SIGTERM
trap 'restorefans 1' SIGHUP SIGINT

# main function
function UpdateFanSpeeds
{
	local fcvcount
	local pwmo tsens fan mint maxt minsa minso minpwm maxpwm
	local tval pwmpval fanval min_fanval one_fan one_fanval
	local -i pwmval

	let fcvcount=0
	while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs
	do
		#hopefully shorter vars will improve readability:
		pwmo=${AFCPWM[$fcvcount]}
		tsens=${AFCTEMP[$fcvcount]}
		fan=${AFCFAN[$fcvcount]}
		let mint="${AFCMINTEMP[$fcvcount]}*1000"
		let maxt="${AFCMAXTEMP[$fcvcount]}*1000"
		minsa=${AFCMINSTART[$fcvcount]}
		minso=${AFCMINSTOP[$fcvcount]}
		minpwm=${AFCMINPWM[$fcvcount]}
		maxpwm=${AFCMAXPWM[$fcvcount]}

		read tval < ${tsens}
		if [ $? -ne 0 ]
		then
			echo "Error reading temperature from $DIR/$tsens"
			restorefans 1
		fi

		read pwmpval < ${pwmo}
		if [ $? -ne 0 ]
		then
			echo "Error reading PWM value from $DIR/$pwmo"
			restorefans 1
		fi

		# If fanspeed-sensor output shall be used, do it
		if [[ -n ${fan} ]]
		then
			min_fanval=100000
			fanval=
			# A given PWM output can control several fans
			for one_fan in $(echo $fan | sed -e 's/+/ /')
			do
				read one_fanval < ${one_fan}
				if [ $? -ne 0 ]
				then
					echo "Error reading Fan value from $DIR/$one_fan" >&2
					restorefans 1
				fi

				# Remember the minimum, it only matters if it is 0
				if [ $one_fanval -lt $min_fanval ]
				then
					min_fanval=$one_fanval
				fi

				if [ -z "$fanval" ]
				then
					fanval=$one_fanval
				else
					fanval="$fanval/$one_fanval"
				fi
			done
		else
			min_fanval=1  # set it to a non zero value, so the rest of the script still works
		fi

		# debug info
		if [ "$DEBUG" != "" ]
		then
			echo "pwmo=$pwmo"
			echo "tsens=$tsens"
			echo "fan=$fan"
			echo "mint=$mint"
			echo "maxt=$maxt"
			echo "minsa=$minsa"
			echo "minso=$minso"
			echo "minpwm=$minpwm"
			echo "maxpwm=$maxpwm"
			echo "tval=$tval"
			echo "pwmpval=$pwmpval"
			echo "fanval=$fanval"
			echo "min_fanval=$min_fanval"
		fi

		if (( $tval <= $mint ))
		  then pwmval=$minpwm # below min temp, use defined min pwm
		elif (( $tval >= $maxt ))
		  then pwmval=$maxpwm # over max temp, use defined max pwm
		else
		  # calculate the new value from temperature and settings
		  pwmval="(${tval}-${mint})*(${maxpwm}-${minso})/(${maxt}-${mint})+${minso}"
		  if [ $pwmpval -eq 0 -o $min_fanval -eq 0 ]
		  then # if fan was stopped start it using a safe value
		  	echo $minsa > $pwmo
			# Sleep while still handling signals
			sleep 1 &
			wait
		  fi
		fi
		echo $pwmval > $pwmo # write new value to pwm output
		if [ $? -ne 0 ]
		then
			echo "Error writing PWM value to $DIR/$pwmo" >&2
			restorefans 1
		fi
		if [ "$DEBUG" != "" ]
		then
			echo "new pwmval=$pwmval"
		fi
		let fcvcount=$fcvcount+1
	done
}

echo 'Enabling PWM on fans...'
let fcvcount=0
while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs
do
	pwmo=${AFCPWM[$fcvcount]}
	pwmenable $pwmo
	if [ $? -ne 0 ]
	then
		echo "Error enabling PWM on $DIR/$pwmo" >&2
		restorefans 1
	fi
	let fcvcount=$fcvcount+1
done

echo 'Starting automatic fan control...'

# main loop calling the main function at specified intervals
while true
do
	UpdateFanSpeeds
	# Sleep while still handling signals
	sleep $INTERVAL &
	wait
done

 

 

 

 

12 hours ago, freed00m said:

I think shutdowns will always be noisy, because the script ends and there is a TRAP signal that turns it to 100% .

Line 394 >> declare -A PWM_ENABLE_ORIG_STATE

Line 395 >> declare -A PWM_ORIG_STATE

Spoiler
# associative arrays to hold pwmN device name as key, and as value the
# pwmN_enable and pwmN values as they were before fancontrol was started
declare -A PWM_ENABLE_ORIG_STATE
declare -A PWM_ORIG_STATE

# $1 = pwm file name
function pwmdisable()
{
	local ENABLE=${1}_enable

	# No enable file? Just set to max
	if [ ! -f $ENABLE ]
	then
		echo $MAX > $1
		return 0
	fi

	# Try to restore pwmN and pwmN_enable value to the same state as before
	# fancontrol start. Restoring the pwmN value is tried first, before the
	# pwmN_enable mode switch.
	# Some chips seem to need this to properly restore fan operation,
	# when activating automatic (2) mode.
	if [ ${PWM_ENABLE_ORIG_STATE[${1}]} ]
	then
		#restore the pwmN value
		if [ "$DEBUG" != "" ]
		then
			echo "Restoring ${1} original value of ${PWM_ORIG_STATE[${1}]}"
		fi
		echo ${PWM_ORIG_STATE[${1}]} > ${1} 2> /dev/null
		# restore the pwmN_enable value, if it is not 1.
		# 1 is already set through fancontrol and setting it again might just
		# reset the pwmN value.
		if [ ${PWM_ENABLE_ORIG_STATE[${1}]} != 1 ]
		then
			if [ "$DEBUG" != "" ]
			then
				echo "Restoring $ENABLE original value of ${PWM_ENABLE_ORIG_STATE[${1}]}"
			fi
			echo ${PWM_ENABLE_ORIG_STATE[${1}]} > $ENABLE 2> /dev/null
			# check if setting pwmN_enable value was successful. Checking the
			# pwmN value makes no sense, as it might already have been altered
			# by the chip.
			if [ "$(cat $ENABLE)" = ${PWM_ENABLE_ORIG_STATE[${1}]} ]
			then
				return 0
			fi
		# if pwmN_enable is manual (1), check if restoring the pwmN value worked
		elif [ "$(cat ${1})" = ${PWM_ORIG_STATE[${1}]} ]
		then
			return 0
		fi
	fi

	# Try pwmN_enable=0
	echo 0 > $ENABLE 2> /dev/null
	if [ "$(cat $ENABLE)" -eq 0 ]
	then
		# Success
		return 0
	fi

	# It didn't work, try pwmN_enable=1 pwmN=255
	echo 1 > $ENABLE 2> /dev/null
	echo $MAX > $1
	if [ "$(cat $ENABLE)" -eq 1 -a "$(cat $1)" -ge 190 ]
	then
		# Success
		return 0
	fi

	# Nothing worked
	echo "$ENABLE stuck to" "$(cat $ENABLE)" >&2
	return 1
}

# $1 = pwm file name
function pwmenable()
{
	local ENABLE=${1}_enable

	if [ -f $ENABLE ]
	then
		# save the original pwmN_control state, e.g. 1 for manual or 2 for auto,
		# and the value from pwmN
		local PWM_CONTROL_ORIG=$(cat $ENABLE)
		local PWM_ORIG=$(cat ${1})
		if [ "$DEBUG" != "" ]
		then
			echo "Saving $ENABLE original value as $PWM_CONTROL_ORIG"
			echo "Saving ${1} original value as $PWM_ORIG"
		fi
		#check for degenerate case where these values might be empty
		if [ $PWM_CONTROL_ORIG ] && [ $PWM_ORIG ]
		then
			PWM_ENABLE_ORIG_STATE[${1}]=$PWM_CONTROL_ORIG
			PWM_ORIG_STATE[${1}]=$PWM_ORIG
		fi
		# enable manual control by fancontrol
		echo 1 > $ENABLE 2> /dev/null
		if [ $? -ne 0 ]
		then
			return 1
		fi
	fi
	echo $MAX > $1
}

 

>> /usr/sbin/pwmconfig

 

 

 

 

12 hours ago, freed00m said:

But not sure if MAXPWN affects the AFCPWM values in that script.

line 46  >> function LoadConfig

line 108 

 

Line 521 >> function UpdateFanSpeeds
Line 609

Spoiler
function LoadConfig
...
		AFCMAXPWM[$fcvcount]=$(echo $MAXPWM |sed -e 's/ /\n/g' |grep -E "${AFCPWM[$fcvcount]}" |cut -d'=' -f2)
        	[ -z "${AFCMAXPWM[$fcvcount]}" ] && AFCMAXPWM[$fcvcount]=255
...

# main function
function UpdateFanSpeeds
{
	local fcvcount
	local pwmo tsens fan mint maxt minsa minso minpwm maxpwm
	local tval pwmpval fanval min_fanval one_fan one_fanval
	local -i pwmval

	let fcvcount=0
	while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs
	do
		#hopefully shorter vars will improve readability:
		pwmo=${AFCPWM[$fcvcount]}
		tsens=${AFCTEMP[$fcvcount]}
		fan=${AFCFAN[$fcvcount]}
		let mint="${AFCMINTEMP[$fcvcount]}*1000"
		let maxt="${AFCMAXTEMP[$fcvcount]}*1000"
		minsa=${AFCMINSTART[$fcvcount]}
		minso=${AFCMINSTOP[$fcvcount]}
		minpwm=${AFCMINPWM[$fcvcount]}
		maxpwm=${AFCMAXPWM[$fcvcount]}

		read tval < ${tsens}
		if [ $? -ne 0 ]
		then
			echo "Error reading temperature from $DIR/$tsens"
			restorefans 1
		fi

		read pwmpval < ${pwmo}
		if [ $? -ne 0 ]
		then
			echo "Error reading PWM value from $DIR/$pwmo"
			restorefans 1
		fi

		# If fanspeed-sensor output shall be used, do it
		if [[ -n ${fan} ]]
		...
		fi

		# debug info
		if [ "$DEBUG" != "" ]
		then
			echo "pwmo=$pwmo"
			echo "tsens=$tsens"
			echo "fan=$fan"
			echo "mint=$mint"
			echo "maxt=$maxt"
			echo "minsa=$minsa"
			echo "minso=$minso"
			echo "minpwm=$minpwm"
			echo "maxpwm=$maxpwm"
			echo "tval=$tval"
			echo "pwmpval=$pwmpval"
			echo "fanval=$fanval"
			echo "min_fanval=$min_fanval"
		fi

		if (( $tval <= $mint ))
		  then pwmval=$minpwm # below min temp, use defined min pwm
		elif (( $tval >= $maxt ))
		  then pwmval=$maxpwm # over max temp, use defined max pwm
		else
		  # calculate the new value from temperature and settings
		  pwmval="(${tval}-${mint})*(${maxpwm}-${minso})/(${maxt}-${mint})+${minso}"
		  if [ $pwmpval -eq 0 -o $min_fanval -eq 0 ]
		  then # if fan was stopped start it using a safe value
		  	echo $minsa > $pwmo
			# Sleep while still handling signals
			sleep 1 &
			wait
		  fi
		fi
      	...
	done
}

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...