Recalbox Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • recalbox.com
    • Gitlab repository
    • Documentation
    • Discord

    Script for auto-switching between gpio LCD and HDMI doesn't work.

    Recalbox General
    script auto-switching between gpio lcd hdmi doesnt work
    2
    2
    171
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • greger
      greger last edited by

      Hi. I'm want to auto-switch between a gpio LCD and HDMI-Out on a Raspberry Pi 3.
      I found this guide that I'm trying to follow: https://www.reddit.com/r/raspberry_pi/comments/6lq09q/autoswitch_between_lcd_and_hdmiout/

      So I made two different config files, config_lcd.txt and config_hdmi.txt
      And now I'm trying to run this script in "/recalbox/share/system/custom.sh", but it doesn't work correctly.
      It just says: "device_name=RTK-32V3H-H6A" when I have the both the LCD and HDMI connected. But it never reboots and change the output to the HDMI.

      What have I done wrong?

      #!/bin/bash
      
      #HDMI connection?
      rm -f hdmi.name
      tvservice -n 2>hdmi.name
      HDMI_NAME=$(cat hdmi.name)
      #echo $HDMI_NAME
      if [ "$HDMI_NAME" == "[E] No device present" ]; then
      	LCD_ON=$(grep "hdmi_drive=2" /boot/config.txt)
      #	echo $LCD_ON
      #	echo "LCD On"
      	if [ "$LCD_ON" == "hdmi_drive=2" ]; then
      #		echo "reboot to LCD"
      		sudo rm -f /boot/config.txt
      		sudo cp /boot/config_lcd.txt /boot/config.txt
      		sudo reboot -n
      	fi
      else
      	HDMI_ON=$(grep "lcd_rotate=2" /boot/config.txt)
      #	echo $HDMI_ON
      #	echo "HDMI ON"
      	if [ "$HDMI_ON" == "lcd_rotate=2" ]; then
      #		echo "reboot to HDMI"
      		sudo rm -f /boot/config.txt
      		sudo cp /boot/config_hdmi.txt /boot/config.txt
      		sudo reboot -n
      	fi
      fi
      
      Zing 1 Reply Last reply Reply Quote 0
      • Zing
        Zing Global moderator Translator @greger last edited by

        @greger

        What have I done wrong?

        You are using a tutorial from 3 years ago that claims it only worked on Raspbian / RetroPie, at no time does the tutorial say it is compatible with Recalbox.

        I'm not a developer, and I can't tell if the script is compatible or not, I can't test it, nor do I have enough technical knowledge to help you with that.

        Maybe this will help you:
        https://recalbox.gitbook.io/documentation/v/francais/tutoriels/systeme/modification/ajouter-votre-propre-script-au-demarrage

        Se a minha resposta foi útil, por favor, dê um voto positivo, clicando na seta para cima logo abaixo da resposta, ao lado de "citar".
        If my answer was helpful, please give a positive feedback by clicking the up arrow below the answer, next to "quote".

        1 Reply Last reply Reply Quote 0
        • First post
          Last post

        Want to support us ?

        68
        Online

        90.3k
        Users

        26.3k
        Topics

        181.8k
        Posts

        Copyright © 2021 recalbox.com