Skip to content

Commit 85558ff

Browse files
authored
Run RubikPi3 fan continuously (#118)
The standard fan control for the RubikPi3 isn't aggressive enough at turning on the fan. This changes our image so that the fan runs continuously at max speed.
1 parent d7a81f6 commit 85558ff

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

install_rubikpi3.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,36 @@ runcmd:
9898
- nmcli radio all off
9999
- touch /etc/cloud/cloud-init.disabled
100100
EOFUSERDATA
101+
102+
# Override the automatic fan control and set it to run continuously at full speed
103+
# Instructions provided by Rami
104+
105+
# 1. Disable the thermal service
106+
systemctl disable oem-tangshan-rubikpi3-thermal.service
107+
108+
# 2. Create the fan helper script
109+
cat > /usr/local/sbin/rubik-fan-max.sh << EOF_MAX_FAN
110+
#!/bin/sh
111+
hwmon_dir=$(readlink -f /sys/devices/platform/pwm-fan/hwmon/hwmon*)
112+
echo 0 > "$hwmon_dir/pwm1_enable"
113+
echo 255 > "$hwmon_dir/pwm1"
114+
EOF_MAX_FAN
115+
116+
chmod +x /usr/local/sbin/rubik-fan-max.sh
117+
118+
# 3. Add a oneshot systemd unit
119+
cat > /etc/systemd/system/rubik-fan-max.service << EOF_FAN_SERVICE
120+
[Unit]
121+
Description=Force Rubik Pi fan to full speed
122+
After=multi-user.target
123+
124+
[Service]
125+
Type=oneshot
126+
ExecStart=/usr/local/sbin/rubik-fan-max.sh
127+
128+
[Install]
129+
WantedBy=multi-user.target
130+
EOF_FAN_SERVICE
131+
132+
# 4. Enable the new service
133+
systemctl enable rubik-fan-max.service

0 commit comments

Comments
 (0)