Changeset 2738

Show
Ignore:
Timestamp:
01/31/18 00:16:26 (7 months ago)
Author:
jwoithe
Message:

[PATCH 02/13] python tools: simplify helpstrings.

From Nicolas Boulenguez.

Files:

Legend:

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

    r2737 r2738  
    2929 
    3030from listirqinfo import IRQ,SoftIRQ,IRQInfo 
    31 from helpstrings import HelpStrings 
     31import helpstrings 
    3232from ffado_diag_helpers import * 
    3333 
     
    172172    print "=== REPORT ===" 
    173173 
    174     help = HelpStrings() 
    175  
    176174    # do the interpretation of the tests 
    177175    print "FireWire kernel drivers:" 
    178176    if (oldstack_loaded or oldstack_statically_linked) and \ 
    179177       (newstack_loaded or newstack_statically_linked): 
    180         help.show('MODULES_BOTH_STACKS_LOADED'
     178        print (helpstrings.MODULES_BOTH_STACKS_LOADED
    181179        sys.exit(-1) 
    182180    elif newstack_loaded or newstack_statically_linked: 
    183         help.show('MODULES_NEW_STACK_LOADED'
     181        print (helpstrings.MODULES_NEW_STACK_LOADED
    184182        sys.exit(-1) 
    185183    elif oldstack_statically_linked: 
    186184        print "[PASS] Kernel drivers statically linked into the kernel." 
    187185    elif not oldstack_present: 
    188         help.show('MODULES_OLD_STACK_NOT_INSTALLED'
     186        print (helpstrings.MODULES_OLD_STACK_NOT_INSTALLED
    189187        sys.exit(-1) 
    190188    elif not oldstack_loaded: 
    191         help.show('MODULES_OLD_STACK_NOT_LOADED'
     189        print (helpstrings.MODULES_OLD_STACK_NOT_LOADED
    192190        sys.exit(-1) 
    193191    else: 
     
    195193 
    196194    if not devnode_present: 
    197         help.show('DEVNODE_OLD_STACK_NOT_PRESENT'
     195        print (helpstrings.DEVNODE_OLD_STACK_NOT_PRESENT
    198196        sys.exit(-1) 
    199197    else: 
    200198        if not devnode_permissions: 
    201             help.show('DEVNODE_OLD_STACK_NO_PERMISSION'
     199            print (helpstrings.DEVNODE_OLD_STACK_NO_PERMISSION
    202200            sys.exit(-1) 
    203201        else: 
  • trunk/libffado/support/tools/helpstrings.py

    r2737 r2738  
    1919# 
    2020 
    21 class HelpStrings: 
    22     def __init__(self): 
    23         strings = {} 
    24         strings['MODULES_OLD_STACK_NOT_INSTALLED']=""" 
     21MODULES_OLD_STACK_NOT_INSTALLED = """ 
    2522FireWire kernel stack not present. Please compile the kernel with 
    2623FireWire support. 
    2724""" 
    28         strings['MODULES_BOTH_STACKS_LOADED']=""" 
     25MODULES_BOTH_STACKS_LOADED = """ 
    2926Both old and new FireWire kernel modules are loaded, your system 
    3027configuration is bogus. 
    3128""" 
    32         strings['MODULES_NEW_STACK_LOADED']=""" 
     29MODULES_NEW_STACK_LOADED = """ 
    3330The new FireWire kernel stack is loaded. 
    3431If running a kernel earlier than 2.6.37 and problems are experienced, either 
     
    3633(preferrably 2.6.37 or later). 
    3734""" 
    38         strings['MODULES_OLD_STACK_NOT_LOADED']=""" 
     35MODULES_OLD_STACK_NOT_LOADED = """ 
    3936FireWire kernel module(s) not found. 
    4037Please ensure that the raw1394 module is loaded. 
    4138""" 
    42         strings['DEVNODE_OLD_STACK_NOT_PRESENT']=""" 
     39DEVNODE_OLD_STACK_NOT_PRESENT = """ 
    4340/dev/raw1394 device node not present. 
    4441Please fix your udev configuration or add it as a static node. 
    4542""" 
    46         strings['DEVNODE_OLD_STACK_NO_PERMISSION']=""" 
     43DEVNODE_OLD_STACK_NO_PERMISSION = """ 
    4744Not enough permissions to access /dev/raw1394 device. 
    4845Please fix your udev configuration, the node permissions or 
    4946the user/group permissions. 
    5047""" 
    51  
    52         self.strings=strings 
    53  
    54     def get(self, sid): 
    55         return self.strings[sid] 
    56  
    57     def show(self, sid): 
    58         print( self.get(sid) )