Index: /trunk/libffado/support/tools/ffado-diag-static
===================================================================
--- /trunk/libffado/support/tools/ffado-diag-static (revision 1663)
+++ /trunk/libffado/support/tools/ffado-diag-static (revision 1663)
@@ -0,0 +1,91 @@
+#!/usr/bin/python
+#
+
+#
+# Copyright (C) 2008 Pieter Palmers
+# 2009 Arnold Krilles
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, version 3 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+
+#
+# Test for common FFADO problems
+#
+
+import sys
+
+# Add the path of the installed dependent files
+import os
+import commands
+import re
+import logging
+
+from ffado_diag_helpers import *
+
+welcome_msg = """
+
+FFADO static diagnostic utility
+============================
+(C) 2008 Pieter Palmers
+(C) 2009 Arnold Krille
+
+"""
+
+help_msg = """
+Usage: ffado-diag [verboselevel]
+
+ verboselevel : verbosity level. (optional)
+
+"""
+
+## logging setup
+logging.basicConfig()
+log = logging.getLogger('staticdiag')
+
+## main program
+if __name__== '__main__':
+
+ print welcome_msg
+
+ num_args = len(sys.argv)
+ if num_args not in [1,2]:
+ print help
+ sys.exit(0)
+
+ if num_args == 2:
+ loglevel = eval(sys.argv[1])
+ if loglevel == 1:
+ logging.getLogger('staticdiag').setLevel(logging.INFO)
+ elif loglevel == 2:
+ logging.getLogger('staticdiag').setLevel(logging.DEBUG)
+
+ print "=== CHECK ==="
+
+ # check libraries
+ print " gcc................ %s" % get_version_first_line('gcc --version')
+ print " g++................ %s" % get_version_first_line('g++ --version')
+ print " PyQt............... %s" % get_version_first_line('pyuic -version')
+ print " jackd.............. %s" % get_version_first_line('jackd --version')
+ print " path............. %s" % get_command_path('jackd')
+ print " flags............ %s" % get_package_flags("jack")
+ print " libraw1394......... %s" % get_package_version("libraw1394")
+ print " flags............ %s" % get_package_flags("libraw1394")
+ print " libavc1394......... %s" % get_package_version("libavc1394")
+ print " flags............ %s" % get_package_flags("libavc1394")
+ print " libiec61883........ %s" % get_package_version("libiec61883")
+ print " flags............ %s" % get_package_flags("libiec61883")
+ print " libxml++-2.6....... %s" % get_package_version("libxml++-2.6")
+ print " flags............ %s" % get_package_flags("libxml++-2.6")
+ print " dbus-1............. %s" % get_package_version("dbus-1")
+ print " flags............ %s" % get_package_flags("dbus-1")
+
Index: /trunk/libffado/support/tools/ffado-diag.in
===================================================================
--- /trunk/libffado/support/tools/ffado-diag.in (revision 1630)
+++ /trunk/libffado/support/tools/ffado-diag.in (revision 1663)
@@ -27,11 +27,7 @@
sys.path.append( "$PYTHONDIR" )
-import os
-import commands
-import re
-import logging
-
from listirqinfo import IRQ,SoftIRQ,IRQInfo
from helpstrings import HelpStrings
+from ffado_diag_helpers import *
## message strings
@@ -52,130 +48,4 @@
"""
-
-## logging setup
-logging.basicConfig()
-log = logging.getLogger('diag')
-
-## helper routines
-
-# kernel
-def get_kernel_version():
- (exitstatus, outtext) = commands.getstatusoutput('uname -r')
- log.debug("uname -r outputs: %s" % outtext)
- return outtext
-
-def get_kernel_rt_patched():
- print "FIXME: implement test for RT kernel"
- return False
-
-# modules
-def check_for_module_loaded(modulename):
- log.info("Checking if module '%s' is loaded... " % modulename)
- f = open('/proc/modules')
- lines = f.readlines()
- f.close()
- for l in lines:
- mod = l.split()[0]
- if mod == modulename or mod == modulename.replace('-', '_'):
- log.info(" found")
- return True
- log.info(" not found")
- return False
-
-def check_for_module_present(modulename):
- log.info("Checking if module '%s' is present... " % modulename)
- kver = get_kernel_version()
- (exitstatus, outtext) = commands.getstatusoutput("find \"/lib/modules/%s/\" -name '%s.ko' | grep '%s'" % \
- (kver, modulename, modulename) )
- log.debug("find outputs: %s" % outtext)
- if outtext == "":
- log.info(" not found")
- return False
- else:
- log.info(" found")
- return True
-
-def check_1394oldstack_loaded():
- retval = True
- if not check_for_module_loaded('ieee1394'):
- retval = False
- if not check_for_module_loaded('ohci1394'):
- retval = False
- if not check_for_module_loaded('raw1394'):
- retval = False
- return retval
-
-def check_1394oldstack_present():
- retval = True
- if not check_for_module_present('ieee1394'):
- retval = False
- if not check_for_module_present('ohci1394'):
- retval = False
- if not check_for_module_present('raw1394'):
- retval = False
- return retval
-
-def check_1394newstack_loaded():
- retval = True
- if not check_for_module_loaded('firewire-core'):
- retval = False
- if not check_for_module_loaded('firewire-ohci'):
- retval = False
- return retval
-
-def check_1394newstack_present():
- retval = True
- if not check_for_module_present('firewire-core'):
- retval = False
- if not check_for_module_present('firewire-ohci'):
- retval = False
- return retval
-
-def check_1394oldstack_devnode_present():
- return os.path.exists('/dev/raw1394')
-
-def check_1394oldstack_devnode_permissions():
- f = open('/dev/raw1394','w')
- if f:
- f.close()
- return True
- else:
- return False
-
-def run_command(cmd):
- (exitstatus, outtext) = commands.getstatusoutput(cmd)
- log.debug("%s outputs: %s" % (cmd, outtext))
- return outtext
-
-# package versions
-def get_package_version(name):
- cmd = "pkg-config --modversion %s" % name
- return run_command(cmd)
-
-def get_package_flags(name):
- cmd = "pkg-config --cflags --libs %s" % name
- return run_command(cmd)
-
-def get_command_path(name):
- cmd = "which %s" % name
- return run_command(cmd)
-
-def get_version_first_line(cmd):
- ver = run_command(cmd).split("\n")
- if len(ver) == 0:
- ver = ["None"]
- return ver[0]
-
-
-def list_host_controllers():
- cmd = "lspci | grep 1394"
- controllers = run_command(cmd).split("\n")
- log.debug("lspci | grep 1394: %s" % controllers)
- for c in controllers:
- tmp = c.split()
- if len(tmp) > 0:
- tmp
- cmd = "lspci -vv -nn -s %s" % tmp[0]
- print run_command(cmd)
## main program
@@ -227,5 +97,5 @@
# check libraries
- print " Prerequisites..."
+ print " Prerequisites (dynamic at run-time)..."
print " gcc................ %s" % get_version_first_line('gcc --version')
print " g++................ %s" % get_version_first_line('g++ --version')
@@ -244,4 +114,11 @@
print " dbus-1............. %s" % get_package_version("dbus-1")
print " flags............ %s" % get_package_flags("dbus-1")
+ print " Prerequisites (static at compile-time)..."
+ f = open( "$PYTHONDIR/static_info.txt", "r" )
+ for line in f:
+ line = line[:-1]
+ if line is not "\n" and line.startswith(" "):
+ print line
+ f.close()
# libraw
Index: /trunk/libffado/support/tools/SConscript
===================================================================
--- /trunk/libffado/support/tools/SConscript (revision 1501)
+++ /trunk/libffado/support/tools/SConscript (revision 1663)
@@ -35,4 +35,6 @@
e['pythondir'] = Template( os.path.join( e['sharedir'], 'python' ) ).safe_substitute( e )
+e.Command( "static_info.txt", "#/SConstruct", "python support/tools/ffado-diag-static > $TARGET" )
+
e.ScanReplace( "ffado-diag.in" )
@@ -40,2 +42,4 @@
e.Install( "$pythondir", "helpstrings.py" )
e.Install( "$pythondir", "listirqinfo.py" )
+e.Install( "$pythondir", "static_info.txt" )
+e.Install( "$pythondir", "ffado_diag_helpers.py" )
Index: /trunk/libffado/support/tools/ffado_diag_helpers.py
===================================================================
--- /trunk/libffado/support/tools/ffado_diag_helpers.py (revision 1663)
+++ /trunk/libffado/support/tools/ffado_diag_helpers.py (revision 1663)
@@ -0,0 +1,156 @@
+#!/usr/bin/python
+#
+
+#
+# Copyright (C) 2008 Pieter Palmers
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, version 3 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+
+#
+# Test for common FFADO problems
+#
+
+import sys
+
+import os
+import commands
+import re
+import logging
+
+## logging setup
+logging.basicConfig()
+log = logging.getLogger('diag')
+
+## helper routines
+
+# kernel
+def get_kernel_version():
+ (exitstatus, outtext) = commands.getstatusoutput('uname -r')
+ log.debug("uname -r outputs: %s" % outtext)
+ return outtext
+
+def get_kernel_rt_patched():
+ print "FIXME: implement test for RT kernel"
+ return False
+
+# modules
+def check_for_module_loaded(modulename):
+ log.info("Checking if module '%s' is loaded... " % modulename)
+ f = open('/proc/modules')
+ lines = f.readlines()
+ f.close()
+ for l in lines:
+ mod = l.split()[0]
+ if mod == modulename or mod == modulename.replace('-', '_'):
+ log.info(" found")
+ return True
+ log.info(" not found")
+ return False
+
+def check_for_module_present(modulename):
+ log.info("Checking if module '%s' is present... " % modulename)
+ kver = get_kernel_version()
+ (exitstatus, outtext) = commands.getstatusoutput("find \"/lib/modules/%s/\" -name '%s.ko' | grep '%s'" % \
+ (kver, modulename, modulename) )
+ log.debug("find outputs: %s" % outtext)
+ if outtext == "":
+ log.info(" not found")
+ return False
+ else:
+ log.info(" found")
+ return True
+
+def check_1394oldstack_loaded():
+ retval = True
+ if not check_for_module_loaded('ieee1394'):
+ retval = False
+ if not check_for_module_loaded('ohci1394'):
+ retval = False
+ if not check_for_module_loaded('raw1394'):
+ retval = False
+ return retval
+
+def check_1394oldstack_present():
+ retval = True
+ if not check_for_module_present('ieee1394'):
+ retval = False
+ if not check_for_module_present('ohci1394'):
+ retval = False
+ if not check_for_module_present('raw1394'):
+ retval = False
+ return retval
+
+def check_1394newstack_loaded():
+ retval = True
+ if not check_for_module_loaded('firewire-core'):
+ retval = False
+ if not check_for_module_loaded('firewire-ohci'):
+ retval = False
+ return retval
+
+def check_1394newstack_present():
+ retval = True
+ if not check_for_module_present('firewire-core'):
+ retval = False
+ if not check_for_module_present('firewire-ohci'):
+ retval = False
+ return retval
+
+def check_1394oldstack_devnode_present():
+ return os.path.exists('/dev/raw1394')
+
+def check_1394oldstack_devnode_permissions():
+ f = open('/dev/raw1394','w')
+ if f:
+ f.close()
+ return True
+ else:
+ return False
+
+def run_command(cmd):
+ (exitstatus, outtext) = commands.getstatusoutput(cmd)
+ log.debug("%s outputs: %s" % (cmd, outtext))
+ return outtext
+
+# package versions
+def get_package_version(name):
+ cmd = "pkg-config --modversion %s" % name
+ return run_command(cmd)
+
+def get_package_flags(name):
+ cmd = "pkg-config --cflags --libs %s" % name
+ return run_command(cmd)
+
+def get_command_path(name):
+ cmd = "which %s" % name
+ return run_command(cmd)
+
+def get_version_first_line(cmd):
+ ver = run_command(cmd).split("\n")
+ if len(ver) == 0:
+ ver = ["None"]
+ return ver[0]
+
+
+def list_host_controllers():
+ cmd = "lspci | grep 1394"
+ controllers = run_command(cmd).split("\n")
+ log.debug("lspci | grep 1394: %s" % controllers)
+ for c in controllers:
+ tmp = c.split()
+ if len(tmp) > 0:
+ tmp
+ cmd = "lspci -vv -nn -s %s" % tmp[0]
+ print run_command(cmd)
+