Ejemplo n.º 1
0
 def setCurrentChipInfo(self):
     hwList = []
     self.currentChip = ''
     self.installableDriver = ''
     self.status = ''
     
     # Get Broadcom info
     cmdBc = 'lspci -vnn -d 14e4:'
     hwBc = self.ec.run(cmdBc)
     for line in hwBc:
         self.hw = line[line.find(': ') + 2:]
         self.log.write('Broadcom found: ' + self.hw, 'broadcom.setCurrentChipInfo', 'info')
         if hwCodes[2] in self.hw.lower():
             # Get the chip set number
             chipSet = re.search('14e4:(.*)]', self.hw)
             if chipSet:
                 self.currentChip = chipSet.group(1)
                 self.log.write('Broadcom chip set found: ' + self.currentChip, 'broadcom.setCurrentChipInfo', 'debug')
                 for chipList in bcChips:
                     if self.currentChip == chipList[0]:
                         # Supported chipset found: set variables
                         self.log.write('Broadcom chip set driver: ' + chipList[1], 'broadcom.setCurrentChipInfo', 'debug')
                         self.installableChip = chipList[0]
                         self.installableDriver = chipList[1]
                         self.status = functions.getPackageStatus(chipList[1])
                         break
         if self.installableChip != '':
             # Don't look further if you already found an installable chip set
             break
         else:
             self.log.write('Broadcom chip set not supported: ' + self.hw, 'broadcom.setCurrentChipInfo', 'error')
Ejemplo n.º 2
0
 def getATI(self):
     # Check for ATI cards
     hwList = []
     cmdGraph = 'lspci | grep VGA'
     hwGraph = self.ec.run(cmdGraph, False)
     #hwGraph = ['00:01.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Wrestler [Radeon HD 6310]']
     for line in hwGraph:
         hw = line[line.find(': ') + 2:]
         self.log.write('ATI card found: ' + hw, 'ati.getATI', 'info')
         atiChk = re.search('\\b' + hwCodes[1] + '\\b', hw.lower())
         if atiChk:
             # Get the ATI chip set serie
             atiSerie = re.search('\s\d{4,}', hw)
             if atiSerie:
                 self.log.write('ATI chip serie found: ' + atiSerie.group(0), 'ati.getATI', 'info')
                 intSerie = functions.strToInt(atiSerie.group(0))
                 # Only add series from atiStartSerie
                 if intSerie >= atiStartSerie:
                     drv = self.getDriver()
                     status = functions.getPackageStatus(drv)
                     self.log.write('ATI ' + drv + ' status: ' + status, 'ati.getATI', 'debug')
                     hwList.append([hw, hwCodes[1], status])
                 else:
                     self.log.write('ATI chip serie not supported: ' + str(intSerie), 'ati.getATI', 'warning')
                     hwList.append([hw, hwCodes[1], packageStatus[2]])
             else:
                 self.log.write('No supported ATI chip serie found: ' + hw, 'ati.getATI', 'warning')
         else:
             self.log.write('No ATI card found', 'ati.getATI', 'warning')
     
     return hwList
Ejemplo n.º 3
0
    def installPAE(self):
        try:
            cmdPae = 'apt-get -y --force-yes install linux-headers-686-pae linux-image-686-pae'
            # Check if already installed
            status = functions.getPackageStatus('linux-headers-686-pae')
            if status == packageStatus[0]:
                cmdPae += ' --reinstall'
            self.log.write('PAE kernel install command: ' + cmdPae,
                           'pae.installPAE', 'debug')
            self.ec.run(cmdPae)

            # Check for Nvidia
            nv = Nvidia(self.distribution, self.log)
            nvList = nv.getNvidia()
            self.log.write('Nvidia info: ' + str(nvList), 'pae.installPAE',
                           'debug')
            for nvInfo in nvList:
                if nvInfo[2] == packageStatus[0]:
                    self.log.write('Install Nvidia drivers', 'pae.installPAE',
                                   'info')
                    nv.installNvidia()

            # Remove xorg.conf
            #xorg = '/etc/X11/xorg.conf'
            #if os.path.exists(xorg):
            #    shutil.move(xorg, xorg + '.ddm')
            #    self.log.write('Moved ' + xorg + ' to ' + xorg + '.ddm', 'pae.installPAE', 'info')

        except Exception, detail:
            self.log.write(detail, 'pae.installPAE', 'error')
