build/packages/blobs/station/firefly-fan-init

48 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
BOARD_VERSION=`cat /sys/firmware/devicetree/base/model | awk -F ' ' {'print $1'}`
RK3588_BOARD_VERSION=`cat /sys/firmware/devicetree/base/model | awk -F ' ' {'print $2'}`
sleep 3
if [ "$BOARD_VERSION" == "CS-R2-3399JD4-MAIN" ]; then
#usb_net power on
echo 1 > /sys/class/leds/HUB30_PWR_EN/brightness
/usr/bin/firefly_fan_control CS-R2-3399JD4-MAIN > /dev/null 2>&1 &
elif [ "$BOARD_VERSION" == "CS-R1-3399JD4-MAIN" ]; then
echo 0 > /sys/class/pwm/pwmchip0/export
/usr/bin/firefly_fan_control CS-R1-3399JD4-MAIN > /dev/null 2>&1 &
while true
do
if [ `cat /sys/class/pwm/pwmchip0/pwm0/enable` == "0" ]; then
sleep 2
echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable
elif [ `cat /sys/class/pwm/pwmchip0/pwm0/enable` == "1" ]; then
break
fi
done
elif [ "$RK3588_BOARD_VERSION" == "ROC-RK3588S-PC" ]; then
/usr/bin/firefly_fan_control ROC-RK3588S-PC > /dev/null 2>&1 &
elif [ "$RK3588_BOARD_VERSION" == "ITX-3588J" ]; then
/usr/bin/firefly_fan_control ITX-3588J > /dev/null 2>&1 &
elif [ "$RK3588_BOARD_VERSION" == "ROC-RK3588-PC" ]; then
/usr/bin/firefly_fan_control ROC-RK3588-PC > /dev/null 2>&1 &
else
exit 0
fi
while true
do
sleep 0.5
done
exit 0