0
0
mirror of https://github.com/libretro/Lakka-LibreELEC.git synced 2025-03-01 10:21:22 +00:00
Tomáš Kelemen (vudiq) 4a4db97403 PiBoyDmg: build xpi-gamecon in kernel, adapt scripts
the module is required also during update process, having it as external
module leads to an unexpected shutdown of the device during the update
process, which leads to potential corruption of file system.

Co-authored-by: David Lawson <dmrlawson@gmail.com>
Co-authored-by: Tomáš Kelemen <vudiq@vudiq.sk>
2021-10-16 18:06:37 +02:00

43 lines
860 B
Bash
Executable File

#!/bin/bash
stop_retroarch() {
systemctl stop \
retroarch.service \
tmp-assets.mount \
tmp-cheats.mount \
tmp-cores.mount \
tmp-database.mount \
tmp-joypads.mount \
tmp-overlays.mount \
tmp-shaders.mount \
tmp-system.mount
}
while [ 2 -gt 1 ]
do
sleep 1
VOL=`cat /sys/kernel/xpi_gamecon/volume`
TEMP=`cat /sys/class/thermal/thermal_zone0/temp`
POWERSW=`cat /sys/kernel/xpi_gamecon/status`
BATTERY=`cat /sys/kernel/xpi_gamecon/percent`
amixer -M set Headphone $VOL%
if [[ $TEMP -gt 70000 ]]
then
echo 100 > /sys/kernel/xpi_gamecon/fan
else
echo 0 > /sys/kernel/xpi_gamecon/fan
fi
if [[ $POWERSW -eq 6 ]]
then
stop_retroarch
echo "0" > /sys/kernel/xpi_gamecon/flags
/usr/sbin/shutdown -P
fi
if [[ $BATTERY -lt 5 ]]
then
stop_retroarch
echo "0" > /sys/kernel/xpi_gamecon/flags
/usr/sbin/shutdown -P
fi
done