Browse Source

Add a hidden setting for disabling HDMI auto power on on RPI

Some users want to run with "hdmi_ignore_cec_init=1" (in RPI's
config.txt). This disables automatically switching on HDMI on boot. Our
PMP code does something similar, and essentially negates the
hdmi_ignore_cec_init setting. So there's a need to allow the user to
disable the PMP code too.

(We could also try to retrieve the firmware hdmi_ignore_cec_init setting
somehow, potentially by parsing config.txt, but let's not for now.)
Vincent Lang 9 years ago
parent
commit
bd958b2ddd
2 changed files with 13 additions and 0 deletions
  1. 6 0
      resources/settings/settings_description.json
  2. 7 0
      src/display/DisplayComponent.cpp

+ 6 - 0
resources/settings/settings_description.json

@@ -46,6 +46,12 @@
           [ 4, "Ninja" ],
           [ 2, "Employee" ]
         ]
+      },
+      {
+        "value": "hdmi_poweron",
+        "default": true,
+        "hidden": true,
+        "platforms": [ "oe_rpi" ]
       }
     ]
   },

+ 7 - 0
src/display/DisplayComponent.cpp

@@ -2,6 +2,7 @@
 #include "QsLog.h"
 #include "DisplayComponent.h"
 #include "DisplayManager.h"
+#include "settings/SettingsComponent.h"
 #include <QGuiApplication>
 #include <QWindow>
 
@@ -143,6 +144,12 @@ bool DisplayComponent::switchToBestOverallVideoMode(int display)
   if (!m_displayManager || !m_displayManager->isValidDisplay(display))
     return false;
 
+  if (!SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "hdmi_poweron").toBool())
+  {
+    QLOG_INFO() << "Switching to best mode disabled.";
+    return false;
+  }
+
   int bestmode = m_displayManager->findBestMode(display);
   if (bestmode < 0)
     return false;