5452cea412
* enabling dual display mode * Add files via upload * enabling dual display * Update README.md * Delete a64-olinuxino-hdmi.dtb * Delete a64-olinuxino-lcd.dtb
57 lines
1.4 KiB
Bash
57 lines
1.4 KiB
Bash
#!/bin/bash
|
|
|
|
if [[ $EUID -ne 0 ]]; then
|
|
echo "This tool must run as root. Exiting..." >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Find root device
|
|
for cmd in $(cat /proc/cmdline); do
|
|
[[ $(cut -d'=' -f1 <<< $cmd) == "root" ]] && \
|
|
root_device=$(cut -d'=' -f2 <<< $cmd) && \
|
|
boot_device="${root_device%?}1" && break
|
|
done
|
|
[[ -z $boot_device ]] && echo "Unknown boot device. Exiting..." >&2 && exit 1
|
|
|
|
# Make sure correct boot partition is mounted
|
|
df | grep -q $boot_device && umount /boot
|
|
mount $boot_device /boot
|
|
|
|
choices=$(dialog \
|
|
--title "Configure display output" \
|
|
--menu "\nChoose an option: \n" 10 60 7 \
|
|
1 "Enable LCD+HDMI display outputs" \
|
|
2 "Disable HDMI display output" \
|
|
2>&1 >/dev/tty)
|
|
|
|
[[ -z $choices ]] && exit 0
|
|
for choice in $choices
|
|
do
|
|
case $choice in
|
|
1)
|
|
[[ -e /boot/a64/a64-olinuxino-hdmi.dtb ]] && \
|
|
cp -f /opt/teres/hdmi/a64-olinuxino.dtb /boot/a64/a64-olinuxino.dtb
|
|
! grep -q "hdmi" /etc/modules && echo "hdmi" >> /etc/modules
|
|
rm /etc/X11/xorg.conf.d/*
|
|
cp /opt/teres/hdmi/xorg/* /etc/X11/xorg.conf.d
|
|
;;
|
|
|
|
2)
|
|
[[ -e /boot/a64/a64-olinuxino-lcd.dtb ]] && \
|
|
cp -f /opt/teres/lcd/a64-olinuxino.dtb /boot/a64/a64-olinuxino.dtb
|
|
sed -i '/hdmi/d' /etc/modules
|
|
rm /etc/X11/xorg.conf.d/*
|
|
cp /opt/teres/lcd/xorg/* /etc/X11/xorg.conf.d
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Display reboot confirmation
|
|
dialog \
|
|
--title "Almost done" \
|
|
--yes-label "Reboot" \
|
|
--no-label "Exit" \
|
|
--yesno "\nAll done.\nBoard must be rebooted to apply changes." 7 70
|
|
[[ $? -ne 0 ]] && exit 0
|
|
reboot
|