Ejemplo n.º 4
0
 def installPAE(self):
     try:
         cmdPae = 'apt-get -y --force-yes install linux-headers-686-pae linux-image-686-pae'
         # Check if already installed
         status = functions.getPackageStatus('linux-headers-686-pae')
         if status == packageStatus[0]:
             cmdPae += ' --reinstall'
         self.log.write('PAE kernel install command: ' + cmdPae, 'pae.installPAE', 'debug')
         self.ec.run(cmdPae)
         
         # Check for Nvidia
         nv = Nvidia(self.distribution, self.log)
         nvList = nv.getNvidia()
         self.log.write('Nvidia info: ' + str(nvList), 'pae.installPAE', 'debug')
         for nvInfo in nvList:
             if nvInfo[2] == packageStatus[0]:
                 self.log.write('Install Nvidia drivers', 'pae.installPAE', 'info')
                 nv.installNvidia()
         
         # Remove xorg.conf
         #xorg = '/etc/X11/xorg.conf'
         #if os.path.exists(xorg):
         #    shutil.move(xorg, xorg + '.ddm')
         #    self.log.write('Moved ' + xorg + ' to ' + xorg + '.ddm', 'pae.installPAE', 'info')
             
     except Exception, detail:
         self.log.write(detail, 'pae.installPAE', 'error')
Ejemplo n.º 5
0
    def getATI(self):
        # Check for ATI cards
        hwList = []
        # Is it ATI?
        nvChk = re.search('\\b' + hwCodes[1] + '\\b', self.hw.lower())
        if nvChk:
            self.log.write('ATI card found: ' + self.hw, 'ati.getATI', 'info')
            # Get the ATI chip set serie
            atiSerie = re.search('\s\d{4,}', self.hw)
            if atiSerie:
                self.log.write('ATI chip serie found: ' + atiSerie.group(0), 'ati.getATI', 'info')
                intSerie = functions.strToNumber(atiSerie.group(0))
                # Only add series from atiStartSerie
                if intSerie >= atiStartSerie:
                    drv = self.getDriver()
                    status = functions.getPackageStatus(drv)
                    self.log.write('ATI ' + drv + ' status: ' + status, 'ati.getATI', 'debug')
                    hwList.append([self.hw, hwCodes[1], status])
                else:
                    self.log.write('ATI chip serie not supported: ' + str(intSerie), 'ati.getATI', 'warning')
                    hwList.append([self.hw, hwCodes[1], packageStatus[2]])
            else:
                self.log.write('No ATI chip serie found: ' + self.hw, 'ati.getATI', 'warning')
                hwList.append([self.hw, hwCodes[1], packageStatus[2]])

        return hwList
Ejemplo n.º 6
0
    def installNvidiaDriver(self, packageList):
        try:
            # Remove certain packages before installing the drivers
            for package in packageList:
                if package[1] == 1:
                    if functions.isPackageInstalled(package[0]):
                        self.log.write('Remove package: ' + package[0], 'nvidia.installNvidiaDriver', 'debug')
                        self.ec.run('apt-get -y --force-yes remove ' + package[0])

            # Preseed answers for some packages
            self.preseedNvidiaPackages('install')

            # Install the packages
            installString = ''
            notInRepo = ''
            for package in packageList:
                chkStatus = functions.getPackageStatus(package[0])
                if chkStatus != packageStatus[2]:
                    installString += ' ' + package[0]
                elif package[1] != 2:
                    notInRepo += ', ' + package[0]

            if notInRepo == '':
                self.ec.run('apt-get -y --force-yes install' + installString)
            else:
                self.log.write('Install aborted: not in repository: ' + notInRepo[2:], 'nvidia.installNvidiaDriver', 'error')

        except Exception, detail:
            self.log.write(detail, 'nvidia.installNvidiaDriver', 'exception')
