Changeset 1686
- Timestamp:
- 10/12/09 13:34:30 (14 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/libffado-2.0/support/tools/ffado-diag.in
r1665 r1686 78 78 oldstack_present = check_1394oldstack_present() 79 79 oldstack_loaded = check_1394oldstack_loaded() 80 oldstack_active = check_1394oldstack_active() 81 oldstack_statically_linked = not check_1394oldstack_loaded() and check_1394oldstack_linked() 80 82 newstack_present = check_1394newstack_present() 81 83 newstack_loaded = check_1394newstack_loaded() 84 newstack_active = check_1394newstack_active() 85 newstack_statically_linked = not check_1394newstack_loaded() and check_1394newstack_linked() 82 86 83 87 print " old 1394 stack present.... " + str(oldstack_present) 84 88 print " old 1394 stack loaded..... " + str(oldstack_loaded) 89 print " old 1394 stack active..... " + str(oldstack_active) 85 90 print " new 1394 stack present.... " + str(newstack_present) 86 91 print " new 1394 stack loaded..... " + str(newstack_loaded) 92 print " new 1394 stack active..... " + str(newstack_active) 87 93 88 94 # check /dev/raw1394 node presence … … 148 154 # do the interpretation of the tests 149 155 print "FireWire kernel drivers:" 150 ## FIXME: what about in-kernel firewire? (i.e. no modules) 151 if not oldstack_present: 156 if (oldstack_loaded or oldstack_statically_linked) and \ 157 (newstack_loaded or newstack_statically_linked): 158 help.show('MODULES_BOTH_STACKS_LOADED') 159 sys.exit(-1) 160 elif newstack_loaded or newstack_statically_linked: 161 help.show('MODULES_NEW_STACK_LOADED') 162 sys.exit(-1) 163 elif oldstack_statically_linked: 164 print "[PASS] Kernel drivers statically linked into the kernel." 165 elif not oldstack_present: 152 166 help.show('MODULES_OLD_STACK_NOT_INSTALLED') 153 167 sys.exit(-1) 168 elif not oldstack_loaded: 169 help.show('MODULES_OLD_STACK_NOT_LOADED') 170 sys.exit(-1) 154 171 else: 155 if newstack_loaded and oldstack_loaded: 156 help.show('MODULES_BOTH_STACKS_LOADED') 157 sys.exit(-1) 158 elif newstack_loaded: 159 help.show('MODULES_NEW_STACK_LOADED') 160 sys.exit(-1) 161 elif not oldstack_loaded: 162 help.show('MODULES_OLD_STACK_NOT_LOADED') 163 sys.exit(-1) 164 else: 165 print "[PASS] Kernel modules present and correctly loaded." 172 print "[PASS] Kernel modules present and correctly loaded." 166 173 167 174 if not devnode_present: branches/libffado-2.0/support/tools/ffado_diag_helpers.py
r1665 r1686 46 46 47 47 # modules 48 def check_for_module_loaded(modulename ):49 log.info("Checking if module '%s' is loaded... " % modulename)50 f = open( '/proc/modules')48 def check_for_module_loaded(modulename, procfile): 49 log.info("Checking if module '%s' is present in %s... " % (modulename, procfile)) 50 f = open(procfile) 51 51 lines = f.readlines() 52 52 f.close() 53 53 for l in lines: 54 mod = l.split()[0] 55 if mod == modulename or mod == modulename.replace('-', '_'): 54 if l.find(modulename) > -1 or l.find(modulename.replace('-', '_')) > -1: 56 55 log.info(" found") 57 56 return True … … 72 71 return True 73 72 73 def check_1394oldstack_active(): 74 return check_for_module_loaded('ohci1394', '/proc/interrupts') 75 76 def check_1394oldstack_linked(): 77 return os.access('/sys/module/ohci1394', os.F_OK) and \ 78 os.access('/sys/module/raw1394', os.F_OK) 79 74 80 def check_1394oldstack_loaded(): 75 81 retval = True 76 if not check_for_module_loaded('ieee1394'): 77 retval = False 78 if not check_for_module_loaded('ohci1394'): 79 retval = False 80 if not check_for_module_loaded('raw1394'): 81 retval = False 82 for modulename in ('ieee1394', 'ohci1394', 'raw1394'): 83 if not check_for_module_loaded(modulename, '/proc/modules'): 84 retval = False 82 85 return retval 83 86 84 87 def check_1394oldstack_present(): 85 88 retval = True 86 if not check_for_module_present('ieee1394'): 87 retval = False 88 if not check_for_module_present('ohci1394'): 89 retval = False 90 if not check_for_module_present('raw1394'): 91 retval = False 89 for modulename in ('ieee1394', 'ohci1394', 'raw1394'): 90 if not check_for_module_present(modulename): 91 retval = False 92 92 return retval 93 94 def check_1394newstack_active(): 95 return check_for_module_loaded('firewire_ohci', '/proc/interrupts') 96 97 def check_1394newstack_linked(): 98 return os.access('/sys/module/firewire_ohci', os.F_OK) 93 99 94 100 def check_1394newstack_loaded(): 95 101 retval = True 96 if not check_for_module_loaded('firewire-core'): 97 retval = False 98 if not check_for_module_loaded('firewire-ohci'): 99 retval = False 102 for modulename in ('firewire_core', 'firewire_ohci'): 103 if not check_for_module_loaded(modulename, '/proc/modules'): 104 retval = False 100 105 return retval 101 106 102 107 def check_1394newstack_present(): 103 108 retval = True 104 if not check_for_module_present('firewire-core'): 105 retval = False 106 if not check_for_module_present('firewire-ohci'): 107 retval = False 109 for modulename in ('firewire-core', 'firewire-ohci'): 110 if not check_for_module_present(modulename): 111 retval = False 108 112 return retval 109 113