op_tvout: never use zero width/height
[openpandora.oe.git] / recipes / pandora-system / pandora-scripts / TVoutConfig.py
index 7cf501f..afeb723 100755 (executable)
@@ -24,7 +24,7 @@ GUI_DESCRIPTION = 'tvout.glade'
 PROFILES = '/etc/pandora/conf/tvout-profiles.conf'
 
 # Shell command to change settings:
-SET_CONFIG_CMD = '"sudo /usr/pandora/scripts/op_tvout.sh %s"'
+SET_CONFIG_CMD = 'sudo /usr/pandora/scripts/op_tvout.sh %s'
 CONFIG_PARAMS = '-t %(encoding)s -c %(connection)s -l %(layer)s -%(type)ss %(width)s,%(height)s -%(type)sp %(x)s,%(y)s'
 
 # Maximum vertical resolutions
@@ -226,6 +226,17 @@ class TVoutModel(ConfigModel):
         settings['width'], settings['height'] = settings.pop('size').split(',')
         settings['x'], settings['y'] = settings.pop('position').split(',')
 
+        # The system may have 0,0 w,h; use last_written or defaults if it does
+        for key in 'width', 'height':
+            if settings[key] == '0':
+                settings[key] = (self.last_written[key] if self.last_written[key] != '0'
+                                 else DC_DISABLED_DICT[key])
+
+        # 0,0 pos is more likely to be intended, but still fallback to last_written
+        for key in 'x', 'y':
+            if settings[key] == '0':
+                settings[key] = self.last_written[key]
+
         # To determine the layer we interpret the framebuffer values
         fb0 = settings.pop('fb0')
         fb1 = settings.pop('fb1')