Ejemplo n.º 7
0
    def getATI(self):
        # Check for ATI cards
        hwList = []
        cmdGraph = "lspci | grep VGA"
        hwGraph = self.ec.run(cmdGraph, False)
        # hwGraph = ['00:01.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Wrestler [Radeon HD 6310]']
        for line in hwGraph:
            hw = line[line.find(": ") + 2 :]
            self.log.write("ATI card found: " + hw, "ati.getATI", "info")
            atiChk = re.search("\\b" + hwCodes[1] + "\\b", hw.lower())
            if atiChk:
                # Get the ATI chip set serie
                atiSerie = re.search("\s\d{4,}", hw)
                if atiSerie:
                    self.log.write("ATI chip serie found: " + atiSerie.group(0), "ati.getATI", "info")
                    intSerie = functions.strToInt(atiSerie.group(0))
                    # Only add series from atiStartSerie
                    if intSerie >= atiStartSerie:
                        drv = self.getDriver()
                        status = functions.getPackageStatus(drv)
                        self.log.write("ATI " + drv + " status: " + status, "ati.getATI", "debug")
                        hwList.append([hw, hwCodes[1], status])
                    else:
                        self.log.write("ATI chip serie not supported: " + str(intSerie), "ati.getATI", "warning")
                        hwList.append([hw, hwCodes[1], packageStatus[2]])
                else:
                    self.log.write("No supported ATI chip serie found: " + hw, "ati.getATI", "warning")
            else:
                self.log.write("No ATI card found", "ati.getATI", "warning")

        return hwList
Ejemplo n.º 8
0
    def setCurrentChipInfo(self):
        self.currentChip = ''
        self.installableDriver = ''
        self.status = ''

        # Get Broadcom info
        cmdBc = 'lspci | grep Broadcom'
        hwBc = self.ec.run(cmdBc)
        if hwBc:
            self.hw = hwBc[0][hwBc[0].find(': ') + 2:]
            self.log.write('Broadcom found: ' + self.hw, 'broadcom.setCurrentChipInfo', 'info')
            # Get the chip set number
            cmdPciId = 'lspci -n -d 14e4:'
            pciId = self.ec.run(cmdPciId)
            if pciId:
                chipSet = re.search('14e4:([a-zA-Z0-9]*)', pciId[0])
                if chipSet:
                    self.currentChip = chipSet.group(1)
                    self.log.write('Broadcom chip set found: ' + self.currentChip, 'broadcom.setCurrentChipInfo', 'debug')
                    for chipList in bcChips:
                        if self.currentChip == chipList[0]:
                            # Supported chipset found: set variables
                            self.installableChip = chipList[0]
                            if self.distribution == 'debian':
                                self.installableDriver = chipList[1]
                                # Check if you already have wireless
                                if functions.hasWireless():
                                    self.status = packageStatus[0]
                                else:
                                    self.status = functions.getPackageStatus(chipList[1])
                            else:
                                # Assume Ubuntu
                                self.installableDriver = chipList[2]
                                if functions.hasWireless():
                                    self.status = packageStatus[0]
                                else:
                                    self.status = functions.getPackageStatus(chipList[2])

                            self.log.write('Broadcom driver: ' + self.installableDriver + ' (' + self.status + ')', 'broadcom.setCurrentChipInfo', 'debug')
                            break
                    # Check if a supported chip set is found
                    if self.installableChip == '':
                        self.log.write('Broadcom chipset not supported or ethernet controller: ' + self.hw, 'broadcom.setCurrentChipInfo', 'warning')
                else:
                    self.log.write('Broadcom chipset not found: ' + pciId[0], 'broadcom.setCurrentChipInfo', 'warning')
            else:
                self.log.write('Broadcom pci ID not found: ' + self.hw, 'broadcom.setCurrentChipInfo', 'warning')
