Add redetect resolution for usb-hdd.

netsetup
Mike Hiretsky 13 years ago
parent 3ef5c38e3a
commit 9a9de3cad3

@ -822,30 +822,34 @@ class fillVars(object, glob_attr):
def get_os_install_x11_resolution(self):
"""Xorg resolution"""
# get resolution from xorg.log
xlog = "/var/log/Xorg.0.log"
if os.access(xlog,os.R_OK):
reXorgLogParser = re.compile("""
Virtual\ screen\ size\ determined\ to\ be
\ ([0-9]+)\s*x\s*([0-9]+)|
Setting\ mode\ "(\d+)x(\d+)[0-9\@]"|
Output\ [\S]+\ using\ initial\ mode\ (\d+)x(\d+)|
Virtual\ size\ is\ (\d+)x(\d+)""", re.X | re.S)
resXorgLogParser = reXorgLogParser.search(open(xlog,'r').read())
if resXorgLogParser:
return "%sx%s"%filter(lambda x:x,resXorgLogParser.groups())[:2]
# get resolution from xorg.conf
xorgconf = "/etc/X11/xorg.conf"
reScreenSections = re.compile('Section "Screen"(.*?)EndSection', re.S)
reModes = re.compile('Modes\s+"(\d+x\d+)')
if os.access(xorgconf,os.R_OK):
sectionsScreen = filter(lambda x:"Modes" in x,
reScreenSections.findall(open('/etc/X11/xorg.conf','r').read()))
modes = map(lambda x:x.groups()[0],
filter(lambda x:x,
map(reModes.search, sectionsScreen)))
if modes:
return max(modes,key=lambda x:int(x.partition('x')[0]))
if self.Get('os_install_root_type') != 'usb-hdd':
xlog = "/var/log/Xorg.0.log"
if os.access(xlog,os.R_OK):
reXorgLogParser = re.compile("""
Virtual\ screen\ size\ determined\ to\ be
\ ([0-9]+)\s*x\s*([0-9]+)|
Setting\ mode\ "(\d+)x(\d+)[0-9\@]"|
Output\ [\S]+\ using\ initial\ mode\ (\d+)x(\d+)|
Virtual\ size\ is\ (\d+)x(\d+)""", re.X | re.S)
resXorgLogParser = reXorgLogParser.search(open(xlog,'r').read())
if resXorgLogParser:
return "%sx%s"%filter(lambda x:x,
resXorgLogParser.groups())[:2]
# get resolution from xorg.conf
xorgconf = "/etc/X11/xorg.conf"
reScreenSections = re.compile('Section "Screen"(.*?)EndSection',
re.S)
reModes = re.compile('Modes\s+"(\d+x\d+)')
if os.access(xorgconf,os.R_OK):
sectionsScreen = filter(lambda x:"Modes" in x,
reScreenSections.findall(open('/etc/X11/xorg.conf',
'r').read()))
modes = map(lambda x:x.groups()[0],
filter(lambda x:x,
map(reModes.search, sectionsScreen)))
if modes:
return max(modes,key=lambda x:int(x.partition('x')[0]))
# get resolution from command line
reRightResolution = re.compile("^(\d+x\d+|auto)$",re.S)
@ -854,9 +858,8 @@ class fillVars(object, glob_attr):
return kernelResolution
# default resolution
return "" if self.Get('os_install_root_type') == 'livecd' \
return "" if self.Get('os_install_root_type') in ('livecd','usb-hdd') \
else "1024x768"
def get_os_install_x11_video_drv(self):
"""Video driver used by xorg"""

Loading…
Cancel
Save