add fan-control station m3 (#4837)

This commit is contained in:
Oleg
2023-02-18 00:51:02 +03:00
committed by GitHub
parent 523c4f2149
commit 4aac2fca72
4 changed files with 62 additions and 0 deletions

View File

@@ -332,6 +332,12 @@ family_tweaks() {
echo "su -c '/usr/bin/rtk_hciattach -n -s 115200 /dev/ttyS2 rtk_h5 &'" >> $SDCARD/etc/rc.local
echo "exit 0" >> $SDCARD/etc/rc.local
fi
if [[ $BRANCH == legacy && ($BOARD == station-m3) ]]; then
install -m 755 $SRC/packages/blobs/station/firefly_fan_control $SDCARD/usr/bin/firefly_fan_control
install -m 755 $SRC/packages/blobs/station/firefly-fan-init $SDCARD/usr/bin/firefly-fan-init
install -m 755 $SRC/packages/blobs/station/firefly-fan.service $SDCARD/usr/lib/systemd/system/firefly-fan.service
chroot $SDCARD /bin/bash -c "systemctl --no-reload enable firefly-fan.service >/dev/null 2>&1"
fi
fi

View File

@@ -0,0 +1,47 @@
#!/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

View File

@@ -0,0 +1,9 @@
[Unit]
Description=start firefly-fan service
[Service]
Type=simple
ExecStart=/usr/bin/firefly-fan-init
[Install]
WantedBy=local-fs.target

Binary file not shown.