Created
March 25, 2022 17:07
-
-
Save Lessica/30240b63ac0e47d80a919209ea006c60 to your computer and use it in GitHub Desktop.
Configure Raspberry Pi + Argon One Case for Lineage OS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/system/bin/sh | |
sleeptime=120 | |
while true | |
do | |
cputemp=$(cat /sys/class/thermal/thermal_zone0/temp) | |
if [[ $cputemp -lt 55000 ]]; then | |
fanspeed="0x00" | |
elif [ $cputemp -ge 55000 -a $cputemp -lt 60000 ]; then | |
fanspeed="0x10" | |
elif [ $cputemp -ge 60000 -a $cputemp -lt 65000 ]; then | |
fanspeed="0x32" | |
elif [ $cputemp -ge 65000 ]; then | |
fanspeed="0x64" | |
fi | |
i2cget -y 1 0x01a $fanspeed | |
sleep $sleeptime | |
done |
just in case if your fan running on official gpio 14 pin or you have pwm controlled fan, you can use this script to control fan.
sleeptime=120
echo 14 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio14/direction
echo 0 > /sys/class/gpio/gpio14/value
echo `date` > /data/local/fan-script.log
while true
do
cputemp=$(cat /sys/class/thermal/thermal_zone0/temp)
echo $cputemp >> /data/local/fan-script.log
if [[ $cputemp -lt 55000 ]]; then
echo 0 > /sys/class/gpio/gpio14/value
elif [ $cputemp -ge 65000 ]; then
echo 1 > /sys/class/gpio/gpio14/value
fi
sleep $sleeptime
done
just in case if your fan running on official gpio 14 pin or you have pwm controlled fan, you can use this script to control fan.
sleeptime=120 echo 14 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio14/direction echo 0 > /sys/class/gpio/gpio14/value echo `date` > /data/local/fan-script.log while true do cputemp=$(cat /sys/class/thermal/thermal_zone0/temp) echo $cputemp >> /data/local/fan-script.log if [[ $cputemp -lt 55000 ]]; then echo 0 > /sys/class/gpio/gpio14/value elif [ $cputemp -ge 65000 ]; then echo 1 > /sys/class/gpio/gpio14/value fi sleep $sleeptime done
I'm using the case as it came, where should I copy this file to? thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@mshs013
Clone any other file from that folder, and edit it with your code (permissions were the culprit). Also change "#!/system/bin/sh" with "#!/vendor/bin/sh", I don't know if this is needed but in my case it worked. I've tested it on LineageOS 20 - KonstaKANG Android 13.
Good permissions (group 2000 in my case was edited as root by ubuntu, but still good)