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

Revision 2736, 6.9 kB (checked in by jwoithe, 6 years ago)

Allow python interpreter to be specified at build time.

Patch from Nicolas Boulenguez (forwarded to ffado-devel by Benoit Delcour)
which allows packagers to directly specify the python interpreter which
should be used by FFADO components. This is useful for systems which do not
have /usr/bin/python due to only python 3 being installed.

  • Property svn:executable set to *
Line 
1 #!$PYTHON_INTERPRETER
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$REVISIONSTRING"
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     kernel_is_preempt = get_kernel_preempt()
77     print "    Preempt (low latency)... " + str(kernel_is_preempt)
78     # Hint: The main parts of the rt patches are in mainline-kernels nowadays. Performance with stock kernels is sufficient...
79     kernel_is_rt_patched = get_kernel_rt_patched()
80     print "    RT patched.............. " + str(kernel_is_rt_patched)
81
82     # check modules
83     oldstack_present = check_1394oldstack_present()
84     oldstack_loaded = check_1394oldstack_loaded()
85     oldstack_active = check_1394oldstack_active()
86     oldstack_statically_linked = not check_1394oldstack_loaded() and check_1394oldstack_linked()
87     newstack_present = check_1394newstack_present()
88     newstack_loaded = check_1394newstack_loaded()
89     newstack_active = check_1394newstack_active()
90     newstack_statically_linked = not check_1394newstack_loaded() and check_1394newstack_linked()
91    
92     print "  old 1394 stack present.... " + str(oldstack_present)
93     print "  old 1394 stack loaded..... " + str(oldstack_loaded)
94     print "  old 1394 stack active..... " + str(oldstack_active)
95     print "  new 1394 stack present.... " + str(newstack_present)
96     print "  new 1394 stack loaded..... " + str(newstack_loaded)
97     print "  new 1394 stack active..... " + str(newstack_active)
98    
99     # check /dev/raw1394 node presence
100     devnode_present = check_1394oldstack_devnode_present()
101     print "  /dev/raw1394 node present. " + str(devnode_present)
102     if devnode_present:
103         # check /dev/raw1394 access permissions
104         devnode_permissions = check_1394oldstack_devnode_permissions()
105         print "  /dev/raw1394 permissions.. " + str(devnode_permissions)
106     else:
107         devnode_permissions = None
108
109     if newstack_active:
110         # check permissions
111         newstack_permissions = get_juju_permissions()
112         print "  /dev/fw* permissions:"
113         print newstack_permissions
114
115     print "  User IDs:"
116     print get_user_ids()
117
118
119     # check libraries
120     print " Prerequisites (dynamic at run-time)..."
121     print "   gcc ............... %s" % get_version_first_line('gcc --version')
122     print "   g++ ............... %s" % get_version_first_line('g++ --version')
123     print "   PyQt4 (by pyuic4) . %s" % get_version_first_line('pyuic4 --version')
124     print "   PyQt5 (by pyuic5) . %s" % get_version_first_line('pyuic5 --version')
125     print "   jackd ............. %s" % get_version_first_line('jackd --version')
126     print "     path ............ %s" % get_command_path('jackd')
127     print "     flags ........... %s" % get_package_flags("jack")
128     print "   libraw1394 ........ %s" % get_package_version("libraw1394")
129     print "     flags ........... %s" % get_package_flags("libraw1394")
130     print "   libavc1394 ........ %s" % get_package_version("libavc1394")
131     print "     flags ........... %s" % get_package_flags("libavc1394")
132     print "   libiec61883 ....... %s" % get_package_version("libiec61883")
133     print "     flags ........... %s" % get_package_flags("libiec61883")
134     print "   libxml++-2.6 ...... %s" % get_package_version("libxml++-2.6")
135     print "     flags ........... %s" % get_package_flags("libxml++-2.6")
136     print "   dbus-1 ............ %s" % get_package_version("dbus-1")
137     print "     flags ........... %s" % get_package_flags("dbus-1")
138     print " Prerequisites (static at compile-time)..."
139     f = open( "$PYTHONDIR/static_info.txt", "r" )
140     for line in f:
141         line = line[:-1]
142         if line is not "\n" and line.startswith("  "):
143             print line
144     f.close()
145
146     # libraw
147
148     print " uname -a..."
149     print "   " + run_command("uname -a")
150    
151     print " Hardware..."
152     # check host controller
153     print "   Host controllers:"
154     list_host_controllers()
155     print "   CPU info:"
156     if len(run_command("which lscpu")) > 0:
157         print run_command("lscpu")
158     else:
159         print run_command("cat /proc/cpuinfo")
160
161     print " Configuration..."
162     # check RT settings
163    
164     # check IRQ settings
165     print "  IRQ information"
166     info = IRQInfo()
167
168     info.load()
169     print str(info)
170
171     print ""
172     print "=== REPORT ==="
173    
174     help = HelpStrings()
175    
176     # do the interpretation of the tests
177     print "FireWire kernel drivers:"
178     if (oldstack_loaded or oldstack_statically_linked) and \
179        (newstack_loaded or newstack_statically_linked):
180         help.show('MODULES_BOTH_STACKS_LOADED')
181         sys.exit(-1)
182     elif newstack_loaded or newstack_statically_linked:
183         help.show('MODULES_NEW_STACK_LOADED')
184         sys.exit(-1)
185     elif oldstack_statically_linked:
186         print "[PASS] Kernel drivers statically linked into the kernel."
187     elif not oldstack_present:
188         help.show('MODULES_OLD_STACK_NOT_INSTALLED')
189         sys.exit(-1)
190     elif not oldstack_loaded:
191         help.show('MODULES_OLD_STACK_NOT_LOADED')
192         sys.exit(-1)
193     else:
194         print "[PASS] Kernel modules present and correctly loaded."
195
196     if not devnode_present:
197         help.show('DEVNODE_OLD_STACK_NOT_PRESENT')
198         sys.exit(-1)
199     else:
200         if not devnode_permissions:
201             help.show('DEVNODE_OLD_STACK_NO_PERMISSION')
202             sys.exit(-1)
203         else:
204             print "[PASS] /dev/raw1394 node present and accessible."
205    
206    
207    
Note: See TracBrowser for help on using the browser.