From 4bd14b0d39cc306537f4dbd4bf8adef95d9ec6e0 Mon Sep 17 00:00:00 2001 From: openoms Date: Mon, 20 May 2019 07:38:50 +0100 Subject: [PATCH] add HDMI config to alternative diplay install --- alternative.platforms/dietpi/README.md | 2 +- ...tpi.display.sh => display.alternatives.sh} | 58 +++++++++++++++---- 2 files changed, 47 insertions(+), 13 deletions(-) rename alternative.platforms/{dietpi/dietpi.display.sh => display.alternatives.sh} (75%) diff --git a/alternative.platforms/dietpi/README.md b/alternative.platforms/dietpi/README.md index 877b661..1b41ae8 100644 --- a/alternative.platforms/dietpi/README.md +++ b/alternative.platforms/dietpi/README.md @@ -18,7 +18,7 @@ The HDMI screen tested: https://www.aliexpress.com/item/3-5-inch-LCD-HDMI-USB-To [Raspberry Pi](RaspberryPi.md) -[Display install script](dietpi.display.sh) +[Display install script](/alternative.platforms/display.alternatives.sh) --- diff --git a/alternative.platforms/dietpi/dietpi.display.sh b/alternative.platforms/display.alternatives.sh similarity index 75% rename from alternative.platforms/dietpi/dietpi.display.sh rename to alternative.platforms/display.alternatives.sh index d7f4767..ebe352d 100644 --- a/alternative.platforms/dietpi/dietpi.display.sh +++ b/alternative.platforms/display.alternatives.sh @@ -1,14 +1,21 @@ # To run this script on your RaspiBlitz, copy the following line to the ssh terminal (after the #): -# wget hhttps://raw.githubusercontent.com/rootzoll/raspiblitz/master/alternative.platforms/dietpi/dietpi.display.sh && sudo chmod +x dietpi.display.sh && ./dietpi.display.sh +# wget https://raw.githubusercontent.com/rootzoll/raspiblitz/master/alternative.platforms/display.alternatives.sh && sudo bash display.alternatives.sh -# keep in mind that DietPi for Raspberry is also a stripped down Raspbian echo "Detect Base Image ..." baseImage="?" isDietPi=$(uname -n | grep -c 'DietPi') isRaspbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Raspbian') +isArmbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Debian') +isUbuntu=$(cat /etc/os-release 2>/dev/null | grep -c 'Ubuntu') if [ ${isRaspbian} -gt 0 ]; then baseImage="raspbian" fi +if [ ${isArmbian} -gt 0 ]; then + baseImage="armbian" +fi +if [ ${isUbuntu} -gt 0 ]; then +baseImage="ubuntu" +fi if [ ${isDietPi} -gt 0 ]; then baseImage="dietpi" fi @@ -21,19 +28,16 @@ else echo "OK running ${baseImage}" fi - if [ "${baseImage}" = "raspbian" ]; then - echo "Press ENTER to install LCD and reboot ..." - read key - # give Raspi a default hostname (optional) - sudo raspi-config nonint do_hostname "RaspiBlitz" + OPTIONS=(GPIO "Install the default display available from Amazon" \ + HDMI "Install the 3.5\" HDMI display from Aliexpress" \ + SWISS "Install the Swiss version from play-zone.ch" + ) - # *** Display selection *** - dialog --title "Display" --yesno "Are you using the default display available from Amazon?\nSelect 'No' if you are using the Swiss version from play-zone.ch!" 6 80 - defaultDisplay=$? + CHOICE=$(dialog --backtitle "RaspiBlitz - Display Install" --clear --title "Display Install" --menu "Choose a your diplay:" 10 70 6 "${OPTIONS[@]}" 2>&1 >/dev/tty) - if [ "${defaultDisplay}" = "0" ]; then + if [ "${CHOICE}" = "GPIO" ]; then # *** RASPIBLITZ / LCD (at last - because makes a reboot) *** # based on https://www.elegoo.com/tutorial/Elegoo%203.5%20inch%20Touch%20Screen%20User%20Manual%20V1.00.2017.10.09.zip @@ -41,13 +45,41 @@ if [ "${baseImage}" = "raspbian" ]; then echo "--> LCD DEFAULT" cd /home/admin/ sudo apt-mark hold raspberrypi-bootloader + rm -r LCD-show git clone https://github.com/goodtft/LCD-show.git sudo chmod -R 755 LCD-show sudo chown -R admin:admin LCD-show cd LCD-show/ sudo ./LCD35-show - else + elif [ "${CHOICE}" = "HDMI" ]; then + echo "Installing the 3.5\" HDMI display from Aliexpress" + + # based on http://www.lcdwiki.com/3.5inch_HDMI_Display-B + rm -r LCD-show + git clone https://github.com/goodtft/LCD-show.git + sudo chmod -R 755 LCD-show + cd LCD-show/ + #sudo ./MPI3508-show + sudo rm -rf /etc/X11/xorg.conf.d/40-libinput.conf + sudo cp -rf ./boot/config-35-480X320.txt /boot/config.txt + sudo cp ./usr/cmdline.txt /boot/ + sudo cp ./usr/inittab /etc/ + sudo cp -rf ./usr/99-fbturbo.conf-HDMI /usr/share/X11/xorg.conf.d/99-fbturbo.conf + sudo mkdir -p /etc/X11/xorg.conf.d + sudo cp -rf ./usr/99-calibration.conf-3508 /etc/X11/xorg.conf.d/99-calibration.conf + + # based on https://www.raspberrypi-spy.co.uk/2014/04/how-to-change-the-command-line-font-size/ + # sudo sed -i 's/FONTFACE="Fixed"/FONTFACE="TerminusBold"/' /etc/default/console-setup + # sudo sed -i 's/FONTSIZE="8x16"/FONTSIZE="12x24"/' /etc/default/console-setup + + echo "***" + echo "reboot with \`sudo reboot\` to make the LCD work" + echo "***" + + exit + + elif [ "${CHOICE}" = "SWISS" ]; then # Download and install the driver # based on http://www.raspberrypiwiki.com/index.php/3.5_inch_TFT_800x480@60fps @@ -105,6 +137,7 @@ if [ "${baseImage}" = "dietpi" ]; then # based on https://www.elegoo.com/tutorial/Elegoo%203.5%20inch%20Touch%20Screen%20User%20Manual%20V1.00.2017.10.09.zip cd /home/admin/ #sudo apt-mark hold raspberrypi-bootloader + rm -r LCD-show git clone https://github.com/goodtft/LCD-show.git sudo chmod -R 755 LCD-show sudo chown -R admin:admin LCD-show @@ -135,6 +168,7 @@ if [ "${baseImage}" = "dietpi" ]; then echo "Installing the 3.5\" HDMI display from Aliexpress" # based on http://www.lcdwiki.com/3.5inch_HDMI_Display-B + rm -r LCD-show git clone https://github.com/goodtft/LCD-show.git sudo chmod -R 755 LCD-show cd LCD-show/