diff options
author | Matt Wilson <msw@redhat.com> | 1999-08-31 16:10:16 +0000 |
---|---|---|
committer | Matt Wilson <msw@redhat.com> | 1999-08-31 16:10:16 +0000 |
commit | d5b38fe9c8591dfa8eea090098aa23277dadf120 (patch) | |
tree | 22b7b414aa9853c0a76ec65f23aa4b2495b29b1e | |
parent | 3680dbdb4f85a9c35b77dc68bcad2bc50730def7 (diff) | |
download | anaconda-d5b38fe9c8591dfa8eea090098aa23277dadf120.tar.gz anaconda-d5b38fe9c8591dfa8eea090098aa23277dadf120.tar.xz anaconda-d5b38fe9c8591dfa8eea090098aa23277dadf120.zip |
new xserver config
-rw-r--r-- | xserver.py | 168 |
1 files changed, 20 insertions, 148 deletions
diff --git a/xserver.py b/xserver.py index c821bb629..624e504e2 100644 --- a/xserver.py +++ b/xserver.py @@ -3,45 +3,7 @@ import string import kudzu import isys import sys - -def findCardInDB (needle, lines = None): - if not lines: - db = open ('/usr/X11R6/lib/X11/Cards') - lines = db.readlines () - db.close () - - found = 0 - - card = {} - - for line in lines: - line = string.strip (line) - - if not line and found: - break - - if line and line[0] == '#': - continue - - if len (line) > 4 and line[0:4] == 'NAME': - haystack = line[5:] - if needle == haystack: - found = 1 - continue - - if found: - info = string.splitfields (line, ' ') - if card.has_key (info[0]): - card[info[0]] = card[info[0]] + (string.joinfields (info[1:], ' ') + '\n') - else: - card[info[0]] = string.joinfields (info[1:], ' ') - - if card.has_key ("SEE"): - see = findCardInDB (card["SEE"], lines) - for key, item in see.items (): - card[key] = item - - return card +from xf86config import * def startX(): global serverPath @@ -55,7 +17,7 @@ def startX(): kudzu.BUS_UNSPEC, kudzu.PROBE_ONE); if not mice: - raise XServerError, "Unable to find a mouse!" + raise RuntimeError, "Unable to find a mouse!" device = None mouseProtocol = None @@ -67,47 +29,21 @@ def startX(): mouseProtocol = "Microsoft" mouseEmulate = 1 - cards = kudzu.probe (kudzu.CLASS_VIDEO, - kudzu.BUS_UNSPEC, - kudzu.PROBE_ALL); - - if len (cards) > 1: - print "Warning: multiple video chips detected." - - if not cards: - try: - f = open('/dev/fb0', 'r') - f.close() - serverPath = '/usr/X11R6/bin/XF86_FBDev' - except: - serverPath = '/usr/X11R6/bin/XF86_VGA16' - - print "PCI probe for video cards failed. Falling back to", serverPath + x = XF86Config () + x.probe () + if x.server: + serverPath = '/usr/X11R6/bin/XF86_' + x.server else: - (device, driver, descr) = cards[0] - if len (driver) > 5 and driver[0:5] == "Card:": - card = findCardInDB (driver[5:]) - if card.has_key ("SERVER"): - serverPath = '/usr/X11R6/bin/XF86_' + card["SERVER"] - else: - print ("CardDB missing SERVER for " + driver[5:] + ".\n" - "Falling back to VGA16") - serverPath = '/usr/X11R6/bin/XF86_VGA16' - else: - if len (driver) > 7 and driver[0:7] == "Server:": - serverPath = '/usr/X11R6/bin/XF86_' + driver[7:] - - if not serverPath: - print "Unable to probe card. Falling back to VGA16" - serverPath = '/usr/X11R6/bin/XF86_VGA16' - - isys.makeDevInode(mouseDev, "/tmp/" + mouseDev) - - f = open ('/tmp/XF86Config', 'w') + print "Unknown card, falling back to VGA16" + serverPath = '/usr/X11R6/bin/XF86_VGA16' - settings = { "mouseDev" : '/tmp/' + mouseDev , + if not os.access (serverPath, os.O_XOK): + print serverpath, "missing. Falling back to VGA16" + serverPath = '/usr/X11R6/bin/XF86_VGA16' + + settings = { "mouseDev" : '/dev/' + mouseDev , "mouseProto" : mouseProtocol } - + f = open ('/tmp/XF86Config', 'w') f.write (""" Section "Files" RgbPath "/usr/X11R6/lib/X11/rgb" @@ -145,84 +81,20 @@ Section "Pointer" Emulate3Buttons Emulate3Timeout 50 EndSection - -Section "Monitor" - Identifier "Monitor" - VendorName "Vendor" - ModelName "Model" - HorizSync 31.5 - 79.0 - VertRefresh 40-150 - -# XXX fix me descr -Modeline "640x480" 25.175 640 664 760 800 480 491 493 525 -# 640x480 @ 72 Hz, 36.5 kHz hsync -Modeline "640x480" 31.5 640 680 720 864 480 488 491 521 -# 640x480 @ 75 Hz, 37.50 kHz hsync -ModeLine "640x480" 31.5 640 656 720 840 480 481 484 500 -HSync -VSync - -EndSection - -Section "Device" - Identifier "Device" - VendorName "Vendor" - BoardName "Board" -EndSection - -Section "Screen" - Driver "vga16" - Device "Device" - Monitor "Monitor" - Subsection "Display" - Modes "640x480" - ViewPort 0 0 - EndSubsection -EndSection - -Section "Screen" - Driver "svga" - Device "Device" - Monitor "Monitor" - Subsection "Display" - Depth 8 - Modes "640x480" - ViewPort 0 0 - Virtual 640 480 - EndSubsection -EndSection - -Section "Screen" - Driver "accel" - Device "Device" - Monitor "Monitor" - Subsection "Display" - Depth 8 - Modes "640x480" - ViewPort 0 0 - Virtual 640 480 - EndSubsection -EndSection - -Section "Screen" - Driver "fbdev" - Device "Device" - Monitor "Monitor" - Subsection "Display" - Depth 16 - Modes "default" - EndSubsection -EndSection """ % settings) + f.write (x.monitorSection ()) + f.write (x.deviceSection ()) + f.write (x.screenSection ()) f.close () server = os.fork() if (not server): print "starting", serverPath os.execv(serverPath, [serverPath, ':1', '-xf86config', - '/tmp/XF86Config', 'vt5']) + '/tmp/XF86Config', 'vt7']) child = os.fork() if (child): - pid, status = os.waitpid(child, 0) - os.kill(server, 15) + pid, status = os.waitpid(server, 0) sys.exit(status) - return ((mouseProtocol, mouseEmulate, mouseDev),) + return ((mouseProtocol, mouseEmulate, mouseDev), x) |