From 55e0be8454e7bc4053ffbf2590370797a6948902 Mon Sep 17 00:00:00 2001 From: Mike Khiretskiy Date: Wed, 8 Oct 2014 16:46:53 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D0=B2=D1=8B=D1=87=D0=B8=D1=81=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=80=D0=B0=D0=B7=D1=80=D0=B5=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20framebuffer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pym/install/variables/X11.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/pym/install/variables/X11.py b/pym/install/variables/X11.py index 836803b..58dba88 100644 --- a/pym/install/variables/X11.py +++ b/pym/install/variables/X11.py @@ -27,6 +27,8 @@ from calculate.lib.utils.common import (getVideoFromXorgLog, getCompositeFromXorgconf, getVideoFromModules, getVideoFromVendor, getInstalledVideo) from calculate.install.distr import DistributiveError +import fcntl +import struct from calculate.lib.cl_lang import setLocalTranslate setLocalTranslate('cl_install3',sys.modules[__name__]) @@ -283,19 +285,15 @@ class VariableOsInstallFbResolution(ResolutionVariable): self.help = _("set the framebuffer resolution") self.label = _("Framebuffer resolution") + FBIOGET_VSCREENINFO = 0x4600 + def get(self): """Get current framebuffer resolution""" - resolution = "" - fbres = getProgPath('/sbin/fbres') - if fbres: - processFbres = process(fbres,stderr=STDOUT) - textLines = processFbres.readlines() - if textLines: - cxx11,cyx11 = \ - self.Get('os_install_x11_resolution').partition('x')[0::2] - cxfb, cyfb = textLines[0].partition('x')[0::2] - if not filter(lambda x:not x.isdigit(), - [cxfb,cyfb,cxx11,cyx11])and \ - int(cxx11) >= int(cxfb) and int(cyx11) >= int(cyfb): - resolution = "%s-32"%textLines[0] - return resolution or "1024x768-32" + 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 "1024x768"