paulenuta
Posts: 36
Joined: Fri Oct 28, 2016 5:59 am
Location: Romania

Conditional filter to set HDMI as the default display.

Mon May 13, 2019 2:03 pm

I have a Raspberry Pi DSI LCD as default/primary display, but if a HDMI display is attached I need to have this one as default/primary display for the system.
Currently, if a Raspberry Pi DSI LCD is detected it will be used as the default display, but if we connect an HDMI display we need

Code: Select all

display_default_lcd=0
or

Code: Select all

ignore_lcd=1
in config.txt to make HDMI the default display.
Looking thru config.txt conditional filter I didn't find any option to do it automatically, or maybe it is not yet documented.

Any hint, help is really appreciated.

Thanks a lot,
Paul

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 21862
Joined: Sat Jul 30, 2011 7:41 pm

Re: Conditional filter to set HDMI as the default display.

Mon May 13, 2019 3:04 pm

Not sure that is possible with current firmware. It deliberately forces LCD to be the default, whether the HDMI is connected or not. I'll have a think, but very busy on other stuff at the moment.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

User avatar
procount
Posts: 1584
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: Conditional filter to set HDMI as the default display.

Mon May 13, 2019 4:25 pm

The display priority is fixed in the firmware, so as James says, it's not normally possible.
You might be able to do it with his multiple framebuffer beta firmware (see https://www.raspberrypi.org/forums/view ... 3&t=216399).

Failing that, the only way to do it currently (AFAIK) is to reboot the PI to switch the screen priority (since the DSI screen is only initialised at boot)
I have a script for PINN which will allow you to detect both the DSI and HDMI screens and set a preference if they are both detected. It relies on detecting the screens, setting the config.txt parameters appropriately, and then rebooting if the wrong mode is currently selected.

You can find it at https://sourceforge.net/projects/pinn/f ... rce=navbar called screenswitch.zip.
You will need to delete config.hyp3 and config.hyp4 and modify pinn_init.sh to remove references to hyp3 and hyp4 to just leave the options for dsi and hdmi. Also change 'rebootp' to 'sudo reboot'. Then make sure pinn_init.sh is run on boot (probably change the name to something more appropriate).

It should work in Raspbian, but I've not tried it. You might have to adapt it from the buildroot shell syntax (ash) to raspbian's (bash).
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

paulenuta
Posts: 36
Joined: Fri Oct 28, 2016 5:59 am
Location: Romania

Re: Conditional filter to set HDMI as the default display.

Mon May 13, 2019 7:22 pm

jamesh wrote:
Mon May 13, 2019 3:04 pm
Not sure that is possible with current firmware. It deliberately forces LCD to be the default, whether the HDMI is connected or not. I'll have a think, but very busy on other stuff at the moment.
Hi James, so there is no experimental or undocumented condition for this, but it could be added, let say [HDMI] which will be trigger when PI detects an HDMI display at boot so I could have something like this in config.txt:

Code: Select all

...
# general config.txt settings
...
[HDMI]
# settings here are applied only if a HDMI monitor is connected
display_default_lcd=0
disable_touchscreen=1
hdmi_group=2
hdmi_mode=16
...
My scope is to have a general "config.txt" so that PI3BP will work with RPILCD if no HDMI is detected at boot and deactivate the RPILCD when there is a HDMI display connected.

Thanks a lot,
Paul

paulenuta
Posts: 36
Joined: Fri Oct 28, 2016 5:59 am
Location: Romania

Re: Conditional filter to set HDMI as the default display.

Mon May 13, 2019 7:30 pm

procount wrote:
Mon May 13, 2019 4:25 pm
The display priority is fixed in the firmware, so as James says, it's not normally possible.
You might be able to do it with his multiple framebuffer beta firmware (see https://www.raspberrypi.org/forums/view ... 3&t=216399).

Failing that, the only way to do it currently (AFAIK) is to reboot the PI to switch the screen priority (since the DSI screen is only initialised at boot)
I have a script for PINN which will allow you to detect both the DSI and HDMI screens and set a preference if they are both detected. It relies on detecting the screens, setting the config.txt parameters appropriately, and then rebooting if the wrong mode is currently selected.

You can find it at https://sourceforge.net/projects/pinn/f ... rce=navbar called screenswitch.zip.
You will need to delete config.hyp3 and config.hyp4 and modify pinn_init.sh to remove references to hyp3 and hyp4 to just leave the options for dsi and hdmi. Also change 'rebootp' to 'sudo reboot'. Then make sure pinn_init.sh is run on boot (probably change the name to something more appropriate).

It should work in Raspbian, but I've not tried it. You might have to adapt it from the buildroot shell syntax (ash) to raspbian's (bash).
Hi Procount ,

I read about the beta firmware and it could be usefully in future to run both display with different content, for now I need an option to set HDMI as default display at boot when it is connected without having double config.txt files for RPILCD and HDMI usage.
Also you script is very interesting, but I have this constrain about one config.txt file.

Thank you,
Paul

User avatar
procount
Posts: 1584
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: Conditional filter to set HDMI as the default display.

Tue May 14, 2019 6:36 am

I don't think it is currently possible with your constraints.
You could try a [edid=...] filter but I suspect it won't stop the firmware choosing the LCD first.
I researched this before and a dual config.txt with the occasional reboot to switch modes was the only way I could get it to work.
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 21862
Joined: Sat Jul 30, 2011 7:41 pm

Re: Conditional filter to set HDMI as the default display.

Tue May 14, 2019 9:26 am

paulenuta wrote:
Mon May 13, 2019 7:22 pm
jamesh wrote:
Mon May 13, 2019 3:04 pm
Not sure that is possible with current firmware. It deliberately forces LCD to be the default, whether the HDMI is connected or not. I'll have a think, but very busy on other stuff at the moment.
Hi James, so there is no experimental or undocumented condition for this, but it could be added, let say [HDMI] which will be trigger when PI detects an HDMI display at boot so I could have something like this in config.txt:

Code: Select all

...
# general config.txt settings
...
[HDMI]
# settings here are applied only if a HDMI monitor is connected
display_default_lcd=0
disable_touchscreen=1
hdmi_group=2
hdmi_mode=16
...
My scope is to have a general "config.txt" so that PI3BP will work with RPILCD if no HDMI is detected at boot and deactivate the RPILCD when there is a HDMI display connected.

Thanks a lot,
Paul
It's all possible, but I don't have time to do anything like that at the moment. This area of the code is undergoing some churn at the moment, so it's rather a moving target as well.

I wonder if using the FKMS driver might help.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

paulenuta
Posts: 36
Joined: Fri Oct 28, 2016 5:59 am
Location: Romania

Re: Conditional filter to set HDMI as the default display.

Tue May 14, 2019 10:14 am

It's all possible, but I don't have time to do anything like that at the moment. This area of the code is undergoing some churn at the moment, so it's rather a moving target as well.
So it is a matter of moths rather than weeks to make available such an option?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 21862
Joined: Sat Jul 30, 2011 7:41 pm

Re: Conditional filter to set HDMI as the default display.

Tue May 14, 2019 10:44 am

paulenuta wrote:
Tue May 14, 2019 10:14 am
It's all possible, but I don't have time to do anything like that at the moment. This area of the code is undergoing some churn at the moment, so it's rather a moving target as well.
So it is a matter of moths rather than weeks to make available such an option?
No idea. It's not on our list of things that need doing, and would be very low priority. You could try adding an issue to our github bug tracker so it doesn't get forgotten, but no promises.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

paulenuta
Posts: 36
Joined: Fri Oct 28, 2016 5:59 am
Location: Romania

Re: Conditional filter to set HDMI as the default display.

Wed May 15, 2019 7:29 am

Here is the Github link 1136

paulenuta
Posts: 36
Joined: Fri Oct 28, 2016 5:59 am
Location: Romania

Re: Conditional filter to set HDMI as the default display.

Wed May 15, 2019 4:05 pm

procount wrote:
Tue May 14, 2019 6:36 am
I don't think it is currently possible with your constraints.
You could try a [edid=...] filter but I suspect it won't stop the firmware choosing the LCD first.
I researched this before and a dual config.txt with the occasional reboot to switch modes was the only way I could get it to work.
[EDID=...] is working fine, see https://github.com/raspberrypi/firmware ... -492650079.

User avatar
procount
Posts: 1584
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: Conditional filter to set HDMI as the default display.

Wed May 15, 2019 6:25 pm

Excellent!
The firmware is a bit of a black box, so I had assumed the LCD would have been selected prior to this, so the EDID would have been invalid. But I guess not. I'll have to see if this can make some of my scripts simpler.
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

paulenuta
Posts: 36
Joined: Fri Oct 28, 2016 5:59 am
Location: Romania

Re: Conditional filter to set HDMI as the default display.

Sat May 18, 2019 5:48 am

procount wrote:
Wed May 15, 2019 6:25 pm
Excellent!
The firmware is a bit of a black box, so I had assumed the LCD would have been selected prior to this, so the EDID would have been invalid. But I guess not. I'll have to see if this can make some of my scripts simpler.
Yes, unfortunately the firmware is the "To be or NOT to be" (open source) of the Raspbbery PI.

Return to “Official Foundation Display”