forked from RetroFlag/GPiCase2-Script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lcdfirst.sh
41 lines (34 loc) · 949 Bytes
/
lcdfirst.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
HDMI_HPD=18
echo $HDMI_HPD > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio18/direction
HDMI_HPD_VALUE=$(cat /sys/class/gpio/gpio$HDMI_HPD/value)
echo "HDMI_HPD_VALUE1=""$HDMI_HPD_VALUE"
if grep -q "enable_dpi_lcd=1" "/boot/config.txt" ; then
ISLCDFILE="1"
else
ISLCDFILE="0"
fi
echo "ISLCDFILE=""$ISLCDFILE"
if [ $HDMI_HPD_VALUE == "1" ]; then
if [ $ISLCDFILE == "1" ]; then
mount -o remount, rw /boot
mount -o remount, rw /
rm -f /boot/config_lcd.txt
cp -f "/boot/config.txt" "/boot/config_lcd.txt"
rm -f /boot/config.txt
cp -f "/boot/config_hdmi.txt" "/boot/config.txt"
shutdown -r now
sleep 10
fi
else
if [ $ISLCDFILE == "0" ]; then
mount -o remount, rw /boot
mount -o remount, rw /
rm -f /boot/config_hdmi.txt
cp -f "/boot/config.txt" "/boot/config_hdmi.txt"
rm -f /boot/config.txt
cp -f "/boot/config_lcd.txt" "/boot/config.txt"
shutdown -r now
sleep 10
fi
fi