Changeset 560 for trunk/libffado/src
- Timestamp:
- 08/24/07 08:09:49 (17 years ago)
- Files:
-
- trunk/libffado/src/bebob/bebob_avdevice.cpp (modified) (1 diff)
- trunk/libffado/src/bebob/bebob_avdevice.h (modified) (1 diff)
- trunk/libffado/src/devicemanager.cpp (modified) (7 diffs)
- trunk/libffado/src/devicemanager.h (modified) (1 diff)
- trunk/libffado/src/ffadodevice.cpp (modified) (5 diffs)
- trunk/libffado/src/ffadodevice.h (modified) (3 diffs)
- trunk/libffado/src/genericavc/avc_avdevice.cpp (modified) (3 diffs)
- trunk/libffado/src/libavc/general/avc_plug.cpp (modified) (3 diffs)
- trunk/libffado/src/libavc/general/avc_plug.h (modified) (1 diff)
- trunk/libffado/src/libavc/general/avc_subunit.cpp (modified) (7 diffs)
- trunk/libffado/src/libavc/general/avc_subunit.h (modified) (1 diff)
- trunk/libffado/src/libavc/general/avc_unit.cpp (modified) (7 diffs)
- trunk/libffado/src/libavc/general/avc_unit.h (modified) (1 diff)
- trunk/libffado/src/libieee1394/configrom.cpp (modified) (1 diff)
- trunk/libffado/src/libieee1394/configrom.h (modified) (1 diff)
- trunk/libffado/src/libieee1394/ieee1394service.cpp (modified) (2 diffs)
- trunk/libffado/src/libosc/OscNode.cpp (modified) (2 diffs)
- trunk/libffado/src/libosc/OscServer.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/bebob/bebob_avdevice.cpp
r557 r560 99 99 } 100 100 101 void 102 AvDevice::showDevice() 103 { 104 debugOutput(DEBUG_LEVEL_NORMAL, "Device is a BeBoB device\n"); 105 GenericAVC::AvDevice::showDevice(); 106 flushDebugOutput(); 107 } 108 101 109 AVC::Subunit* 102 110 AvDevice::createSubunit(AVC::Unit& unit, 103 AVC::ESubunitType type, 104 AVC::subunit_t id ) 105 { 111 AVC::ESubunitType type, 112 AVC::subunit_t id ) 113 { 114 AVC::Subunit* s=NULL; 106 115 switch (type) { 107 case AVC::eST_Audio: 108 return new BeBoB::SubunitAudio(unit, id ); 109 case AVC::eST_Music: 110 return new BeBoB::SubunitMusic(unit, id ); 116 case eST_Audio: 117 s=new BeBoB::SubunitAudio(unit, id ); 118 break; 119 case eST_Music: 120 s=new BeBoB::SubunitMusic(unit, id ); 121 break; 111 122 default: 112 return NULL; 113 } 114 } 123 s=NULL; 124 break; 125 } 126 if(s) s->setVerboseLevel(getDebugLevel()); 127 return s; 128 } 129 115 130 116 131 AVC::Plug * 117 132 AvDevice::createPlug( AVC::Unit* unit, 118 AVC::Subunit* subunit, 119 AVC::function_block_type_t functionBlockType, 120 AVC::function_block_type_t functionBlockId, 121 AVC::Plug::EPlugAddressType plugAddressType, 122 AVC::Plug::EPlugDirection plugDirection, 123 AVC::plug_id_t plugId ) 124 { 125 126 return new BeBoB::Plug( unit, 127 subunit, 128 functionBlockType, 129 functionBlockId, 130 plugAddressType, 131 plugDirection, 132 plugId ); 133 AVC::Subunit* subunit, 134 AVC::function_block_type_t functionBlockType, 135 AVC::function_block_type_t functionBlockId, 136 AVC::Plug::EPlugAddressType plugAddressType, 137 AVC::Plug::EPlugDirection plugDirection, 138 AVC::plug_id_t plugId ) 139 { 140 141 Plug *p= new BeBoB::Plug( unit, 142 subunit, 143 functionBlockType, 144 functionBlockId, 145 plugAddressType, 146 plugDirection, 147 plugId ); 148 if (p) p->setVerboseLevel(getDebugLevel()); 149 return p; 133 150 } 134 151 trunk/libffado/src/bebob/bebob_avdevice.h
r556 r560 79 79 AVC::plug_id_t plugId ); 80 80 81 virtual void showDevice(); 81 82 protected: 82 83 virtual bool propagatePlugInfo(); trunk/libffado/src/devicemanager.cpp
r557 r560 68 68 #include <sstream> 69 69 70 #include <algorithm> 71 70 72 using namespace std; 71 73 … … 101 103 DeviceManager::setVerboseLevel(int l) 102 104 { 103 debugOutput( DEBUG_LEVEL_ NORMAL, "Setting verbose level to %d...\n", l );105 debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l ); 104 106 setDebugLevel(l); 105 107 … … 113 115 { 114 116 (*it)->setVerboseLevel(l); 117 } 118 } 119 120 void 121 DeviceManager::show() { 122 debugOutput(DEBUG_LEVEL_NORMAL, "===== Device Manager =====\n"); 123 if (m_1394Service) debugOutput(DEBUG_LEVEL_NORMAL, "1394 port: %d\n", m_1394Service->getPort()); 124 125 int i=0; 126 for ( FFADODeviceVectorIterator it = m_avDevices.begin(); 127 it != m_avDevices.end(); 128 ++it ) 129 { 130 FFADODevice* avDevice = *it; 131 debugOutput(DEBUG_LEVEL_NORMAL, "--- Device %2d ---\n", i++); 132 avDevice->showDevice(); 115 133 } 116 134 } … … 233 251 nodeId ); 234 252 253 avDevice->setVerboseLevel( getDebugLevel() ); 235 254 bool isFromCache = false; 236 255 if ( avDevice->loadFromCache() ) { … … 239 258 } else if ( avDevice->discover() ) { 240 259 debugOutput( DEBUG_LEVEL_VERBOSE, "discovering successful\n" ); 241 avDevice->setVerboseLevel( getDebugLevel() );242 260 } else { 243 261 debugError( "could not discover device\n" ); 244 262 delete avDevice; 245 263 continue; 246 }247 248 if ( !avDevice->setId( m_avDevices.size() ) ) {249 debugError( "setting Id failed\n" );250 264 } 251 265 … … 261 275 } 262 276 263 if ( getDebugLevel() >= DEBUG_LEVEL_VERBOSE ) {264 avDevice->showDevice();265 }266 267 277 if ( !isFromCache && !avDevice->saveCache() ) { 268 278 debugOutput( DEBUG_LEVEL_VERBOSE, "No cached version of AVC model created\n" ); … … 280 290 } 281 291 282 debugOutput( DEBUG_LEVEL_NORMAL, "discovery finished...\n" ); 283 292 debugOutput( DEBUG_LEVEL_NORMAL, "Discovery finished...\n" ); 293 294 // sort the m_avDevices vector on their GUID 295 // then assign reassign the id's to the devices 296 // the side effect of this is that for the same set of attached devices, 297 // a device id always corresponds to the same device 298 sort(m_avDevices.begin(), m_avDevices.end(), FFADODevice::compareGUID); 299 300 int i=0; 301 for ( FFADODeviceVectorIterator it = m_avDevices.begin(); 302 it != m_avDevices.end(); 303 ++it ) 304 { 305 if ( !(*it)->setId( i++ ) ) { 306 debugError( "setting Id failed\n" ); 307 } 308 } 309 310 show(); 284 311 return true; 285 312 trunk/libffado/src/devicemanager.h
r554 r560 71 71 Streaming::StreamProcessor *getSyncSource(); 72 72 73 void show(); 74 73 75 protected: 74 76 FFADODevice* getDriverForDevice( std::auto_ptr<ConfigRom>( configRom ), trunk/libffado/src/ffadodevice.cpp
r554 r560 31 31 #include <sstream> 32 32 33 IMPL_DEBUG_MODULE( FFADODevice, FFADODevice, DEBUG_LEVEL_VERBOSE ); 33 #include <assert.h> 34 35 IMPL_DEBUG_MODULE( FFADODevice, FFADODevice, DEBUG_LEVEL_NORMAL ); 34 36 35 37 FFADODevice::FFADODevice( std::auto_ptr< ConfigRom >( configRom ), … … 39 41 , m_pConfigRom( configRom ) 40 42 , m_p1394Service( &ieee1394service ) 41 , m_verboseLevel( DEBUG_LEVEL_NORMAL )42 43 , m_nodeId ( nodeId ) 43 44 { … … 52 53 } 53 54 55 bool FFADODevice::compareGUID( FFADODevice *a, FFADODevice *b ) { 56 assert(a); 57 assert(b); 58 return ConfigRom::compareGUID(a->getConfigRom(), b->getConfigRom()); 59 } 54 60 55 61 ConfigRom& … … 80 86 debugOutput( DEBUG_LEVEL_VERBOSE, "Set id to %s...\n", idstr.str().c_str()); 81 87 82 83 88 retval=setOption("id",idstr.str()); 84 89 if (retval) { … … 91 96 FFADODevice::setVerboseLevel(int l) 92 97 { 93 m_verboseLevel=l;98 debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l ); 94 99 setDebugLevel(l); 95 // m_pConfigRom->setVerboseLevel(l);96 m_p1394Service->setVerboseLevel(l);97 100 } 101 102 void 103 FFADODevice::showDevice() 104 { 105 debugOutput(DEBUG_LEVEL_NORMAL, "Node...........: %d\n", getNodeId()); 106 debugOutput(DEBUG_LEVEL_NORMAL, "GUID...........: %s\n", getConfigRom().getGuidString().c_str()); 107 108 std::string id=std::string("dev? [none]"); 109 getOption("id", id); 110 111 debugOutput(DEBUG_LEVEL_NORMAL, "Assigned ID....: %s\n", id.c_str()); 112 113 flushDebugOutput(); 114 } 115 98 116 99 117 bool trunk/libffado/src/ffadodevice.h
r554 r560 53 53 54 54 virtual ~FFADODevice() {}; 55 56 57 /** 58 * @brief Compares the GUID of two FFADODevices 59 * 60 * This function compares the GUID of two FFADODevices and returns true 61 * if the GUID of @ref a is larger than the GUID of @ref b . This is intended 62 * to be used with the STL sort() algorithm. 63 * 64 * Note that GUID's are converted to integers for this. 65 * 66 * @param a pointer to first FFADODevice 67 * @param b pointer to second FFADODevice 68 * 69 * @returns true if the GUID of @ref a is larger than the GUID of @ref b . 70 */ 71 static bool compareGUID( FFADODevice *a, FFADODevice *b ); 55 72 56 73 /// Returns the 1394 service of the FFADO device … … 134 151 * device detected, and its configuration. 135 152 */ 136 virtual void showDevice() = 0;153 virtual void showDevice(); 137 154 138 155 /** … … 274 291 std::auto_ptr<ConfigRom>( m_pConfigRom ); 275 292 Ieee1394Service* m_p1394Service; 276 int m_verboseLevel;277 293 int m_nodeId; 278 294 trunk/libffado/src/genericavc/avc_avdevice.cpp
r548 r560 48 48 namespace GenericAVC { 49 49 50 IMPL_DEBUG_MODULE( AvDevice, AvDevice, DEBUG_LEVEL_ VERBOSE);50 IMPL_DEBUG_MODULE( AvDevice, AvDevice, DEBUG_LEVEL_NORMAL ); 51 51 52 52 // to define the supported devices … … 138 138 AvDevice::setVerboseLevel(int l) 139 139 { 140 debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l ); 141 140 142 m_pPlugManager->setVerboseLevel(l); 141 143 … … 251 253 AvDevice::showDevice() 252 254 { 253 debugOutput(DEBUG_LEVEL_VERBOSE, 254 "%s %s at node %d\n", m_model->vendor_name, m_model->model_name, 255 m_nodeId); 256 257 m_pPlugManager->showPlugs(); 255 FFADODevice::showDevice(); 256 257 debugOutput(DEBUG_LEVEL_NORMAL, 258 "%s %s\n", m_model->vendor_name, m_model->model_name); 259 260 AVC::Unit::show(); 258 261 flushDebugOutput(); 259 262 } trunk/libffado/src/libavc/general/avc_plug.cpp
r554 r560 110 110 { 111 111 m_unit->getPlugManager().remPlug( *this ); 112 } 113 114 void 115 Plug::setVerboseLevel(int l) 116 { 117 debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l ); 118 setDebugLevel(l); 112 119 } 113 120 … … 583 590 signalSourceCmd.setCommandType( AVCCommand::eCT_Status ); 584 591 signalSourceCmd.setVerbose( getDebugLevel() ); 585 signalSourceCmd.setVerbose( DEBUG_LEVEL_VERY_VERBOSE );586 592 587 593 if ( !signalSourceCmd.fire() ) { … … 1903 1909 PlugManager::showPlugs() const 1904 1910 { 1911 if(getDebugLevel() < DEBUG_LEVEL_INFO) return; 1912 1905 1913 // \todo The information provided here could be better arranged. For a start it is ok, but 1906 1914 // there is room for improvement. Something for a lazy sunday afternoon (tip: maybe drink some trunk/libffado/src/libavc/general/avc_plug.h
r548 r560 185 185 ClusterInfoVector& getClusterInfos() 186 186 { return m_clusterInfos; } 187 188 virtual void setVerboseLevel( int i ) 189 {setDebugLevel(i);}; 190 187 188 virtual void setVerboseLevel( int i ); 189 191 190 // the discovery interface 192 191 // everything can be overloaded, or trunk/libffado/src/libavc/general/avc_subunit.cpp
r554 r560 38 38 namespace AVC { 39 39 40 IMPL_DEBUG_MODULE( Subunit, Subunit, DEBUG_LEVEL_ VERBOSE);40 IMPL_DEBUG_MODULE( Subunit, Subunit, DEBUG_LEVEL_NORMAL ); 41 41 42 42 //////////////////////////////////////////// … … 65 65 } 66 66 } 67 68 void 69 Subunit::setVerboseLevel(int l) 70 { 71 debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l ); 72 setDebugLevel(l); 73 } 74 67 75 68 76 Plug * … … 92 100 return false; 93 101 } 94 95 102 return true; 96 103 } … … 99 106 Subunit::discoverPlugs() 100 107 { 108 debugOutput(DEBUG_LEVEL_NORMAL, "Discovering plugs...\n"); 109 101 110 PlugInfoCmd plugInfoCmd( getUnit().get1394Service(), 102 111 PlugInfoCmd::eSF_SerialBusIsochronousAndExternalPlug ); … … 112 121 } 113 122 114 debugOutput( DEBUG_LEVEL_ NORMAL, "number of source plugs = %d\n",123 debugOutput( DEBUG_LEVEL_VERBOSE, "number of source plugs = %d\n", 115 124 plugInfoCmd.m_sourcePlugs ); 116 debugOutput( DEBUG_LEVEL_ NORMAL, "number of destination output "125 debugOutput( DEBUG_LEVEL_VERBOSE, "number of destination output " 117 126 "plugs = %d\n", plugInfoCmd.m_destinationPlugs ); 118 127 … … 158 167 plug_id_t plugMaxId ) 159 168 { 160 debugOutput(DEBUG_LEVEL_ NORMAL, "Discovering plugs...\n");169 debugOutput(DEBUG_LEVEL_VERBOSE, "Discovering plugs for direction %d...\n", plugDirection); 161 170 for ( int plugIdx = 0; 162 171 plugIdx < plugMaxId; … … 182 191 } 183 192 184 debugOutput( DEBUG_LEVEL_ NORMAL, "plug '%s' found\n",193 debugOutput( DEBUG_LEVEL_VERBOSE, "plug '%s' found\n", 185 194 plug->getName() ); 186 195 getPlugs().push_back( plug ); trunk/libffado/src/libavc/general/avc_subunit.h
r524 r560 79 79 Plug* getPlug(Plug::EPlugDirection direction, plug_id_t plugId); 80 80 81 virtual void setVerboseLevel(int l) 82 { setDebugLevel(l);}; 81 virtual void setVerboseLevel(int l); 83 82 84 83 bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const; trunk/libffado/src/libavc/general/avc_unit.cpp
r554 r560 44 44 namespace AVC { 45 45 46 IMPL_DEBUG_MODULE( Unit, Unit, DEBUG_LEVEL_ VERBOSE);46 IMPL_DEBUG_MODULE( Unit, Unit, DEBUG_LEVEL_NORMAL ); 47 47 48 48 Unit::Unit( ) … … 84 84 Plug * 85 85 Unit::createPlug( Unit* unit, 86 Subunit* subunit, 87 function_block_type_t functionBlockType, 88 function_block_type_t functionBlockId, 89 Plug::EPlugAddressType plugAddressType, 90 Plug::EPlugDirection plugDirection, 91 plug_id_t plugId ) 92 { 93 94 return new Plug( unit, 95 subunit, 96 functionBlockType, 97 functionBlockId, 98 plugAddressType, 99 plugDirection, 100 plugId ); 86 Subunit* subunit, 87 function_block_type_t functionBlockType, 88 function_block_type_t functionBlockId, 89 Plug::EPlugAddressType plugAddressType, 90 Plug::EPlugDirection plugDirection, 91 plug_id_t plugId ) 92 { 93 94 Plug *p= new Plug( unit, 95 subunit, 96 functionBlockType, 97 functionBlockId, 98 plugAddressType, 99 plugDirection, 100 plugId ); 101 if (p) p->setVerboseLevel(getDebugLevel()); 102 return p; 101 103 } 102 104 … … 106 108 subunit_t id ) 107 109 { 110 Subunit* s=NULL; 108 111 switch (type) { 109 112 case eST_Audio: 110 return new SubunitAudio(unit, id ); 113 s=new SubunitAudio(unit, id ); 114 break; 111 115 case eST_Music: 112 return new SubunitMusic(unit, id ); 116 s=new SubunitMusic(unit, id ); 117 break; 113 118 default: 114 return NULL; 115 } 119 s=NULL; 120 break; 121 } 122 if(s) s->setVerboseLevel(getDebugLevel()); 123 return s; 116 124 } 117 125 … … 119 127 Unit::setVerboseLevel(int l) 120 128 { 129 debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l ); 130 setDebugLevel(l); 131 for ( SubunitVector::const_iterator it = m_subunits.begin(); 132 it != m_subunits.end(); 133 ++it ) 134 { 135 (*it)->setVerboseLevel(l); 136 } 137 121 138 m_pPlugManager->setVerboseLevel(l); 122 139 } … … 368 385 plugDirection, 369 386 plugId ); 387 388 if( plug ) plug->setVerboseLevel(getDebugLevel()); 389 370 390 if ( !plug || !plug->discover() ) { 371 391 debugError( "plug discovering failed\n" ); … … 397 417 plugDirection, 398 418 plugId ); 419 420 if( plug ) plug->setVerboseLevel(getDebugLevel()); 421 399 422 if ( !plug || !plug->discover() ) { 400 423 debugError( "plug discovering failed\n" ); … … 767 790 768 791 void 769 Unit::show Device()792 Unit::show() 770 793 { 771 794 m_pPlugManager->showPlugs(); trunk/libffado/src/libavc/general/avc_unit.h
r554 r560 53 53 54 54 virtual void setVerboseLevel(int l); 55 virtual void show Device();55 virtual void show(); 56 56 57 57 // these have to be implemented by the parent class trunk/libffado/src/libieee1394/configrom.cpp
r478 r560 122 122 { 123 123 return m_guid == rhs.m_guid; 124 } 125 126 bool 127 ConfigRom::compareGUID( const ConfigRom& a, const ConfigRom& b ) { 128 return a.getGuid() > b.getGuid(); 124 129 } 125 130 trunk/libffado/src/libieee1394/configrom.h
r478 r560 80 80 bool updatedNodeId(); 81 81 bool setNodeId( fb_nodeid_t nodeId ); 82 83 /** 84 * @brief Compares the GUID of two ConfigRom's 85 * 86 * This function compares the GUID of two ConfigRom objects and returns true 87 * if the GUID of @ref a is larger than the GUID of @ref b . This is intended 88 * to be used with the STL sort() algorithm. 89 * 90 * Note that GUID's are converted to integers for this. 91 * 92 * @param a pointer to first ConfigRom 93 * @param b pointer to second ConfigRom 94 * 95 * @returns true if the GUID of @ref a is larger than the GUID of @ref b . 96 */ 97 static bool compareGUID( const ConfigRom& a, const ConfigRom& b ); 82 98 83 99 void printConfigRom() const; trunk/libffado/src/libieee1394/ieee1394service.cpp
r445 r560 38 38 #include <iomanip> 39 39 40 IMPL_DEBUG_MODULE( Ieee1394Service, Ieee1394Service, DEBUG_LEVEL_ VERBOSE);40 IMPL_DEBUG_MODULE( Ieee1394Service, Ieee1394Service, DEBUG_LEVEL_NORMAL ); 41 41 42 42 Ieee1394Service::Ieee1394Service() … … 831 831 Ieee1394Service::setVerboseLevel(int l) 832 832 { 833 debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l ); 833 834 setDebugLevel(l); 834 835 } trunk/libffado/src/libosc/OscNode.cpp
r461 r560 29 29 namespace OSC { 30 30 31 IMPL_DEBUG_MODULE( OscNode, OscNode, DEBUG_LEVEL_ VERBOSE);31 IMPL_DEBUG_MODULE( OscNode, OscNode, DEBUG_LEVEL_NORMAL ); 32 32 33 33 OscNode::OscNode() … … 63 63 void 64 64 OscNode::setVerboseLevel(int l) { 65 debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l ); 65 66 setDebugLevel(l); 66 67 for ( OscNodeVectorIterator it = m_ChildNodes.begin(); trunk/libffado/src/libosc/OscServer.cpp
r462 r560 33 33 namespace OSC { 34 34 35 IMPL_DEBUG_MODULE( OscServer, OscServer, DEBUG_LEVEL_ VERBOSE);35 IMPL_DEBUG_MODULE( OscServer, OscServer, DEBUG_LEVEL_NORMAL ); 36 36 37 37 OscServer::OscServer(string port) … … 50 50 void 51 51 OscServer::setVerboseLevel(int l) { 52 debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l ); 52 53 setDebugLevel(l); 53 54 if (m_rootNode) m_rootNode->setVerboseLevel(l);