set /proc/stb/hdmi/enable_hdmi_reset to 1 when a real DVI Mode is used and
[enigma2.git] / lib / python / Plugins / SystemPlugins / Videomode / VideoHardware.py
index c90f8fd8980a192b28cc25daf8eff4e621a9ffbf..b9b5dca8661a678f4056b38029c1c88f7752272b 100644 (file)
@@ -46,12 +46,13 @@ class VideoHardware:
                "1366x768" : { 60: "1366x768"},
                "1366x768 multi" : { 50: "1366x768", 60: "1366x768_50"},
                "1280x768": { 60: "1280x768"},
-               "640x480" : { 60: "640x480"} 
+               "640x480" : { 60: "640x480"}
        }
 
        modes["Scart"] = ["PAL", "NTSC", "Multi"]
        modes["YPbPr"] = ["720p", "1080i"]
        modes["DVI"] = ["720p", "1080i", "PC"]
+       modes["DVI-PC"] = ["PC"]
 
        widescreen_modes = set(["720p", "1080i"])
 
@@ -145,6 +146,17 @@ class VideoHardware:
                if mode_60 is None or force == 50: 
                        mode_60 = mode_50
 
+               dvimode = (mode_50.find('x') != -1 or mode_60.find('x') != -1) and '1' or '0'
+               try:
+                       open("/etc/dvimode", "w").write(dvimode) # use 50Hz mode (if available) for booting
+               except IOError:
+                       print "writing initial dvimode to /etc/dvimode failed."
+
+               try:
+                       open("/proc/stb/hdmi/enable_hdmi_reset", "w").write(dvimode)
+               except IOError:
+                       print "setting dvimode failed."
+
                try:
                        open("/proc/stb/video/videomode_50hz", "w").write(mode_50)
                        open("/proc/stb/video/videomode_60hz", "w").write(mode_60)
@@ -164,8 +176,11 @@ class VideoHardware:
 
        def saveMode(self, port, mode, rate):
                config.av.videoport.value = port
+               config.av.videoport.save()
                config.av.videomode[port].value = mode
+               config.av.videomode[port].save()
                config.av.videorate[mode].value = rate
+               config.av.videorate[mode].save()
 
        def isPortAvailable(self, port):
                # fixme