root/branches/libffado-2.0/support/tools/ffado-diag.in

Revision 1665, 5.6 kB (checked in by arnonym, 15 years ago)

Backport r1993 and fix #232.

  • 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 = "0.1"
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     newstack_present = check_1394newstack_present()
81     newstack_loaded = check_1394newstack_loaded()
82    
83     print "  old 1394 stack present.... " + str(oldstack_present)
84     print "  old 1394 stack loaded..... " + str(oldstack_loaded)
85     print "  new 1394 stack present.... " + str(newstack_present)
86     print "  new 1394 stack loaded..... " + str(newstack_loaded)
87    
88     # check /dev/raw1394 node presence
89     devnode_present = check_1394oldstack_devnode_present()
90     print "  /dev/raw1394 node present. " + str(devnode_present)
91     if devnode_present:
92         # check /dev/raw1394 access permissions
93         devnode_permissions = check_1394oldstack_devnode_permissions()
94         print "  /dev/raw1394 permissions.. " + str(devnode_permissions)
95     else:
96         devnode_permissions = None
97
98     # check libraries
99     print " Prerequisites (dynamic at run-time)..."
100     print "   gcc................ %s" % get_version_first_line('gcc --version')
101     print "   g++................ %s" % get_version_first_line('g++ --version')
102     print "   PyQt............... %s" % get_version_first_line('pyuic -version')
103     print "   jackd.............. %s" % get_version_first_line('jackd --version')
104     print "     path............. %s" % get_command_path('jackd')
105     print "     flags............ %s" % get_package_flags("jack")
106     print "   libraw1394......... %s" % get_package_version("libraw1394")
107     print "     flags............ %s" % get_package_flags("libraw1394")
108     print "   libavc1394......... %s" % get_package_version("libavc1394")
109     print "     flags............ %s" % get_package_flags("libavc1394")
110     print "   libiec61883........ %s" % get_package_version("libiec61883")
111     print "     flags............ %s" % get_package_flags("libiec61883")
112     print "   libxml++-2.6....... %s" % get_package_version("libxml++-2.6")
113     print "     flags............ %s" % get_package_flags("libxml++-2.6")
114     print "   dbus-1............. %s" % get_package_version("dbus-1")
115     print "     flags............ %s" % get_package_flags("dbus-1")
116     print " Prerequisites (static at compile-time)..."
117     f = open( "$PYTHONDIR/static_info.txt", "r" )
118     for line in f:
119         line = line[:-1]
120         if line is not "\n" and line.startswith("  "):
121             print line
122     f.close()
123
124     # libraw
125    
126     print " Hardware..."
127     # check host controller
128     print "   Host controllers:"
129     list_host_controllers()
130     print "   CPU info:"
131     print run_command("cat /proc/cpuinfo")
132
133     print " Configuration..."
134     # check RT settings
135    
136     # check IRQ settings
137     print "  IRQ information"
138     info = IRQInfo()
139
140     info.load()
141     print str(info)
142
143     print ""
144     print "=== REPORT ==="
145    
146     help = HelpStrings()
147    
148     # do the interpretation of the tests
149     print "FireWire kernel drivers:"
150     ## FIXME: what about in-kernel firewire? (i.e. no modules)
151     if not oldstack_present:
152         help.show('MODULES_OLD_STACK_NOT_INSTALLED')
153         sys.exit(-1)
154     else:
155         if newstack_loaded and oldstack_loaded:
156             help.show('MODULES_BOTH_STACKS_LOADED')
157             sys.exit(-1)
158         elif newstack_loaded:
159             help.show('MODULES_NEW_STACK_LOADED')
160             sys.exit(-1)
161         elif not oldstack_loaded:
162             help.show('MODULES_OLD_STACK_NOT_LOADED')
163             sys.exit(-1)
164         else:
165             print "[PASS] Kernel modules present and correctly loaded."
166
167     if not devnode_present:
168         help.show('DEVNODE_OLD_STACK_NOT_PRESENT')
169         sys.exit(-1)
170     else:
171         if not devnode_permissions:
172             help.show('DEVNODE_OLD_STACK_NO_PERMISSION')
173             sys.exit(-1)
174         else:
175             print "[PASS] /dev/raw1394 node present and accessible."
176    
177    
178    
Note: See TracBrowser for help on using the browser.