0

For example, I want to output a 320x240 resolution to a composite monitor if no HDMI connection is found. Otherwise, output to HDMI as usual.

Is this possible? Can I edit something in config.txt or somewhere else? Can you use if-statements in config.txt?

quinten
  • 1
  • 1
  • If you are using the X server for a GUI, I'm pretty sure the answer is yes. You can dynamically adjust the resolution w/ xset at any point; for what you want to do, you'd have to write some kind of short script to detect which output is in play. – goldilocks Jun 04 '15 at 19:49
  • I do not have an answer to your question. My Pi detects if hdmi is connected at boot and if not defaults to PAL. tvservice -s will show state e.g. state 0x80001 [PAL 4:3], 720x576 @ 50.00Hz, interlaced. I do not know if the default size can be changed. – Milliways Jun 05 '15 at 00:33

3 Answers3

3

I don't think that is possible, config.txt is read by the bootloader with very limited resources. But please look at this posting - it gives you a good suggestion on how to do this using a GPIO-based VGA adapter: Multiple Display Screens

Phil B.
  • 5,043
  • 15
  • 30
  • Unfortunately, using the GPIO pins isn't an option for me. Also, I don't need to use these screens simultaneously--it's an either/or situation. – quinten Jun 04 '15 at 18:06
1

Unfortunately, there's no way you could do this with built in functionality. The bootloader loads config.txt when the system starts, and once the system is up, that's it.

You could write a python/bash/ruby/whatever script that will swap out your config.txt config for a different one and restart the system. This of course assumes that restarting the system is an acceptable solution.

Jacobm001
  • 11,898
  • 7
  • 46
  • 56
0

well... if you use either the composite or hdmi monitor (with useful tvservice -n-output) and the right one is already connected at the boot time (hotplugging won't change anything because the config.txt is read once at boot) you can probably use the [EDID=*]-filter in the config.txt!

please have a look at the real good Raspberry Pi documentation for the config.txt:
at the end there is a section about the filters (also the [EDID=*]-filter), and then you have to sort out your desired configurations for your hdmi monitor... the [all]-settings will be for the composite.

if you are not using always he same hdmi monitor you have to try multiple [EDID=*]-filters.

DJCrashdummy
  • 379
  • 1
  • 5
  • 17