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

Revision 2741, 5.3 kB (checked in by jwoithe, 1 year ago)

[PATCH 05/13] tools: make helpers from shared parts of ffado-diag.in and -static.py.

From Nicolas Boulenguez.

  • 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 import listirqinfo
31 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 ## main program
47 if __name__== '__main__':
48
49     print welcome_msg
50
51     parse_command_line ()
52
53     print "=== CHECK ==="
54     print " Base system..."
55
56     # check kernel
57     kernel_version = get_kernel_version()
58     print "  kernel version............ " + str(kernel_version)
59     kernel_is_preempt = get_kernel_preempt()
60     print "    Preempt (low latency)... " + str(kernel_is_preempt)
61     # Hint: The main parts of the rt patches are in mainline-kernels nowadays. Performance with stock kernels is sufficient...
62     kernel_is_rt_patched = get_kernel_rt_patched()
63     print "    RT patched.............. " + str(kernel_is_rt_patched)
64
65     # check modules
66     oldstack_present = check_1394oldstack_present()
67     oldstack_loaded = check_1394oldstack_loaded()
68     oldstack_active = check_1394oldstack_active()
69     oldstack_statically_linked = not check_1394oldstack_loaded() and check_1394oldstack_linked()
70     newstack_present = check_1394newstack_present()
71     newstack_loaded = check_1394newstack_loaded()
72     newstack_active = check_1394newstack_active()
73     newstack_statically_linked = not check_1394newstack_loaded() and check_1394newstack_linked()
74
75     print "  old 1394 stack present.... " + str(oldstack_present)
76     print "  old 1394 stack loaded..... " + str(oldstack_loaded)
77     print "  old 1394 stack active..... " + str(oldstack_active)
78     print "  new 1394 stack present.... " + str(newstack_present)
79     print "  new 1394 stack loaded..... " + str(newstack_loaded)
80     print "  new 1394 stack active..... " + str(newstack_active)
81
82     # check /dev/raw1394 node presence
83     devnode_present = check_1394oldstack_devnode_present()
84     print "  /dev/raw1394 node present. " + str(devnode_present)
85     if devnode_present:
86         # check /dev/raw1394 access permissions
87         devnode_permissions = check_1394oldstack_devnode_permissions()
88         print "  /dev/raw1394 permissions.. " + str(devnode_permissions)
89     else:
90         devnode_permissions = None
91
92     if newstack_active:
93         # check permissions
94         newstack_permissions = get_juju_permissions()
95         print "  /dev/fw* permissions:"
96         print newstack_permissions
97
98     print "  User IDs:"
99     print get_user_ids()
100
101
102     # check libraries
103     print(" Prerequisites (dynamic at run-time)...")
104     check_libraries ()
105
106     print " Prerequisites (static at compile-time)..."
107     f = open( "$PYTHONDIR/static_info.txt", "r" )
108     for line in f:
109         line = line[:-1]
110         if line is not "\n" and line.startswith("  "):
111             print line
112     f.close()
113
114     # libraw
115
116     print " uname -a..."
117     print "   " + run_command("uname -a")
118
119     print " Hardware..."
120     # check host controller
121     print "   Host controllers:"
122     list_host_controllers()
123     print "   CPU info:"
124     if len(run_command("which lscpu")) > 0:
125         print run_command("lscpu")
126     else:
127         print run_command("cat /proc/cpuinfo")
128
129     print " Configuration..."
130     # check RT settings
131
132     # check IRQ settings
133     print "  IRQ information"
134     info = listirqinfo.IRQInfo()
135     info.load()
136     info.display()
137
138     print ""
139     print "=== REPORT ==="
140
141     # do the interpretation of the tests
142     print "FireWire kernel drivers:"
143     if (oldstack_loaded or oldstack_statically_linked) and \
144        (newstack_loaded or newstack_statically_linked):
145         print (helpstrings.MODULES_BOTH_STACKS_LOADED)
146         sys.exit(-1)
147     elif newstack_loaded or newstack_statically_linked:
148         print (helpstrings.MODULES_NEW_STACK_LOADED)
149         sys.exit(-1)
150     elif oldstack_statically_linked:
151         print "[PASS] Kernel drivers statically linked into the kernel."
152     elif not oldstack_present:
153         print (helpstrings.MODULES_OLD_STACK_NOT_INSTALLED)
154         sys.exit(-1)
155     elif not oldstack_loaded:
156         print (helpstrings.MODULES_OLD_STACK_NOT_LOADED)
157         sys.exit(-1)
158     else:
159         print "[PASS] Kernel modules present and correctly loaded."
160
161     if not devnode_present:
162         print (helpstrings.DEVNODE_OLD_STACK_NOT_PRESENT)
163         sys.exit(-1)
164     else:
165         if not devnode_permissions:
166             print (helpstrings.DEVNODE_OLD_STACK_NO_PERMISSION)
167             sys.exit(-1)
168         else:
169             print "[PASS] /dev/raw1394 node present and accessible."
Note: See TracBrowser for help on using the browser.