root/trunk/libffado/support/tools/ffado-diag.in

Revision 1922, 6.4 kB (checked in by arnonym, 10 years ago)

Use lscpu if present, de-activate the rt-check which wasn't implemented. Change the wording if the new stack is loaded.

  • Property svn:executable set to *
Line 
1 #!/usr/bin/python
2 #
3
4 #
5 # Copyright (C) 2008 Pieter Palmers
6 #               2009-2010 Arnold Krille
7 #
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, version 3 of the License.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 #
20
21 #
22 # Test for common FFADO problems
23 #
24
25 import sys
26
27 # Add the path of the installed dependent files
28 sys.path.append( "$PYTHONDIR" )
29
30 from listirqinfo import IRQ,SoftIRQ,IRQInfo
31 from helpstrings import HelpStrings
32 from ffado_diag_helpers import *
33
34 ## message strings
35 FFADODIAG_VERSION = "$VERSION-$REVISION"
36
37 welcome_msg = """
38
39 FFADO diagnostic utility """ + FFADODIAG_VERSION + """
40 ============================
41 (C) 2008 Pieter Palmers
42     2009-2010 Arnold Krille
43
44 """
45
46 help_msg = """
47 Usage: ffado-diag [verboselevel]
48
49   verboselevel : verbosity level. (optional)
50
51 """
52
53 ## main program
54 if __name__== '__main__':
55
56     print welcome_msg
57
58     num_args = len(sys.argv)
59     if num_args not in [1,2]:
60         print help
61         sys.exit(0)
62
63     if num_args == 2:
64         loglevel = eval(sys.argv[1])
65         if loglevel == 1:
66             logging.getLogger('diag').setLevel(logging.INFO)
67         elif loglevel == 2:
68             logging.getLogger('diag').setLevel(logging.DEBUG)
69
70     print "=== CHECK ==="
71     print " Base system..."
72    
73     # check kernel
74     kernel_version = get_kernel_version()
75     print "  kernel version............ " + str(kernel_version)
76     # Hint: The main parts of the rt patches are in mainline-kernels nowadays. Performance with stock kernels is sufficient...
77     #kernel_is_rt_patched = get_kernel_rt_patched()
78     #print "   RT patched............... " + str(kernel_is_rt_patched)
79    
80     # check modules
81     oldstack_present = check_1394oldstack_present()
82     oldstack_loaded = check_1394oldstack_loaded()
83     oldstack_active = check_1394oldstack_active()
84     oldstack_statically_linked = not check_1394oldstack_loaded() and check_1394oldstack_linked()
85     newstack_present = check_1394newstack_present()
86     newstack_loaded = check_1394newstack_loaded()
87     newstack_active = check_1394newstack_active()
88     newstack_statically_linked = not check_1394newstack_loaded() and check_1394newstack_linked()
89    
90     print "  old 1394 stack present.... " + str(oldstack_present)
91     print "  old 1394 stack loaded..... " + str(oldstack_loaded)
92     print "  old 1394 stack active..... " + str(oldstack_active)
93     print "  new 1394 stack present.... " + str(newstack_present)
94     print "  new 1394 stack loaded..... " + str(newstack_loaded)
95     print "  new 1394 stack active..... " + str(newstack_active)
96    
97     # check /dev/raw1394 node presence
98     devnode_present = check_1394oldstack_devnode_present()
99     print "  /dev/raw1394 node present. " + str(devnode_present)
100     if devnode_present:
101         # check /dev/raw1394 access permissions
102         devnode_permissions = check_1394oldstack_devnode_permissions()
103         print "  /dev/raw1394 permissions.. " + str(devnode_permissions)
104     else:
105         devnode_permissions = None
106
107     # check libraries
108     print " Prerequisites (dynamic at run-time)..."
109     print "   gcc ............... %s" % get_version_first_line('gcc --version')
110     print "   g++ ............... %s" % get_version_first_line('g++ --version')
111     print "   PyQt4 (by pyuic4) . %s" % get_version_first_line('pyuic4 --version')
112     print "   jackd ............. %s" % get_version_first_line('jackd --version')
113     print "     path ............ %s" % get_command_path('jackd')
114     print "     flags ........... %s" % get_package_flags("jack")
115     print "   libraw1394 ........ %s" % get_package_version("libraw1394")
116     print "     flags ........... %s" % get_package_flags("libraw1394")
117     print "   libavc1394 ........ %s" % get_package_version("libavc1394")
118     print "     flags ........... %s" % get_package_flags("libavc1394")
119     print "   libiec61883 ....... %s" % get_package_version("libiec61883")
120     print "     flags ........... %s" % get_package_flags("libiec61883")
121     print "   libxml++-2.6 ...... %s" % get_package_version("libxml++-2.6")
122     print "     flags ........... %s" % get_package_flags("libxml++-2.6")
123     print "   dbus-1 ............ %s" % get_package_version("dbus-1")
124     print "     flags ........... %s" % get_package_flags("dbus-1")
125     print " Prerequisites (static at compile-time)..."
126     f = open( "$PYTHONDIR/static_info.txt", "r" )
127     for line in f:
128         line = line[:-1]
129         if line is not "\n" and line.startswith("  "):
130             print line
131     f.close()
132
133     # libraw
134    
135     print " Hardware..."
136     # check host controller
137     print "   Host controllers:"
138     list_host_controllers()
139     print "   CPU info:"
140     if len(run_command("which lscpu")) > 0:
141         print run_command("lscpu")
142     else:
143         print run_command("cat /proc/cpuinfo")
144
145     print " Configuration..."
146     # check RT settings
147    
148     # check IRQ settings
149     print "  IRQ information"
150     info = IRQInfo()
151
152     info.load()
153     print str(info)
154
155     print ""
156     print "=== REPORT ==="
157    
158     help = HelpStrings()
159    
160     # do the interpretation of the tests
161     print "FireWire kernel drivers:"
162     if (oldstack_loaded or oldstack_statically_linked) and \
163        (newstack_loaded or newstack_statically_linked):
164         help.show('MODULES_BOTH_STACKS_LOADED')
165         sys.exit(-1)
166     elif newstack_loaded or newstack_statically_linked:
167         help.show('MODULES_NEW_STACK_LOADED')
168         sys.exit(-1)
169     elif oldstack_statically_linked:
170         print "[PASS] Kernel drivers statically linked into the kernel."
171     elif not oldstack_present:
172         help.show('MODULES_OLD_STACK_NOT_INSTALLED')
173         sys.exit(-1)
174     elif not oldstack_loaded:
175         help.show('MODULES_OLD_STACK_NOT_LOADED')
176         sys.exit(-1)
177     else:
178         print "[PASS] Kernel modules present and correctly loaded."
179
180     if not devnode_present:
181         help.show('DEVNODE_OLD_STACK_NOT_PRESENT')
182         sys.exit(-1)
183     else:
184         if not devnode_permissions:
185             help.show('DEVNODE_OLD_STACK_NO_PERMISSION')
186             sys.exit(-1)
187         else:
188             print "[PASS] /dev/raw1394 node present and accessible."
189    
190    
191    
Note: See TracBrowser for help on using the browser.