Ejemplo n.º 9
0
 def installBroadcom(self):
     try:
         self.setCurrentChipInfo()
         if self.installableDriver != '':
             # Get the correct linux header package
             linHeader = self.ec.run("echo linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,')", False)
             self.log.write('Linux header name to install: ' + linHeader[0], 'broadcom.installBroadcom', 'info')
             
             # Only install linux header if it is not installed
             status = functions.getPackageStatus(linHeader[0])
             if status == packageStatus[1]:
                 self.log.write('Download package: ' + linHeader, 'broadcom.installBroadcom', 'info')
                 self.ec.run('apt-get download ' + linHeader)
                 
             # Download the driver
             cmdBc = 'apt-get download ' + self.installableDriver
             self.log.write('Download package: ' + self.installableDriver, 'broadcom.installBroadcom', 'info')
             self.ec.run(cmdBc)
             
             # Remove any module that might be in the way
             self.log.write('modprobe b44, b43, b43legacy, ssb, brcmsmac', 'broadcom.installBroadcom', 'debug')
             os.system('modprobe -rf b44')
             os.system('modprobe -rf b43')
             os.system('modprobe -rf b43legacy')
             os.system('modprobe -rf ssb')
             os.system('modprobe -rf brcmsmac')
             
             # Install the dowloaded packages
             self.log.write('Install downloaded packages', 'broadcom.installBroadcom', 'info')
             self.ec.run('dpkg -i *.deb')
             # Delete the downloaded packages
             self.log.write('Remove downloaded debs', 'broadcom.installBroadcom', 'debug')
             os.system('rm -f *.deb')
             
             # Finish up
             if self.installableDriver == 'broadcom-sta-dkms':
                 # Blacklist b43, brcmsmac
                 self.log.write('blacklist b43 brcmsmac bcma', 'broadcom.installBroadcom', 'debug')
                 modFile = open(blacklistPath, 'w')
                 modFile.write('blacklist b43 brcmsmac')
                 modFile.close()
                 # Start wl
                 self.log.write('modprobe wl', 'broadcom.installBroadcom', 'debug')
                 os.system('modprobe wl')
             elif 'b43' in self.installableDriver:
                 # Start b43
                 self.log.write('modprobe b43', 'broadcom.installBroadcom', 'debug')
                 os.system('modprobe b43')
             else:
                 # Start brcmsmac
                 self.log.write('modprobe brcmsmac', 'broadcom.installBroadcom', 'debug')
                 os.system('modprobe brcmsmac')
         else:
             self.log.write('No Broadcom chip set found', 'broadcom.installBroadcom', 'error')
             
     except Exception, detail:
         self.log.write(detail, 'broadcom.installBroadcom', 'exception')
Ejemplo n.º 10
0
 def __init__(self, distribution, loggerObject):
     self.distribution = distribution.lower()
     self.log = loggerObject
     self.ec = ExecCmd(self.log)
     
     # Install nvidia-detect if it isn't installed already
     if functions.getPackageStatus('nvidia-detect') == packageStatus[1]:
         self.log.write('Install nvidia-detect', 'nvidia.getNvidia', 'info')
         self.ec.run('apt-get -y --force-yes install nvidia-detect')
Ejemplo n.º 11
0
    def __init__(self, distribution, loggerObject):
        self.distribution = distribution.lower()
        self.log = loggerObject
        self.ec = ExecCmd(self.log)

        # Install nvidia-detect if it isn't installed already
        if functions.getPackageStatus('nvidia-detect') == packageStatus[1]:
            self.log.write('Install nvidia-detect', 'nvidia.getNvidia', 'info')
            self.ec.run('apt-get -y --force-yes install nvidia-detect')
Ejemplo n.º 12
0
 def getNvidia(self):
     hwList = []
     # Get the appropriate driver
     drv = self.getDriver()
     if drv != '':
         self.log.write('Get package status for driver: ' + drv, 'nvidia.getNvidia', 'info')
         status = functions.getPackageStatus(drv)
         self.log.write('Package status: ' + status, 'nvidia.getNvidia', 'debug')
         hw = functions.getGraphicsCard()
         hwList.append([hw, hwCodes[0], status])
     
     return hwList
Ejemplo n.º 13
0
    def getNvidia(self):
        hwList = []
        # Get the appropriate driver
        drv = self.getDriver()
        if drv != '':
            self.log.write('Get package status for driver: ' + drv,
                           'nvidia.getNvidia', 'info')
            status = functions.getPackageStatus(drv)
            self.log.write('Package status: ' + status, 'nvidia.getNvidia',
                           'debug')
            hw = functions.getGraphicsCard()
            hwList.append([hw, hwCodes[0], status])

        return hwList
Ejemplo n.º 14
0
    def getNvidia(self):
        hwList = []
        if self.gpu:
            # Get driver for Nvidia
            self.log.write('Get the appropriate Nvidia driver', 'nvidia.getNvidia', 'info')
            drv = self.getDriver()
            if drv != '':
                self.log.write('Nvidia driver to install: ' + drv, 'nvidia.getNvidia', 'info')
                status = functions.getPackageStatus(drv)
                self.log.write('Package status: ' + status, 'nvidia.getNvidia', 'debug')
                hwList.append([self.gpu[1], hwCodes[0], status])
            else:
                self.log.write('No supported driver found for: ' + self.gpu[1], 'nvidia.getNvidia', 'warning')
                hwList.append([self.gpu[1], hwCodes[0], packageStatus[2]])
        else:
            self.log.write('No supported Nvidia card found', 'nvidia.getNvidia', 'debug')

        return hwList