diff options
author | James Meyer <james.meyer@operamail.com> | 2012-08-24 00:40:15 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2012-08-24 00:40:23 (GMT) |
commit | 3a594ad38241da5087d34584ba70ca06e7be97c4 (patch) | |
tree | 617a14e327af8a1fe159a025b5d1afcad2edde19 /abs/core | |
parent | 282e9e588e6d8a62a7b1d3f18963e3787fb6f88a (diff) | |
download | linhes_pkgbuild-3a594ad38241da5087d34584ba70ca06e7be97c4.zip linhes_pkgbuild-3a594ad38241da5087d34584ba70ca06e7be97c4.tar.gz linhes_pkgbuild-3a594ad38241da5087d34584ba70ca06e7be97c4.tar.bz2 |
LinHES-config: added print_xorg_res.py this feeds the ui to list valid modelines as X detects them. This provides a consistent interface.
Also updated xconfig.sh todo something with the XRes value and configuring xorg.
Diffstat (limited to 'abs/core')
-rw-r--r-- | abs/core/LinHES-config/PKGBUILD | 21 | ||||
-rw-r--r-- | abs/core/LinHES-config/print_xorg_res.py | 128 | ||||
-rwxr-xr-x | abs/core/LinHES-config/xconfig.sh | 47 | ||||
-rw-r--r-- | abs/core/mythinstall/PKGBUILD | 2 |
4 files changed, 182 insertions, 16 deletions
diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD index d395bbc..0ea9210 100644 --- a/abs/core/LinHES-config/PKGBUILD +++ b/abs/core/LinHES-config/PKGBUILD @@ -1,11 +1,11 @@ pkgname=LinHES-config pkgver=2.3 -pkgrel=81 +pkgrel=83 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev LinHes-config ) pkgdesc="Install and configure your system" depends=('bc' 'libstatgrab' 'mysql-python' 'expect' 'curl' 'dnsutils' 'parted' 'sg3_utils' 'nmbscan' 'system-templates' 'rsync' 'python-parted' - 'python-pexpect' 'python-netifaces' + 'python-pexpect' 'python-netifaces' 'python-iplib' 'mythinstall>=2-10' 'sudo') #LinHES-timezone arch=('i686' 'x86_64') @@ -46,8 +46,9 @@ source=(mv_install.py 09_mythvantge_runit_grub systemconfig.py myth_user_call.py mythvantage.cfg - config-sudo.rules - hdhr.conf blacklist_nouveau.conf blacklist_pcspkr.conf ) + config-sudo.rules + hdhr.conf blacklist_nouveau.conf blacklist_pcspkr.conf + print_xorg_res.py ) backup=(etc/mythvantage.cfg) install=config.install @@ -95,6 +96,7 @@ build() { install -m 0755 mv_hostype.py $MVDIR/bin/ install -m 0755 mv_supplemental.py $MVDIR/bin/ install -m 0755 systemconfig.py $MVDIR/bin/ + install -m 0755 print_xorg_res.py $MVDIR/bin/ install -m 0755 mythvantage.cfg $startdir/pkg/etc/ #README file displayed on install @@ -107,13 +109,13 @@ build() { #sudo rules mkdir -p $startdir/pkg/etc/sudoers.d/ - chmod 750 $startdir/pkg/etc/sudoers.d/ - chown -R root:root $startdir/pkg/etc/sudoers.d + chmod 750 $startdir/pkg/etc/sudoers.d/ + chown -R root:root $startdir/pkg/etc/sudoers.d install -o root -g root -m 0750 config-sudo.rules $startdir/pkg/etc/sudoers.d/config_sudo #sysctrl conf install -o root -g root -D -m 0755 hdhr.conf $startdir/pkg/etc/sysctl.d/hdhr.conf - + #modules blacklist files install -o root -g root -D -m 0755 blacklist_pcspkr.conf $startdir/pkg/etc/modprobe.d/blacklist_pcspkr.conf install -o root -g root -D -m 0755 blacklist_nouveau.conf $startdir/pkg/etc/modprobe.d/blacklist_nouveau.conf @@ -129,7 +131,7 @@ md5sums=('0b29bb0819aad086f612699815132ec5' '68199e861c2933ccbb84735b9b440157' '2a7f3b34e522acfd08283b86c8926aba' '60103d94ada98ac583fea620294f14d3' - '36b0ce0589fd522217f90e0d0e5315c0' + '61e1e5cc957a0ce99a8a24501efab88c' 'ecf9e5df20683a769c4a8a8f2d65de85' '895d4e842d7457a48a6d2ce0e9c833b7' '8ba06c2ce6129371548cc360ccca27f8' @@ -158,4 +160,5 @@ md5sums=('0b29bb0819aad086f612699815132ec5' '4804aa93aaad3dfcfff08cd9ffd68836' '0fa6fffd87f350380d45f1f8a5b7babe' '6ec39b010c0ed8901ea896c7e153d330' - '3866086e6af5e3528a66eff492f2f4dd') + '3866086e6af5e3528a66eff492f2f4dd' + 'c9279fa095af624ee3d9bc75d3328360') diff --git a/abs/core/LinHES-config/print_xorg_res.py b/abs/core/LinHES-config/print_xorg_res.py new file mode 100644 index 0000000..3b7ce56 --- /dev/null +++ b/abs/core/LinHES-config/print_xorg_res.py @@ -0,0 +1,128 @@ +#!/usr/bin/python2 +# -*- coding: utf-8 -*- + +__author__ = "James Meyer" +__date__ = "August 23rd 2012" + + +from subprocess import Popen, PIPE +import re + +class available_display_res(): + def __init__(self): + + self.mode_list=[] + self.videocard = self.find_video_card() + + if self.videocard == "nvidia": + self.parse_modeline_nvidia() + else: + self.sizes_xrandr() + #elif self.videocard == "intel": + #self.sizes_xrandr() + #elif self.videocard == "vmware": + #self.sizes_xrandr() + #elif self.videocard == "vesa": + #self.sizes_parse_log() + + + def getlist(self): + return self.mode_list + + def getvc(self): + return self.videocard + + def find_video_card(self): + videocard="" + conf_file="/etc/X11/xorg.conf.d/20-automv.conf" + lines=[] + try: + f=open(conf_file,'r') + lines=f.readlines() + f.close() + except: + print " find_video_card: couldn't read in %s" %conf_file + videocard = "unknown" + + for line in lines: + parsed=line.split() + if parsed[0].strip() == "Driver": + videocard = parsed[1].strip('''"''') + break + + return videocard + + def parse_modeline_nvidia(self): + self.mode_list=[] + conf_file="/var/log/Xorg.0.log" + lines=[] + try: + f=open(conf_file,'r') + lines=f.readlines() + f.close() + except: + print " parse_modeline_nvidia: couldn't read in %s" %conf_file + self.mode_list=["Auto"] + #now parse the list looking for modelines + search="Modes in ModePool" + searchindex=[] + for line in lines: + if line.find(search) > 4 : + searchindex.append(lines.index(line)) + search="End of ModePool" + + if len(searchindex) == 2: + break + #extract the modelines + #[ 29.858] (II) NVIDIA(GPU-0): "nvidia-auto-select" : 2560 x 1600 @ 59.9 Hz (from: EDID) + try: + modelines = lines[searchindex[0]+1:searchindex[1]-1] + for i in modelines: + self.mode_list.append(i.split('''"''')[1]) + except: + self.mode_list=["nvidia-auto-select"] + + + def sizes_parse_log(self): + self.mode_list=["parse_log_list"] + + def sizes_xrandr(self): + """List all sizes detected by xrandr, + ordered by the next resolution to cycle to""" + size_re = re.compile("^ ([0-9]*x[0-9]*)\W*[0-9]*\.[0-9]*(\*)?") + p1 = Popen(['xrandr'], stdout=PIPE) + sizes = [] + current_size_index = 0 + for line in p1.communicate()[0].split("\n"): + m = size_re.match(line) + if m: + sizes.append(m.group(1)) + if m.group(2) == "*": + current_size_index = len(sizes) - 1 + #return sizes[current_size_index+1:] + sizes[:current_size_index+1] + self.mode_list = sizes[current_size_index+1:] + sizes[:current_size_index+1] + +def go(): + mode = available_display_res() + vc = mode.getvc() + modelist = mode.getlist() + print vc + + for i in modelist: + print i + conf_file="/tmp/modelines" + try: + f=open(conf_file,'w') + for i in modelist: + f.write(i) + f.write("\n") + f.close() + except: + print " print_xorg_res: couldn't write modelines to %s" %conf_file + + + + +if __name__ == '__main__': + go() + diff --git a/abs/core/LinHES-config/xconfig.sh b/abs/core/LinHES-config/xconfig.sh index 73e4a5e..f832e66 100755 --- a/abs/core/LinHES-config/xconfig.sh +++ b/abs/core/LinHES-config/xconfig.sh @@ -144,6 +144,22 @@ function intel_driver_install { # Xres="${Xres} 720x480_60" # fi +function set_res { + echo " Setting modeline to ${Xres}" + echo " Setting modeline to ${Xres}" >> $LOGFILE 2>&1 + cat > /etc/X11/xorg.conf.d/30-screen.conf <<EOF + Section "Screen" + Identifier "Screen0" #Collapse Monitor and Device section to Screen section + Device "Device0" + Monitor "Monitor0" + DefaultDepth 24 #Choose the depth (16||24) + SubSection "Display" + Depth 24 + Modes "${Xres}" #Choose the resolution + EndSubSection + EndSection +EOF +} function setupX { @@ -153,6 +169,12 @@ function setupX { case $VGACARDTYPE in NVIDIA|nVidia|nvidia) nvidia_driver_install + if [ ${Xres} != "Auto" ] + then + set_res + else + rm -f /etc/X11/xorg.conf.d/30-screen.conf + fi ;; VMware) @@ -163,22 +185,35 @@ function setupX { echo "#!/bin/bash" > /etc/X11/autostart/vmware.sh echo "/usr/bin/vmware-user-suid-wrapper" >> /etc/X11/autostart/vmware.sh chmod 755 /etc/X11/autostart/vmware.sh + if [ ${Xres} != "Auto" ] + then + set_res + else + rm -f /etc/X11/xorg.conf.d/30-screen.conf + fi ;; Intel|intel) intel_driver_install cp $TEMPLATES/xorg/xorg.intel /etc/X11/xorg.conf.d/20-automv.conf + if [ ${Xres} != "Auto" ] + then + set_res + else + rm -f /etc/X11/xorg.conf.d/30-screen.conf + fi ;; vesa|InnoTek|*) #leaving this as * and vesa for no real reason other then it's explicit to catch vesa vesa_driver_install cp $TEMPLATES/xorg/xorg.vesa /etc/X11/xorg.conf.d/20-automv.conf -# if [ ${Xres} = Auto ] -# then -# sed -e "/^.*Modes.*$/d" "$TEMPLATES/xorg/xorg.conf.vesa" > "$XORG_CONF" -# else -# sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.vesa" > "$XORG_CONF" -# fi + if [ ${Xres} != "Auto" ] + then + set_res + else + rm -f /etc/X11/xorg.conf.d/30-screen.conf + fi + ;; esac diff --git a/abs/core/mythinstall/PKGBUILD b/abs/core/mythinstall/PKGBUILD index 923fb3e..a07a78e 100644 --- a/abs/core/mythinstall/PKGBUILD +++ b/abs/core/mythinstall/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Jams pkgname=mythinstall pkgver=3 -pkgrel=29 +pkgrel=30 pkgdesc="LinHES installer/systemconfig GUI." arch=('i686' 'x86_64') depends=('mythtv>=0.25') |