|
|
|
@ -133,16 +133,27 @@ class VariableOsInstallX11Resolution(ResolutionVariable):
|
|
|
|
|
X.org resolution
|
|
|
|
|
"""
|
|
|
|
|
fallback_resolution = "1024x768"
|
|
|
|
|
FBIOGET_VSCREENINFO = 0x4600
|
|
|
|
|
|
|
|
|
|
def framebuffer_resolution(self):
|
|
|
|
|
try:
|
|
|
|
|
fbdev = os.open('/dev/fb0', os.O_RDONLY)
|
|
|
|
|
data = fcntl.ioctl(fbdev, self.FBIOGET_VSCREENINFO, " " * 8)
|
|
|
|
|
res = struct.unpack("II", data)
|
|
|
|
|
return "%sx%s" % (res[0], res[1])
|
|
|
|
|
except (IOError, OSError):
|
|
|
|
|
pass
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
# get resolution from xorg.log
|
|
|
|
|
for vn in ('install.os_install_x11_resolution_preferred',
|
|
|
|
|
'install.os_install_fb_resolution'):
|
|
|
|
|
res = self.Get(vn)
|
|
|
|
|
if res:
|
|
|
|
|
return res
|
|
|
|
|
else:
|
|
|
|
|
return self.fallback_resolution
|
|
|
|
|
res = self.Get('install.os_install_x11_resolution_preferred')
|
|
|
|
|
if res:
|
|
|
|
|
return res
|
|
|
|
|
res = self.framebuffer_resolution()
|
|
|
|
|
if res:
|
|
|
|
|
return res
|
|
|
|
|
return self.fallback_resolution
|
|
|
|
|
|
|
|
|
|
class VariableOsInstallX11VideoAvailable(VideoVariable):
|
|
|
|
|
"""
|
|
|
|
|