You are not logged in.

#1 2024-01-16 12:10:28

guilty_p01nt3r
Member
Registered: 2024-01-16
Posts: 1

Set fan speed from script doesn't work

EDIT: I solved adding a cd command into  the /sys/class/drm/card1/device/gpu_od/fan_ctrl  before writing to fan_curve (maybe there were some problems with the soft link while writing the 'c' from a script, idk), a simple script like this just works:

#!/usr/bin/bash

cd /sys/class/drm/card1/device/gpu_od/fan_ctrl

echo "Setting fan target"
echo "85" > fan_target_temperature
echo "c" > fan_target_temperature
echo "Committed fan target"

sleep 1

echo "Setting fan curve into"
echo "0 45 23"  >  fan_curve
echo "1 60 40"  >  fan_curve
echo "2 70 50"  >  fan_curve
echo "3 80 90"  >  fan_curve
echo "4 90 100" > fan_curve
echo c > fan_curve
echo "Committed fan curve"

---

Old Question:

Hi,
I encountered a strange problem.

If I manually echo value into

/sys/class/drm/card1/device/gpu_od/fan_ctrl/fan_curve

when committing the fan speed changes. But if I run the following script it does not.

#!/usr/bin/bash

GPU_DEVICE="/sys/class/drm/card1/device"
GPU_SYSFS="$GPU_DEVICE/gpu_od/fan_ctrl"

GPU_FAN_CURVE="$GPU_SYSFS/fan_curve"
GPU_FAN_CURVE_0="0 45 23"
GPU_FAN_CURVE_1="1 60 40"
GPU_FAN_CURVE_2="2 70 50"
GPU_FAN_CURVE_3="3 80 90"
GPU_FAN_CURVE_4="4 90 100"

GPU_FAN_TARGET="$GPU_SYSFS/fan_target_temperature"
GPU_FAN_TARGET_TEMP="85"

echo "Setting fan curve"
echo "$GPU_FAN_CURVE_0" > "$GPU_FAN_CURVE"
echo "$GPU_FAN_CURVE_1" > "$GPU_FAN_CURVE"
echo "$GPU_FAN_CURVE_2" > "$GPU_FAN_CURVE"
echo "$GPU_FAN_CURVE_3" > "$GPU_FAN_CURVE"
echo "$GPU_FAN_CURVE_4" > "$GPU_FAN_CURVE"
echo "c" > "$GPU_FAN_CURVE"
echo "Committed fan curve"

#echo "Setting fan target to $GPU_FAN_TARGET_TEMP"
#echo "$GPU_FAN_TARGET_TEMP" > "$GPU_FAN_TARGET"
#echo "Committing fan target"
#echo "c" > "$GPU_FAN_TARGET" && \
#echo "Committed fan target"

I checked the /sys/class/drm/card1/device/gpu_od/fan_ctrl/fan_curve after executing the script, and showed the correct values:

OD_FAN_CURVE:
0: 45C 23%
1: 60C 40%
2: 70C 50%
3: 80C 90%
4: 90C 100%
OD_RANGE:
FAN_CURVE(hotspot temp): 25C 100C
FAN_CURVE(fan speed): 23% 100%

But the fan speed doesn't change until I spin up a terminal, manually set any temperature entry (even the same) and commit it:

echo "0 45 23" > /sys/class/drm/card1/device/gpu_od/fan_ctrl/fan_curve && echo "c" > /sys/class/drm/card1/device/gpu_od/fan_ctrl/fan_curve

Is there some problem when writing in there from a script? It seems it doesn't switch to manual mode when executing the script. It should do it automatically when committing values (as described here: docs)

Last edited by guilty_p01nt3r (2024-01-17 09:47:29)

Offline

Board footer

Powered by FluxBB