Changeset 574
- Timestamp:
- 08/27/07 08:41:50 (16 years ago)
- Files:
-
- trunk/libffado/external/dbus/SConscript (modified) (4 diffs)
- trunk/libffado/SConstruct (modified) (4 diffs)
- trunk/libffado/src/libcontrol (added)
- trunk/libffado/support/mixer/SConscript (modified) (1 diff)
- trunk/libffado/tests/controlclient.cpp (added)
- trunk/libffado/tests/controlclient.h (added)
- trunk/libffado/tests/controlserver.cpp (added)
- trunk/libffado/tests/controlserver.h (added)
- trunk/libffado/tests/SConscript (modified) (2 diffs)
- trunk/libffado/tests/test-dbus-server.cpp (added)
- trunk/libffado/tests/test-dbus.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/external/dbus/SConscript
r570 r574 21 21 dbus_env = Environment( ENV = buildenv ) 22 22 23 CacheDir( 'cache/objects' )23 #CacheDir( 'cache/objects' ) 24 24 25 dbus_env.MergeFlags( env['DBUS1_FLAGS'] ) 25 if env.has_key('DBUS1_FLAGS'): 26 dbus_env.MergeFlags( env['DBUS1_FLAGS'] ) 26 27 27 28 # add the local version of libdbus++ … … 30 31 dbus_env.AppendUnique( LIBS=["dbus-c++"] ) 31 32 dbus_env.AppendUnique( CCFLAGS=["-DDBUS_API_SUBJECT_TO_CHANGE"] ) 33 34 # this is required to indicate that the DBUS version we use has support 35 # for platform dependent threading init functions 36 # this is true for DBUS >= 0.96 or so. Since we require >= 1.0 it is 37 # always true 38 dbus_env.AppendUnique( CCFLAGS=["-DDBUS_HAS_THREADS_INIT_DEFAULT"] ) 32 39 33 40 sources = [ … … 47 54 ] 48 55 49 if env ['DEBUG']:56 if env.has_key('DEBUG') and env['DEBUG']: 50 57 dbus_env.AppendUnique( CCFLAGS=["-DDEBUG","-g"] ) 51 58 … … 80 87 81 88 def dbusxx_xml2cpp_emitter(target, source, env): 82 83 89 dbus_env.Depends(target, dbusxx_xml2cpp) 90 return (target, source) 84 91 85 dbusxx_xml2cpp_ builder = Builder(action = dbusxx_xml2cpp[0].abspath + ' $SOURCE --adaptor=$TARGET',86 87 92 dbusxx_xml2cpp_adaptor_builder = Builder(action = dbusxx_xml2cpp[0].abspath + ' $SOURCE --adaptor=$TARGET', 93 emitter = dbusxx_xml2cpp_emitter, 94 suffix = '.h', src_suffix = '.xml') 88 95 89 Export('dbusxx_xml2cpp_builder') 96 dbusxx_xml2cpp_proxy_builder = Builder(action = dbusxx_xml2cpp[0].abspath + ' $SOURCE --proxy=$TARGET', 97 emitter = dbusxx_xml2cpp_emitter, 98 suffix = '.h', src_suffix = '.xml') 99 100 Export('dbusxx_xml2cpp_adaptor_builder') 101 Export('dbusxx_xml2cpp_proxy_builder') trunk/libffado/SConstruct
r573 r574 139 139 env.AppendUnique( CCFLAGS=["-O2"] ) 140 140 141 # this is required to indicate that the DBUS version we use has support 142 # for platform dependent threading init functions 143 # this is true for DBUS >= 0.96 or so. Since we require >= 1.0 it is 144 # always true 145 env.AppendUnique( CCFLAGS=["-DDBUS_HAS_THREADS_INIT_DEFAULT"] ) 146 141 147 if env['ENABLE_ALL']: 142 148 env['ENABLE_BEBOB'] = True … … 170 176 # The relevant MergeFlags-calls should be moved to the SConscript-files where 171 177 # its needed... 172 env.MergeFlags( env['LIBRAW1394_FLAGS'] ) 173 env.MergeFlags( env['LIBAVC1394_FLAGS'] ) 174 env.MergeFlags( env['LIBIEC61883_FLAGS'] ) 175 env.MergeFlags( env['ALSA_FLAGS'] ) 176 env.MergeFlags( env['LIBXML26_FLAGS'] ) 177 env.MergeFlags( env['LIBLO_FLAGS'] ) 178 if env.has_key('LIBRAW1394_FLAGS'): 179 env.MergeFlags( env['LIBRAW1394_FLAGS'] ) 180 if env.has_key('LIBAVC1394_FLAGS'): 181 env.MergeFlags( env['LIBAVC1394_FLAGS'] ) 182 if env.has_key('LIBIEC61883_FLAGS'): 183 env.MergeFlags( env['LIBIEC61883_FLAGS'] ) 184 if env.has_key('ALSA_FLAGS'): 185 env.MergeFlags( env['ALSA_FLAGS'] ) 186 if env.has_key('LIBXML26_FLAGS'): 187 env.MergeFlags( env['LIBXML26_FLAGS'] ) 188 if env.has_key('LIBLO_FLAGS'): 189 env.MergeFlags( env['LIBLO_FLAGS'] ) 178 190 179 191 # … … 204 216 env.Alias( "install", env.Install( env['libdir'] + '/pkgconfig', pkgconfig ) ) 205 217 206 207 subdirs=[' src','libffado','tests','support','external']218 # build helper tools first 219 subdirs=['external'] 208 220 if build_base: 209 221 env['build_base']="#/"+build_base … … 214 226 env.SConscript( dirs=subdirs, exports="env" ) 215 227 228 if not env.GetOption('clean'): 229 Default( 'external' ) 230 231 Import( 'dbusxx_xml2cpp_adaptor_builder' ) 232 env.Append(BUILDERS = {'XML2CPP_ADAPTOR' : dbusxx_xml2cpp_adaptor_builder}) 233 234 Import( 'dbusxx_xml2cpp_proxy_builder' ) 235 env.Append(BUILDERS = {'XML2CPP_PROXY' : dbusxx_xml2cpp_proxy_builder}) 236 237 # now build our own stuff, which can use the tools defined above 238 subdirs=['src','libffado','tests','support'] 239 if build_base: 240 env['build_base']="#/"+build_base 241 for subdir in subdirs: 242 env.SConscript( dirs=subdir, exports="env", build_dir=build_base+subdir ) 243 else: 244 env['build_base']="#/" 245 env.SConscript( dirs=subdirs, exports="env" ) 246 216 247 217 248 # By default only src is built but all is cleaned 218 249 if not env.GetOption('clean'): 219 Default( 'external' ) 220 Default( 'src' ) 221 if env['BUILD_TESTS']: 222 Default( 'tests' ) 223 #env.Alias( "install", env["cachedir"], os.makedirs( env["cachedir"] ) ) 224 env.Alias( "install", env.Install( env["cachedir"], "" ) ) #os.makedirs( env["cachedir"] ) ) 250 Default( 'src' ) 251 if env['BUILD_TESTS']: 252 Default( 'tests' ) 253 #env.Alias( "install", env["cachedir"], os.makedirs( env["cachedir"] ) ) 254 env.Alias( "install", env.Install( env["cachedir"], "" ) ) #os.makedirs( env["cachedir"] ) ) trunk/libffado/support/mixer/SConscript
r571 r574 3 3 Import( 'env' ) 4 4 5 if env ['HAVE_PYUIC']:5 if env.has_key('HAVE_PYUIC') and env['HAVE_PYUIC']: 6 6 7 7 env = env.Copy() trunk/libffado/tests/SConscript
r567 r574 5 5 env = env.Copy() 6 6 7 env.PrependUnique( CPPPATH=["#/src"] ) 8 env.PrependUnique( LIBPATH=[env['build_base']+"src"] ) 9 env.PrependUnique( LIBS=["ffado"] ) 7 env.PrependUnique( CPPPATH=["#/src", "#/external/dbus/include"] ) 8 env.PrependUnique( LIBPATH=[env['build_base']+"src", env['build_base']+"external/dbus"] ) 9 env.PrependUnique( LIBS=["ffado", "dbus-c++"] ) 10 11 env.MergeFlags( ["!pkg-config --cflags --libs dbus-1"] ) 10 12 11 13 # … … 13 15 # 14 16 #for app in ["test-ffado", "test-extplugcmd", "test-fw410", "test-volume", "test-mixer", "test-cycletimer", "test-timestampedbuffer", "test-ieee1394service", "test-streamdump"]: 15 for app in ["test-ffado", "test-fw410", "test-cycletimer", "test-timestampedbuffer", "test-ieee1394service", "test-streamdump" , "test-dbus"]:16 17 for app in ["test-ffado", "test-fw410", "test-cycletimer", "test-timestampedbuffer", "test-ieee1394service", "test-streamdump"]: 18 env.Program( target=app, source = app+".cpp" ) 17 19 18 20 env.Program( target="test-sytmonitor", source = env.Split( "test-sytmonitor.cpp SytMonitor.cpp" ) ) 19 21 22 env.XML2CPP_PROXY('controlclient-glue.h', 'controlstuff.xml') 23 env.Program( target="test-dbus", source = env.Split( "test-dbus.cpp controlclient.cpp" ) ) 24 25 env.XML2CPP_ADAPTOR('controlserver-glue.h', 'controlstuff.xml') 26 env.Program( target="test-dbus-server", source = env.Split( "test-dbus-server.cpp controlserver.cpp" ) ) 27 20 28 env.SConscript( dirs="streaming", exports="env" ) 21 29 trunk/libffado/tests/test-dbus.cpp
r565 r574 1 1 /* 2 2 * Copyright (C) 2007 by Pieter Palmers 3 * Copyright (C) 2005-2007 by Daniel Wagner4 3 * 5 4 * This file is part of FFADO … … 24 23 */ 25 24 26 #include <libraw1394/raw1394.h>27 #include <libiec61883/iec61883.h>28 #include <libavc1394/avc1394.h>29 30 25 #include <argp.h> 31 26 #include <stdlib.h> 32 27 #include <iostream> 28 #include <signal.h> 29 30 #include "controlclient.h" 31 #include <dbus-c++/dbus.h> 33 32 34 33 using namespace std; 34 35 DECLARE_GLOBAL_DEBUG_MODULE; 35 36 36 37 //////////////////////////////////////////////// 37 38 // arg parsing 38 39 //////////////////////////////////////////////// 39 const char *argp_program_version = "test- echo0.1";40 const char *argp_program_version = "test-dbus 0.1"; 40 41 const char *argp_program_bug_address = "<ffado-devel@lists.sf.net>"; 41 static char doc[] = "test- echo -- test program for the ECHO AUDIOFIRE devices";42 static char args_doc[] = " NODE_ID";42 static char doc[] = "test-dbus -- test client for the DBUS interface"; 43 static char args_doc[] = ""; 43 44 static struct argp_option options[] = { 44 45 {"verbose", 'v', 0, 0, "Produce verbose output" }, 45 {"port", 'p', "PORT", 0, "Set port" },46 46 { 0 } 47 47 }; … … 51 51 arguments() 52 52 : verbose( false ) 53 , test( false )54 , port( 0 )55 53 { 56 54 args[0] = 0; 57 55 } 58 56 59 char* args[ 1];57 char* args[50]; 60 58 bool verbose; 61 bool test;62 int port;63 59 } arguments; 64 60 … … 71 67 struct arguments* arguments = ( struct arguments* ) state->input; 72 68 73 char* tail;69 // char* tail; 74 70 switch (key) { 75 71 case 'v': 76 72 arguments->verbose = true; 77 73 break; 78 case 't':79 arguments->test = true;80 break;81 case 'p':82 errno = 0;83 arguments->port = strtol(arg, &tail, 0);84 if (errno) {85 perror("argument parsing failed:");86 return errno;87 }88 break;89 74 case ARGP_KEY_ARG: 90 if (state->arg_num >= 1) {75 if (state->arg_num >= 50) { 91 76 // Too many arguments. 92 77 argp_usage (state); … … 95 80 break; 96 81 case ARGP_KEY_END: 97 if (state->arg_num < 1) {98 // Not enough arguments.99 argp_usage (state);100 }101 82 break; 102 83 default: … … 111 92 // main 112 93 ////////////////////////// 94 95 DBus::BusDispatcher dispatcher; 96 static const int THREADS = 1; 97 static bool spin = true; 98 99 void leave( int sig ) 100 { 101 spin = false; 102 dispatcher.leave(); 103 } 104 105 void* worker_thread( void* ) 106 { 107 DBus::Connection conn = DBus::Connection::SessionBus(); 108 109 Control::ControlClient client(conn, SERVER_PATH, SERVER_NAME); 110 111 int i=0; 112 while(spin) 113 { 114 try { 115 client.Echo(i++); 116 } catch(...) { 117 cout << "error on Echo()\n"; 118 }; 119 // try { 120 // std::map< DBus::String, DBus::String > info = client.Info(); 121 // cout << info["testset1"] << " - " << info["testset2"] << std::endl; 122 // } catch(...) { 123 // cout << "error on Info()\n"; 124 // }; 125 126 cout << "* " << i << "*\n"; 127 sleep(1); 128 } 129 130 return NULL; 131 } 132 133 void run_client_tests() { 134 DBus::default_dispatcher = &dispatcher; 135 136 pthread_t thread; 137 138 pthread_create(&thread, NULL, worker_thread, NULL); 139 140 dispatcher.enter(); 141 142 pthread_join(thread, NULL); 143 } 144 113 145 int 114 146 main(int argc, char **argv) 115 147 { 148 signal(SIGTERM, leave); 149 signal(SIGINT, leave); 150 151 setDebugLevel(DEBUG_LEVEL_VERBOSE); 152 116 153 // arg parsing 117 154 argp_parse (&argp, argc, argv, 0, 0, &arguments); 118 155 119 156 errno = 0; 120 char* tail;121 int iNodeId = strtol(arguments.args[0], &tail, 0);157 // char* tail; 158 122 159 if (errno) { 123 perror("argument parsing failed:");124 return -1;160 perror("argument parsing failed:"); 161 return -1; 125 162 } 126 163 127 raw1394handle_t pHandle = raw1394_new_handle_on_port( arguments.port ); 128 if ( !pHandle ) { 129 if ( !errno ) { 130 cerr << "libraw1394 not compatible" << endl; 131 } else { 132 perror( "Could not get 1394 handle" ); 133 cerr << "Is ieee1394 and raw1394 driver loaded?" << endl; 134 } 135 return -1; 136 } 137 quadlet_t cmd[6]; 138 unsigned int response_len; 164 debugOutput(DEBUG_LEVEL_NORMAL, "DBUS test application\n"); 165 166 DBus::_init_threading(); 167 168 run_client_tests(); 169 170 debugOutput(DEBUG_LEVEL_NORMAL, "bye...\n"); 139 171 140 // cerr << "Opening descriptor" << endl;141 // 0h 05m 21.760442s - GetDescriptorOpen: cmd[0]= < 0x00 0x60 0x08 0x80 0x01 0xFF>142 // 0h 05m 21.760687s - GetDescriptorOpen: resp[0]= < 0x09 0x60 0x08 0x80 0x01 0xFF > ACCEPTED143 144 145 // cmd[0] = 0x00600880;146 // cmd[1] = 0x01FF0000;147 // avc1394_transaction_block2(pHandle, 0xffc0 | iNodeId, cmd, 2, &response_len, 10);148 // usleep(100000);149 //150 // cerr << "Reading descriptor" << endl;151 // // 0h 05m 21.760700s - GetDescriptorRead: cmd[0]= < 0x00 0x60 0x09 0x80 0xFF 0xFF 0x00 0x00 0x00 0x00>152 // // 0h 05m 21.761123s - GetDescriptorRead: resp[0]= < 0x09 0x60 0x09 0x80 0x11 0xFF 0x01 0xF6 0x00 0x00 0x03 0x9E153 // cmd[0] = 0x00600980;154 // cmd[1] = 0xFFFF0000;155 // cmd[2] = 0x00000000;156 // cmd[2] = 0x00000000;157 //158 // avc1394_transaction_block2(pHandle, 0xffc0 | iNodeId, cmd, 3, &response_len, 10);159 // usleep(100000);160 //161 // cerr << "Closing descriptor" << endl;162 // cmd[0] = 0x00600880;163 // cmd[1] = 0x00FF0000;164 // avc1394_transaction_block2(pHandle, 0xffc0 | iNodeId, cmd, 2, &response_len, 10);165 // usleep(100000);166 167 cerr << "getting signal source" << endl;168 // 0h 05m 21.762917s - at line 2283, fMaxAudioOutputChannels=2, fMaxAudioInputChannels=0169 // 0h 05m 21.762919s - GetSignalSource: cmd[0]= < 0x01 0xFF 0x1A 0xFF 0xFF 0xFE 0xFF 0x00>170 // 0h 05m 21.763149s - GetSignalSource: resp[0]= < 0x0c 0xFF 0x1A 0x60 0x60 0x00 0xFF 0x00 > IMPLEMENTED171 // 0h 05m 21.763167s - Isoch out 0 gets its signal from sub/unit 0x60 Source Plug 0172 // 0h 05m 21.763170s - GetSignalSource: cmd[0]= < 0x01 0xFF 0x1A 0xFF 0xFF 0xFE 0xFF 0x80>173 // 0h 05m 21.763376s - GetSignalSource: resp[0]= < 0x0c 0xFF 0x1A 0x00 0x60 0x01 0xFF 0x80 > IMPLEMENTED174 // 0h 05m 21.763394s - Isoch out 128 gets its signal from sub/unit 0x60 Source Plug 1175 // 0h 05m 21.763397s - GetSignalSource: cmd[0]= < 0x01 0xFF 0x1A 0xFF 0xFF 0xFE 0xFF 0x81>176 // 0h 05m 21.763637s - GetSignalSource: resp[0]= < 0x0c 0xFF 0x1A 0x00 0x60 0x02 0xFF 0x81 > IMPLEMENTED177 // 0h 05m 21.763654s - Isoch out 129 gets its signal from sub/unit 0x60 Source Plug 2178 179 // 0h 05m 21.764895s - Starting to look at subunit 1. fNumberOfSubUnits = 2180 // 0h 05m 21.764897s - Subunit 1 GetSignalSource: cmd[0]= < 0x01 0xFF 0x1A 0xFF 0xFF 0xFE 0x60 0x00>181 // 0h 05m 21.765129s - GetSignalSource: resp[0]= < 0x0c 0xFF 0x1A 0x20 0xFF 0x00 0x60 0x00 > IMPLEMENTED182 // 0h 05m 21.765140s - Subunit type12, addr:0x60 dest 0 gets its signal from sub/unit 0xff Source Plug 0183 // 0h 05m 21.765142s - subunit 96 dest plug 0 is routed184 // 0h 05m 21.765143s - Subunit 1 GetSignalSource: cmd[0]= < 0x01 0xFF 0x1A 0xFF 0xFF 0xFE 0x60 0x01>185 // 0h 05m 21.765364s - GetSignalSource: resp[0]= < 0x0c 0xFF 0x1A 0x00 0xFF 0x80 0x60 0x01 > IMPLEMENTED186 // 0h 05m 21.765382s - Subunit type12, addr:0x60 dest 1 gets its signal from sub/unit 0xff Source Plug 128187 // 0h 05m 21.765385s - Plug being changed from 0x80 to 1 for internal bookeeping.188 // 0h 05m 21.765389s - Subunit 1 GetSignalSource: cmd[0]= < 0x01 0xFF 0x1A 0xFF 0xFF 0xFE 0x60 0x02>189 // 0h 05m 21.765632s - GetSignalSource: resp[0]= < 0x0c 0xFF 0x1A 0x00 0xFF 0x81 0x60 0x02 > IMPLEMENTED190 // 0h 05m 21.765651s - Subunit type12, addr:0x60 dest 2 gets its signal from sub/unit 0xff Source Plug 129191 // 0h 05m 21.765653s - Plug being changed from 0x81 to 2 for internal bookeeping.192 // 0h 05m 21.765657s - Subunit 1 GetSignalSource: cmd[0]= < 0x01 0xFF 0x1A 0xFF 0xFF 0xFE 0x60 0x03>193 // 0h 05m 21.765874s - GetSignalSource: resp[0]= < 0x0c 0xFF 0x1A 0x00 0x60 0x03 0x60 0x03 > IMPLEMENTED194 // 0h 05m 21.765892s - Subunit type12, addr:0x60 dest 3 gets its signal from sub/unit 0x60 Source Plug 3195 196 cmd[0] = 0x01FF1AFF;197 cmd[1] = 0xFFFE6000;198 avc1394_transaction_block2(pHandle, 0xffc0 | iNodeId, cmd, 2, &response_len, 10);199 // usleep(100000);200 201 cmd[0] = 0x01FF1AFF;202 cmd[1] = 0xFFFEFF00;203 avc1394_transaction_block2(pHandle, 0xffc0 | iNodeId, cmd, 2, &response_len, 10);204 usleep(100000);205 206 207 208 raw1394_destroy_handle( pHandle );209 172 return 0; 210 173 }