[SOLVED] Swap from lcd to full size screen (both via hdmi port)
-
Thanks to the hints by @Howitzer99 and @caver01 I (unelegantly but still) solved my issue.
DISCLAIMER:
Feel free to follow these steps and to comment/modify/add different information about a solution. Just remeber I am not responsible for any damage or data loss that could occurs.Here is what I've done:
- create two different config files starting from the original config.txt. For me, they are config.lcd to whom I added this code:
#lcd configuration hdmi_drive=1 max_usb_current=1 hdmi_group=2 hdmi_mode=1 hdmi_mode=87 hdmi_cvt 800 480 60 6 0 0 0 disable_audio_dither=1
and config.hdmi, whom I added these lines instead:
# generic TV configuration hdmi_drive=2 hdmi_group=2
-
create a cfg directory in boot and put config.lcd and config.hdmi inside;
-
Install some of the PORTS game in RetroPie via the optional packet installer (find a guide regarding this.... it's simple). I used "lr-prboom" (it installs Doom shareware);
-
create two different scripts. Each one will be bind to one of the configuration files in boot/cfg directory. I created:
1_LCD_output.sh with code:
#!/bin/bash #this script will change config.txt to allow video output to lcd sudo rm -f /boot/config.txt sudo cp /boot/cfg/config.lcd /boot/config.txt
and 2_TV_output .sh with code:
#!/bin/bash #this script will change config.txt to allow video output to generic tv sudo rm -f /boot/config.txt sudo cp /boot/cfg/config.hdmi /boot/config.txt
-
now copy the two sh scripts in the directory that contains your ports. For me, it is "RetroPie/roms/ports" and make them executable. I used the command from console chmod a=rwx for each 1_LCD_output.sh and 2_TV_output .sh;
-
Rebooting your RetroPie and going in PORTS shall show you those two scripts as if they are two roms. Click on one you need and run it;
-
shut down the system;
-
connect the screen corrispondent to the script you run and....enjoy!
NOTE: if you are going to swap from a scrren to another remember to ALWAYS choose the right script BEFORE you connect it via hdmi cable or you will not able to use the RasPi due to the incompatibility of the settings.
NOTE 2: sometimes it needs to be rebooted a couple of times before the code starts to behave in a correct way... not much of an issue for me.And now the original post:
Hi, recently I've been thinking if it's possible to add a menu option to let Retropie overwrite Raspi "config.txt" and then shut down the system. At the next boot the overwritten version of the file could activate different functions.
This is just to modify the contents of "config.txt" with different version(s) of the file prepared beforehand and stored somewhere without using a keyboard or removing the SD and manually modify the file with another pc.
This would let you, for example, disconnect an lcd screen (previosly recognized thanks to cvt_) and connect another screen with a different resolution (and different cvt_ parameters).
Or this would help swapping from a "config.txt" in which Raspi's overclocked to a "config" in which it isn't.
Am I daydreaming or there are other people out there sick of continously fiddle with the config.txt?my config:
- Raspi 3 B+
- Retropie 4.2 (installed via microSD from official image) -
@sahelX Seems like a good idea for a portable set-top box. If you had a handful of configs you could swap them around with a script easily enough, then setup a "sysetm" in Emulation Station or or something to kick-off the different options. Lots of ways to go with this.
You can also do video settings on the fly if a reboot isn't required using commands from this thread.
-
@caver01 thanks. It's nice to see someone that doesn't think I'm telling bullshit. (By the way, your 4-player cocktail case is fantastic)
The problem here is that I doubt something like this will be seriously implemented in an official release because it could be considered too peculiar.
If I was a programmer myself I would definitely try it. If someone will help me, I will think of a small reward. -
I'm also occasionally swapping between a 4:3 lcd for dev, and 16:9 for playing, and yes, I didn't realize at first how many issues are involved with this.
I've started to play around with putting together a couple scripts that I run with an alias to swap my settings between lcd and hdmi. I would love to automate this to a startup script, that would do a simple check for current input, and then swap configs if needed.
I'm still wading through all of the various config files that are being affected, aside from the /boot/config.txt that you mentioned.
- At the basic level, this script would run a 'tvservice -n' command to check if the current display is either in DMT or CEA modes.
- If there isn't a change in current mode, continue.
- If there is a change, then copy the appropirate config_lcd.txt or config_hdmi.txt to /boot/config. Probably make a backup to be safe.
- Copy the appropriate retroarch.cfg files for either lcd or hdmi (change resolutions, audio output modes hdmi<->headphone jack.
- Reboot the Pi.
Anyways, that's the current idea. For now, I'm just running an alias that essentially does the config.txt part, and working through all of the various configs outside of the /boot/config.txt.
Cheers,
Howitzer -
@Howitzer99 yes, nice idea. In my wildest dream it would be even more spartan in the sense that I start from the basic idea that I already know both resolutions for both screens.
So I could jump over the tvservice part.
Something like:(From Retropie and therefore simply using the D-Pad)
START-->"SWAP CONFIG"-->"MODE A (config_lcd.txt)" or "MODE B (config_tv.txt)"--> rewriting config.txt -->reboot systemThis would solve all of my problems...
-
I don't have my RetroPie hooked up right now, but if you look in your front-end's config section (EmulationStation or Attract Mode), there are pre-existing scripts for rebooting and powering-down the system. Maybe look at one of these and see if its possible to use this approach to run the config script. You should be able to have two scripts to swap the config files and force a reboot (to/from hdmi). I haven't spent a lot of time setting up custom hotkeys, but maybe you could map these scripts to a joypad button combo?
-
@sahelX Without really modifying anything, I think you could write a bash script that copies a saved configA.txt over top of config.txt, then issues a reboot command. Make another that copies configB. Then, drop these scripts into the ROM folder for Ports. They would show up as "Ported" game titles, but you would know they are your scripts. Then, you simply D-pad over to Ports (your menu of scripts, essentially) and select the config you want. It copies, reboots, and you are back in business.
There may be other systems/emulators defined in ES that would allow this, but I think Ports recognizes a .sh file as a "rom" so to speak. Maybe they could also live in the RetroPie menu too. I dunno. The point is, you can leverage the existing menu list functionality, only instead of launching ROMs you are launching your scripts.
-
@caver01 this is genius! Masquerading script as ports would also be good for the simple use I plan. The only problem is that I really never ever programmed anything, not even know how to use bash, so I was asking for someone to do it for me. I would act as a tester with my raspi3/retropie.
-
Ah nice, I've never played around with ports, but it does sound like the right idea if it will execute bash scripts directly from the front-ends.
Thanks for the tip!
-
@Howitzer99 yes if only I could program using bash or so... by the way I used the word "reboot" but in reality it should be more a "shut down and then press the button and power up" because I would like to have enough time to connect the cable...
In any case: thanks for your response guys! At least I don't feel like fighting windmills alone! -
@sahelX In the spirit of transparency, I know just enough command line stuff to get by. Whenever I attempt to write a bash script I need to have google handy.
I would suggest that you research a few things and make an attempt at it. Look up a few commands, like "cp" (copy), how to specify the source and destination paths in that command, how to force an overwrite, etc.. Then, lookup commands for rebooting the Pi and try it at the command line. Then, you will need to write scripts and make your scripts executable. Read about how to properly format a bash script file. It's really just a text file. Some of this detail can be found in Retropie's documentation in Ports, although the examples are more complex because they deal with launching ported games.
I guess my point is, give it a try. You will earn a lot more respect if you make an attempt and then ask questions (and you will learn the skills to improve/enhance your setup later).
-
@caver01 'kay, I will give it a try, worst come to worst, I will just reinstall the image!
-
@sahelX if you make a copy of your /boot/config.txt, about the worst thing you can do is mess up that file, and to fix it, just copy your backup into place.
-
@sahelX Oh, and some commands require permissions, which is why you often see "sudo " at the beginning of the command. This executes the command as the Super User--basically, a temporary admin. Some folders/file may be protected in a way that prevents you from casually issuing a copy command to overwrite. Using sudo where appropriate can overcome this. I only mention it because you may run into this problem before you really get going!
-
Thanks guys, it worked!
-
I got this HDMI detect or LCD working good.. It takes a while before the script kicks in.. Maybe it should go in rc.local instead?
Opinions?What I also need to do is have a LCD profile Start Roms without game frame/boarder . Rather have it expand full LCD and use frame when using HDMI..
Any ideas?Thanks so much
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.