Kaydet (Commit) 5d0d275d authored tarafından Fatih Aşıcı's avatar Fatih Aşıcı

move zorg outside of comar directory

üst 383f176b
Current Maintainer:
Fatih Aşıcı <fatih [at] pardus.org.tr>
Other Developers:
Onur Küçük <onur [at] pardus.org.tr>
This diff is collapsed.
2009-05-01 Fatih Aşıcı <fatih@pardus.org.tr>
* zorg/probe.py:
Implement a simplified version of getPrimaryCard.
2009-04-23 Fatih Aşıcı <fatih@pardus.org.tr>
* setup.py:
Do not install modprobe.d config file.
2009-03-30 Fatih Aşıcı <fatih@pardus.org.tr>
* data/DriversDB:
Prefer nvidia-drivers package for 10de:0242.
2009-03-28 Fatih Aşıcı <fatih@pardus.org.tr>
* zorg/parser.py:
Do case-insensitive comparison for entry names
2009-03-20 Fatih Aşıcı <fatih@pardus.org.tr>
* zorg/config.py, zorg/consts.py, zorg/hwdata.py, zorg/probe.py:
- Refactor variable names to increase consistency.
- Add configuredBus function to get last configured card by
zorg. This will be used at boot.
- Use an empty string for xkb variant as not all layouts have
"basic" variant.
* zorg/utils.py:
- Cleanup unused utils.
* setup.py:
- Get config and data dirs from zorg module instead of
hardcoding.
2009-03-08 Fatih Aşıcı <fatih@pardus.org.tr>
* zorg/utils.py:
- Improve backup function to keep last 3 backups.
- Use pardus-python's new get_kernel_option function. Remove
the internal one.
* zorg/config.py, zorg/consts.py, zorg/probe.py:
- Let Xorg decide most of the configurations. Make
Screen, Display, Layout and Monitor sections optional.
- Disable framebuffer size calculation since it tries
to parse mode name and mode names do not have to be in
format "WidthxHeight". Also drivers should be clever
to calcute fb size.
- Add a flag to indicate the initial config.
- Remove monitor query stuff.
- Cleanup unused bits.
* zorg/ddc, zorg/modeline.py:
- Remove ddc and modeline modules.
2009-03-05 Fatih Aşıcı <fatih@pardus.org.tr>
* zorg/config.py:
- Do not create InputDevice sections. We will use
new input hotplug mechanism for all input devices.
- Do not create Files section. We will use
catalogue paths.
- Do not create redundant dri section.
* zorg/__init__.py:
- Remove unused __all__ list.
2009-02-19 Fatih Aşıcı <fatih@pardus.org.tr>
* zorg/hwdata.py:
Copy hwdata module from display manager.
Add vboxvideo driver to the driver list.
2009-02-02 Fatih Aşıcı <fatih@pardus.org.tr>
* data/DriversDB, zorg/{config,probe}.py:
Add support for VirtualBox video and mouse drivers.
2009-01-22 Fatih Aşıcı <fatih@pardus.org.tr>
* zorg/parser.py:
Fix a regression introduced with
type/instance changes.
2009-01-21 Fatih Aşıcı <fatih@pardus.org.tr>
* zorg/probe.py:
Fixed framebuffer device node name.
* data/DriversDB:
Added new PCI IDs for nvidia-180.
2008-11-01 Fatih Aşıcı <fatih@pardus.org.tr>
* data/DriversDB:
Renamed nvidia packages.
Added new cards.
* data/modprobe.d/zorg:
Added new module names for nvidia.
* zorg/__init__.py:
Bumped version to 1.1.1.
2008-10-04 Fatih Aşıcı <fatih@pardus.org.tr>
* zorg/__init__.py:
Bumped version to 1.1.
* zorg/config.py:
Added support to create InputDevice sections
for wacom devices.
2008-09-24 Fatih Aşıcı <fatih@pardus.org.tr>
* zorg/probe.py:
Added a high timeout value for dbus calls since
enabling a driver package might take a long time on slow
machines.
2008-09-17 Fatih Aşıcı <fatih@pardus.org.tr>
* AUTHORS, ChangeLog:
Added AUTHORS and ChangeLog.
recursive-include zorg/ddc *.h
include zorg-loadmodule
include data/*DB data/modprobe.d/zorg
include AUTHORS ChangeLog COPYING README TODO
What is zorg?
-------------
zorg consists of python scripts and modules which
automate the configuration of Xorg.
Requirements
------------
* pardus-python > 0.3.3
Installing & Running
--------------------
1. Register the Çomar script comes with zorg package:
hav register Xorg.Display zorg comar/xorg.display.py
2. Install:
./setup.py install --install-lib=/usr/lib/pardus
3. Run: zorg-cli
zorg TODO List
==============
Legend:
- Todo
? Not determined if/how we have to do
/ In progress
+ Accomplished
Çomar Methods:
/ configuration setup on boot
+ check config files
+ check hardware changes
+ read kernel options (xorg=...)
+ do pending jobs
? compatibility check between kernel and xorg driver versions (e.g. nvidia-kernel and nvidia-glx issue)
- i18n support
- DPI setup
- INF file installation
- method to test server
? fall back to safeConfigure if something goes wrong while auto-probing
- improve debug stuff (maybe a log file)
Modules:
- try to get preferred resolution and use it by default
- parser to get monitor vendor/model list
Command Line Tool:
- test option
? DPI selection
? Xorg log file verbosity selection
? bug report option/tool
This diff is collapsed.
This diff is collapsed.
install fglrx /sbin/zorg-loadmodule $CMDLINE_OPTS
install nvidia /sbin/zorg-loadmodule $CMDLINE_OPTS
install nvidia_new /sbin/zorg-loadmodule $CMDLINE_OPTS
install nvidia_old /sbin/zorg-loadmodule $CMDLINE_OPTS
install nvidia_173 /sbin/zorg-loadmodule $CMDLINE_OPTS
install nvidia_177 /sbin/zorg-loadmodule $CMDLINE_OPTS
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# inf2mondb.py: convert .inf files for monitors to MonitorDB
#
# Matt Wilson <msw@redhat.com>
#
# Copyright 2002 Red Hat, Inc.
#
# Some fixes by Onur Küçük <onur@pardus.org.tr>
#
# This software may be freely redistributed under the terms of the GNU
# library public license.
import sys
import string
import re
def usage():
print "Usage: inf2mondb.py filename.inf"
sys.exit(1)
if len(sys.argv) < 2:
usage()
try:
f = open(sys.argv[1], 'r')
except IOError, (errno, str):
print "Unable to open %s: %s" % (sys.argv[1], str)
sys.exit(1)
lines = f.readlines()
f.close()
# the current section
section = None
# monitors - a dictionary keyed off manufacturers
monitors = {}
# a dictionary of manufacturers we're looking at
manufacturers = {}
# registry sections mapped back to the install sections
regsections = {}
# install sections that map back to monitor definitions
instsections = {}
# a big fat dictionary of strings to use later on.
strings = {}
class Monitor:
def __repr__(self):
return "%s; %s; %s; %s; %s" % (self.man,
self.descr,
self.edid,
self.hsync,
self.vsync)
def __init__(self, man, id, edid):
self.descr = ""
self.man = man
self.hsync = ""
self.vsync = ""
self.id = id
self.edid = edid
sectRe = re.compile(r'\[*\]')
sectSplit = re.compile(r'[\[\]]')
infoSplit = re.compile(r'[%=\\;]')
# This RE is for EISA info lines
# %D5259A%=D5259A, Monitor\HWP0487
monitor1Re = re.compile(r'%*.%.*=.*,.*Monitor\\')
# This one is for legacy entries
# %3020% =PB3020, MonID_PB3020
monitor2Re = re.compile(r'%*.%.*=.*,.*MonID_')
# sync values that might be in the strings section
sync_keys = {}
for line in lines:
tmp = string.strip(line)
if tmp and tmp[0] == ';':
continue
if sectRe.search (line, 1):
section = string.lower(sectSplit.split (line)[1])
continue
if section == "manufacturer":
tmp = infoSplit.split (line)
if len(tmp) > 1:
manufacturer = string.lower(tmp[1])
if manufacturers.has_key (tmp[1]):
raise RuntimeError, "Duplicate manufacturer entries"
else:
manufacturers[string.lower(string.strip(tmp[3].split(",")[0]))] = string.lower(string.strip(tmp[1]))
# if we're in a manufacturer section, we need to jot down
# the devices
elif manufacturers.has_key(section):
# Find monitor inf IDs and EISA ids:
monre = None
# EISA entries
# %D5259A%=D5259A, Monitor\HWP0487
if monitor1Re.search(line, 1):
monre = monitor1Re
# older non EISA entries
# %3020% =PB3020, MonID_PB3020
elif monitor2Re.search(line, 1):
monre = monitor2Re
if monre:
end = monre.search(line, 1).end()
id = string.strip(string.split(line, '%')[1])
if monre == monitor1Re:
# all EDID ID strings are 7 chars
edid = string.strip(line[end:])[0:7]
else:
edid = "0"
# we need to get the install section for this device
rhs = string.strip(string.split (line, '=')[1])
install = string.lower(string.strip(string.split (rhs, ',')[0]))
if instsections.has_key (install):
instsections[install].append ((section, id))
else:
instsections[install] = [ (section, id) ]
if not monitors.has_key (section):
monitors[section] = {}
monitors[section][id] = Monitor(section, id, edid)
elif section == "strings":
tmp = string.strip(tmp)
if not tmp:
continue
tmp = string.split (line, '=')
if len (tmp) < 2:
continue
key = string.lower(string.strip(tmp[0]))
tmp = string.split(string.strip(tmp[1]), '"')
if len (tmp) > 1:
value = tmp[1]
else:
value = tmp[0]
strings[key] = string.strip(value)
# Deal with sync lines in the strings section
if sync_keys.has_key(key):
sync = string.split(value, ",")
for (man, mon) in sync_keys[key]:
monitors[man][mon].hsync = string.strip(sync[0])
monitors[man][mon].vsync = string.strip(sync[1])
# these are the sections that tell us which AddReg to use
# AddReg=PBCOM14L.AddReg, 1024, DPMS
elif instsections.has_key(section):
if string.find (line, "AddReg=") >= 0:
rhs = string.split (line, '=')[1]
# PBCOM14L.AddReg, 1024, DPMS
registry = string.lower(string.strip(string.split(rhs, ',')[0]))
# add this monitor to the list of monitors that will
# use this registry entry
if regsections.has_key(registry):
regsections[registry].append (section)
else:
regsections[registry] = [ section ]
# these are the actual AddReg entries. Look up in our table
# to find which
elif regsections.has_key(section):
if string.find(line, 'HKR') >= 0:
ids = regsections[section]
# make a list of all the monitors pointing to
# this registry section via install sections
mons = []
for id in ids:
mons = mons + instsections[id]
if string.find(line, 'HKR,"MODES') >= 0:
modes = string.split(line, '"')
sync = string.split(modes[3], ',')
for (man, mon) in mons:
monitors[man][mon].hsync = string.strip(sync[0])
monitors[man][mon].vsync = string.strip(sync[1])
else:
# Sync lines must be somewhere else, maybe in the strings section
keyval = None
try:
keyval = string.split(line,",")[4]
except IndexError:
pass
if keyval and string.find(keyval, "KeyValue") >= 0:
keyval = string.replace(string.strip(keyval), "%", "").lower()
sync_keys[keyval] = mons
for man in manufacturers.keys():
for monitor in monitors[man].values():
# OK, I know it's hacked up to look up these strings way down
# here, but .inf format is CRAP.
try:
monitor.descr = strings[string.lower(monitor.id)]
except KeyError:
monitor.descr = monitor.id
try:
monitor.man = strings[string.lower(manufacturers[man])]
except:
monitor.man = manufacturers[man]
print monitor
#!/usr/bin/python
#-*- coding: utf-8 -*-
import os
from distutils.core import setup
from distutils.command.install import install
import zorg
from zorg import consts
class Install(install):
def run(self):
install.run(self)
if not self.root:
self.root = "/"
target = os.path.join(self.root, consts.config_dir.lstrip("/"))
if not os.path.exists(target):
os.makedirs(target, 0755)
setup(name="zorg",
version=zorg.versionString(),
description="Python Modules for zorg",
license="GNU GPL2",
url="http://www.pardus.org.tr/",
packages = ["zorg"],
scripts = ["zorg-cli", "inf2mondb"],
data_files = [
(consts.data_dir, ["data/DriversDB", "data/MonitorsDB"]),
("/sbin", ["zorg-loadmodule"]),
],
cmdclass = {"install": Install}
)
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2008 TUBITAK/UEKAE
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# Please read the COPYING file.
import os
import sys
import optparse
import dbus
import zorg
import zorg.probe
from zorg.consts import package_sep
from zorg.utils import *
zorg_info = " Xorg AutoConfiguration tool"
class ComarLink:
def __init__(self):
self.bus = None
self.iface = None
def __getattr__(self, method):
if not self.iface:
self._connect()
return getattr(self.iface, method)
def _connect(self):
if os.getuid() != 0:
print "You must be root to use this tool."
sys.exit(1)
self.bus = dbus.SystemBus()
object = self.bus.get_object("tr.org.pardus.comar", "/package/zorg", introspect=False)
self.iface = dbus.Interface(object, "tr.org.pardus.comar.Xorg.Display")
link = ComarLink()
def safe():
if link.safeConfig():
print "Initialized a safe configuration using VESA driver."
else:
print "Failed to create a safe configuration with VESA driver."
def probe(opts):
if force or not xisrunning():
if link.initialConfig():
print "Created an initial configuration for your video device."
else:
print "An error occured while creating an initial configuration."
else:
print "Not probing since X server is running."
def setDriver(driver):
# shortcuts for packages
shortcuts = {
"fglrx": "fglrx/ati-drivers",
"nvidia-old": "nvidia/nvidia-drivers-old",
"nvidia": "nvidia/nvidia-drivers",
"nvidia-new": "nvidia/nvidia-drivers-new"
}
if shortcuts.has_key(driver):
driver = shortcuts[driver]
if package_sep in driver:
drv, pkg = driver.split(package_sep, 1)
if pkg.replace("-", "_") not in zorg.probe.listDriverPackages():
print "Package is not installed: %s" % pkg
sys.exit(1)
else:
if not zorg.probe.driverExists(driver):
print "Driver not found: %s" % driver
sys.exit(1)
args = {"driver": driver}
link.setPendingConfig(args)
if force or not xisrunning():
link.applyPendingConfig()
print "Driver changed to %s." % driver
else:
print "Changes will be applied when you restart your X server."
force = False
if __name__ == "__main__":
parser = optparse.OptionParser(description = "%s version %s"
% (zorg_info, zorg.versionString()))
parser.add_option("-s", "--safe", action="store_true",
dest="safe", default=False,
help="setup VESA 800x600 config without probing hardware")
parser.add_option("-p", "--probe", action="store_true",
dest="probe", default=False,
help="force probing all devices, even if xorg.conf exists")
parser.add_option("-d", "--driver", action="store", type="string",
dest="driver", default=None, metavar="DRIVER[%sPACKAGE]" % package_sep,
help="set video card driver to DRIVER")
parser.add_option("-f", "--force", action="store_true",
dest="force", default=False,
help="force probing even if the X server is running")
parser.add_option("", "--remove-pending", action="store_true",
dest="removePending", default=False,
help="remove pending configuration data")
parser.add_option("-k", "--keymap", action="store", type="string",
dest="keymap", default=None, metavar="LAYOUT[/VARIANT]",
help="changes keyboard map")
opts, args = parser.parse_args()
force = opts.force
if opts.safe:
safe()
elif opts.probe:
probe(opts)
elif opts.driver:
setDriver(opts.driver)
elif opts.removePending:
link.removePendingConfig()
print "Pending configurations removed."
elif opts.keymap:
keymap = opts.keymap.split("/", 1)
link.setKeymap(*keymap)
else:
parser.print_help()
#!/bin/sh
kernel_module=/var/lib/zorg/kernel_module
if [ -e $kernel_module ]; then
/sbin/modprobe --ignore-install $(cat $kernel_module) $@
fi
#-*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009, TUBITAK/UEKAE
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# Please read the COPYING file.
#
__version__ = "1.81"
def versionString():
return __version__
# -*- coding: utf-8 -*-
import os
import piksemel
from zorg import consts
from zorg.parser import *
from zorg.probe import VideoDevice, Monitor
from zorg.utils import *
def saveXorgConfig(card):
parser = XorgParser()
secFlags = XorgSection("ServerFlags")
secDevice = XorgSection("Device")
secScr = XorgSection("Screen")
secLay = XorgSection("ServerLayout")
parser.sections = [
secFlags,
secDevice,
]
if card.needsScreenSection():
parser.sections.extend([secScr, secLay])
if jailEnabled():
jailOpts = {
"DontVTSwitch" : "true",
}
secFlags.options.update(jailOpts)
info = card.getDict()
secDevice.set("Identifier", "VideoCard")
if card.driver:
secDevice.set("Driver", card.driver)
secDevice.options.update(card.driver_options)
flags = card.flags()
for output in card.active_outputs:
identifier = "Monitor[%s]" % output
monSec = XorgSection("Monitor")
parser.sections.append(monSec)
monSec.set("Identifier", identifier)
if card.monitors.has_key(output):
monSec.set("VendorName", card.monitors[output].vendor)
monSec.set("ModelName", card.monitors[output].model)
monSec.set("HorizSync", unquoted(card.monitors[output].hsync))
monSec.set("VertRefresh", unquoted(card.monitors[output].vref ))
if "norandr" not in flags:
secDevice.options["Monitor-%s" % output] = identifier
monSec.options["Enable"] = "true"
if card.modes.has_key(output):
monSec.options["PreferredMode"] = card.modes[output]
if card.desktop_setup in ("horizontal", "vertical"):
out1, out2 = card.active_outputs[:2]
if output == out1:
if card.desktop_setup == "horizontal":
pos = "LeftOf"
else:
pos = "Above"
monSec.options[pos] = "Monitor[%s]" % out2
if card.needsScreenSection():
secScr.set("Identifier", "Screen")
secScr.set("Device", "VideoCard")
if card.active_outputs:
secScr.set("Monitor", "Monitor[%s]" % card.active_outputs[0])
secScr.set("DefaultDepth", atoi(card.depth))
subsec = XorgSection("Display")
subsec.set("Depth", atoi(card.depth))
if card.needsModesLine():
output = card.active_outputs[0]
if card.modes.has_key(output):
subsec.set("Modes", card.modes[output], "800x600", "640x480")
secScr.sections = [subsec]
secLay.set("Identifier", "Layout")
secLay.set("Screen", "Screen")
backup(consts.xorg_conf_file)
f = open(consts.xorg_conf_file, "w")
f.write(parser.toString())
f.close()
def configuredBus():
try:
return open(consts.configured_bus_file).read()
except IOError:
return ""
def addTag(p, name, data):
t = p.insertTag(name)
t.insertData(data)
def getDeviceInfo(busId):
if not os.path.exists(consts.config_file):
return
doc = piksemel.parse(consts.config_file)
cardTag = None
for tag in doc.tags("Card"):
if tag.getAttribute("busId") == busId:
cardTag = tag
break
if not cardTag:
return
device = VideoDevice(busId=busId)
device.saved_vendor_id = cardTag.getTagData("VendorId")
device.saved_product_id = cardTag.getTagData("ProductId")
probeResultTag = cardTag.getTag("ProbeResult")
probeResult = {}
for tag in probeResultTag.tags("Value"):
key = tag.getAttribute("key")
child = tag.firstChild()
if child:
value = child.data()
else:
value = ""
probeResult[key] = value