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

Revision 2125, 6.7 kB (checked in by jwoithe, 12 years ago)

From Nils Philippsen: python: prefer installed python modules/paths. This ensures that the ffado python programs find their respective modules before any others which might happen to be reachable via the default python path.

  • 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.insert(0, "$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     if newstack_active:
108         # check permissions
109         newstack_permissions = get_juju_permissions()
110         print "  /dev/fw* permissions:"
111         print newstack_permissions
112
113     print "  User IDs:"
114     print get_user_ids()
115
116
117     # check libraries
118     print " Prerequisites (dynamic at run-time)..."
119     print "   gcc ............... %s" % get_version_first_line('gcc --version')
120     print "   g++ ............... %s" % get_version_first_line('g++ --version')
121     print "   PyQt4 (by pyuic4) . %s" % get_version_first_line('pyuic4 --version')
122     print "   jackd ............. %s" % get_version_first_line('jackd --version')
123     print "     path ............ %s" % get_command_path('jackd')
124     print "     flags ........... %s" % get_package_flags("jack")
125     print "   libraw1394 ........ %s" % get_package_version("libraw1394")
126     print "     flags ........... %s" % get_package_flags("libraw1394")
127     print "   libavc1394 ........ %s" % get_package_version("libavc1394")
128     print "     flags ........... %s" % get_package_flags("libavc1394")
129     print "   libiec61883 ....... %s" % get_package_version("libiec61883")
130     print "     flags ........... %s" % get_package_flags("libiec61883")
131     print "   libxml++-2.6 ...... %s" % get_package_version("libxml++-2.6")
132     print "     flags ........... %s" % get_package_flags("libxml++-2.6")
133     print "   dbus-1 ............ %s" % get_package_version("dbus-1")
134     print "     flags ........... %s" % get_package_flags("dbus-1")
135     print " Prerequisites (static at compile-time)..."
136     f = open( "$PYTHONDIR/static_info.txt", "r" )
137     for line in f:
138         line = line[:-1]
139         if line is not "\n" and line.startswith("  "):
140             print line
141     f.close()
142
143     # libraw
144    
145     print " Hardware..."
146     # check host controller
147     print "   Host controllers:"
148     list_host_controllers()
149     print "   CPU info:"
150     if len(run_command("which lscpu")) > 0:
151         print run_command("lscpu")
152     else:
153         print run_command("cat /proc/cpuinfo")
154
155     print " Configuration..."
156     # check RT settings
157    
158     # check IRQ settings
159     print "  IRQ information"
160     info = IRQInfo()
161
162     info.load()
163     print str(info)
164
165     print ""
166     print "=== REPORT ==="
167    
168     help = HelpStrings()
169    
170     # do the interpretation of the tests
171     print "FireWire kernel drivers:"
172     if (oldstack_loaded or oldstack_statically_linked) and \
173        (newstack_loaded or newstack_statically_linked):
174         help.show('MODULES_BOTH_STACKS_LOADED')
175         sys.exit(-1)
176     elif newstack_loaded or newstack_statically_linked:
177         help.show('MODULES_NEW_STACK_LOADED')
178         sys.exit(-1)
179     elif oldstack_statically_linked:
180         print "[PASS] Kernel drivers statically linked into the kernel."
181     elif not oldstack_present:
182         help.show('MODULES_OLD_STACK_NOT_INSTALLED')
183         sys.exit(-1)
184     elif not oldstack_loaded:
185         help.show('MODULES_OLD_STACK_NOT_LOADED')
186         sys.exit(-1)
187     else:
188         print "[PASS] Kernel modules present and correctly loaded."
189
190     if not devnode_present:
191         help.show('DEVNODE_OLD_STACK_NOT_PRESENT')
192         sys.exit(-1)
193     else:
194         if not devnode_permissions:
195             help.show('DEVNODE_OLD_STACK_NO_PERMISSION')
196             sys.exit(-1)
197         else:
198             print "[PASS] /dev/raw1394 node present and accessible."
199    
200    
201    
Note: See TracBrowser for help on using the browser.