|
|
|
@ -141,6 +141,40 @@ class fillVars(object, cl_base.glob_attr):
|
|
|
|
|
return vendor.lower()
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
def get_hr_x11_video_drv(self):
|
|
|
|
|
"""Get video driver used by xorg"""
|
|
|
|
|
xorg_modules_dir = '/usr/lib/xorg/modules/drivers'
|
|
|
|
|
xorg_conf = '/etc/X11/xorg.conf'
|
|
|
|
|
# Try analize Xorg.{DISPLAY}.log
|
|
|
|
|
display = os.environ.get('DISPLAY')
|
|
|
|
|
if display and os.path.exists(xorg_modules_dir):
|
|
|
|
|
list_avialable_drivers = os.listdir(xorg_modules_dir)
|
|
|
|
|
if list_avialable_drivers:
|
|
|
|
|
reDriver = re.compile('|'.join(list_avialable_drivers))
|
|
|
|
|
display_number = re.search(r':(\d+)\..*', display)
|
|
|
|
|
if display_number:
|
|
|
|
|
xorg_log_file = '/var/log/Xorg.%s.log' % \
|
|
|
|
|
display_number.group(1)
|
|
|
|
|
if os.path.exists(xorg_log_file):
|
|
|
|
|
matchStrs = [i for i in open(xorg_log_file)
|
|
|
|
|
if "drv" in i and reDriver.search(i)]
|
|
|
|
|
if matchStrs:
|
|
|
|
|
resDriver = re.search(r'([^/]+)_drv.so',
|
|
|
|
|
matchStrs[-1])
|
|
|
|
|
if resDriver:
|
|
|
|
|
return resDriver.group(1)
|
|
|
|
|
|
|
|
|
|
# analize /etc/X11/xorg.conf
|
|
|
|
|
if os.path.exists(xorg_conf):
|
|
|
|
|
matchSect = re.search(r'Section "Device".*?EndSection',
|
|
|
|
|
open('/etc/X11/xorg.conf').read(),re.S)
|
|
|
|
|
if matchSect:
|
|
|
|
|
resDriver = re.search(r'Driver\s*"([^"]+)"',
|
|
|
|
|
matchSect.group(0),re.S)
|
|
|
|
|
if resDriver:
|
|
|
|
|
return resDriver.group(1)
|
|
|
|
|
return "vesa"
|
|
|
|
|
|
|
|
|
|
def get_hr_video(self):
|
|
|
|
|
"""Производитель видеокарты"""
|
|
|
|
|
lines=self._runos("lspci")
|
|
|
|
|