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

Revision 1685, 6.2 kB (checked in by arnonym, 14 years ago)

Implement a rather old patch from stefan richter to better check for the firewire stacks presence.

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