Changeset 1686

Show
Ignore:
Timestamp:
10/12/09 13:34:30 (14 years ago)
Author:
arnonym
Message:

Backport the changes to ffado-diag to better detect the firewire stack.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/libffado-2.0/support/tools/ffado-diag.in

    r1665 r1686  
    7878    oldstack_present = check_1394oldstack_present() 
    7979    oldstack_loaded = check_1394oldstack_loaded() 
     80    oldstack_active = check_1394oldstack_active() 
     81    oldstack_statically_linked = not check_1394oldstack_loaded() and check_1394oldstack_linked() 
    8082    newstack_present = check_1394newstack_present() 
    8183    newstack_loaded = check_1394newstack_loaded() 
     84    newstack_active = check_1394newstack_active() 
     85    newstack_statically_linked = not check_1394newstack_loaded() and check_1394newstack_linked() 
    8286     
    8387    print "  old 1394 stack present.... " + str(oldstack_present) 
    8488    print "  old 1394 stack loaded..... " + str(oldstack_loaded) 
     89    print "  old 1394 stack active..... " + str(oldstack_active) 
    8590    print "  new 1394 stack present.... " + str(newstack_present) 
    8691    print "  new 1394 stack loaded..... " + str(newstack_loaded) 
     92    print "  new 1394 stack active..... " + str(newstack_active) 
    8793     
    8894    # check /dev/raw1394 node presence 
     
    148154    # do the interpretation of the tests 
    149155    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: 
    152166        help.show('MODULES_OLD_STACK_NOT_INSTALLED') 
    153167        sys.exit(-1) 
     168    elif not oldstack_loaded: 
     169        help.show('MODULES_OLD_STACK_NOT_LOADED') 
     170        sys.exit(-1) 
    154171    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." 
    166173 
    167174    if not devnode_present: 
  • branches/libffado-2.0/support/tools/ffado_diag_helpers.py

    r1665 r1686  
    4646 
    4747# modules 
    48 def check_for_module_loaded(modulename): 
    49     log.info("Checking if module '%s' is loaded... " % modulename
    50     f = open('/proc/modules'
     48def check_for_module_loaded(modulename, procfile): 
     49    log.info("Checking if module '%s' is present in %s... " % (modulename, procfile)
     50    f = open(procfile
    5151    lines = f.readlines() 
    5252    f.close() 
    5353    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: 
    5655            log.info(" found") 
    5756            return True 
     
    7271        return True 
    7372 
     73def check_1394oldstack_active(): 
     74    return check_for_module_loaded('ohci1394', '/proc/interrupts') 
     75 
     76def check_1394oldstack_linked(): 
     77    return os.access('/sys/module/ohci1394', os.F_OK) and \ 
     78           os.access('/sys/module/raw1394',  os.F_OK) 
     79 
    7480def check_1394oldstack_loaded(): 
    7581    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 
    8285    return retval 
    8386 
    8487def check_1394oldstack_present(): 
    8588    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 
    9292    return retval 
     93 
     94def check_1394newstack_active(): 
     95    return check_for_module_loaded('firewire_ohci', '/proc/interrupts') 
     96 
     97def check_1394newstack_linked(): 
     98    return os.access('/sys/module/firewire_ohci', os.F_OK) 
    9399 
    94100def check_1394newstack_loaded(): 
    95101    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 
    100105    return retval 
    101106 
    102107def check_1394newstack_present(): 
    103108    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 
    108112    return retval 
    109113