Files
openwrt-armor-g5/target/linux/kirkwood/base-files/sbin/fan_ctrl.sh
domenico 27c9d80f51
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
Initial commit
2025-06-24 12:51:15 +02:00

24 lines
590 B
Bash
Executable File

#!/bin/sh
CPU_TEMP=$(cut -c1-2 /sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-0048/hwmon/hwmon?/temp1_input)
CPU_LOW=45
CPU_MID=50
CPU_HIGH=55
if [ ! -e /sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-001b/hwmon/hwmon?/pwm1 ]; then
exit 0
else
FAN_CTRL=$(ls /sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-001b/hwmon/hwmon?/pwm1)
fi
if [ "$CPU_TEMP" -ge "$CPU_HIGH" ]; then
echo "255" > $FAN_CTRL
elif [ "$CPU_TEMP" -ge "$CPU_MID" ]; then
echo "100" > $FAN_CTRL
elif [ "$CPU_TEMP" -ge "$CPU_LOW" ]; then
echo "50" > $FAN_CTRL
else
echo "0" > $FAN_CTRL
fi