From: Marc Fiuczynski Date: Fri, 17 Oct 2008 19:29:13 +0000 (+0000) Subject: Minor clean up: X-Git-Tag: BootManager-4.3-2~25 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=9bb9039e3f4170c459025355848837daa889f5e2;p=bootmanager.git Minor clean up: - moved definitions of PCI_BASE_CLASS_NETWORK, PCI_BASE_CLASS_STORAGE, and PCI_ANY out to the pypci module. This way the pl_hwinit code in the BootCD can use those definitions. - fixed variable reference in print statement for "Unable to read". - cleaned up code to print device modules in the main() function --- diff --git a/source/systeminfo.py b/source/systeminfo.py index 3499306..71923a9 100755 --- a/source/systeminfo.py +++ b/source/systeminfo.py @@ -52,11 +52,6 @@ LSPCI_CMD= "/sbin/lspci -nm" MODULE_CLASS_NETWORK= "network" MODULE_CLASS_SCSI= "scsi" -PCI_BASE_CLASS_NETWORK=0x02L -PCI_BASE_CLASS_STORAGE=0x01L - -PCI_ANY=0xffffffffL - def get_total_phsyical_mem(vars = {}, log = sys.stderr): """ return the total physical memory of the machine, in kilobytes. @@ -266,7 +261,7 @@ def get_system_modules( vars = {}, log = sys.stderr): modules_pcimap_path = "%s/lib/modules/%s/modules.pcimap" % \ (SYSIMG_PATH,kernel_version) if not os.access(modules_pcimap_path,os.R_OK): - print( "Unable to read %s" % path ) + print( "WARNING: Unable to read %s" % modules_pcimap_path ) return pcimap = pypcimap.PCIMap(modules_pcimap_path) @@ -365,13 +360,10 @@ if __name__ == "__main__": if not modules: print "unable to list system modules" else: - for type in modules: - if type == MODULE_CLASS_SCSI: - print( "all scsi modules:" ) - for a_mod in modules[type]: - print a_mod - elif type == MODULE_CLASS_NETWORK: - print( "all network modules:" ) - for a_mod in modules[type]: - print a_mod + for module_class in (MODULE_CLASS_SCSI,MODULE_CLASS_NETWORK): + if len(modules[module_class]) > 0: + module_list = "" + for a_mod in modules[module_class]: + module_list = module_list + "%s " % a_mod + print "all %s modules: %s" % (module_class, module_list)