Changeset 499
- Timestamp:
- 07/28/07 01:21:08 (16 years ago)
- Files:
-
- branches/echoaudio/src/bebob/bebob_avdevice.cpp (modified) (8 diffs)
- branches/echoaudio/src/bebob/bebob_avdevice_subunit.cpp (modified) (5 diffs)
- branches/echoaudio/src/bebob/bebob_avdevice_subunit.h (modified) (3 diffs)
- branches/echoaudio/src/bebob/bebob_avplug.cpp (modified) (15 diffs)
- branches/echoaudio/src/bebob/bebob_avplug.h (modified) (5 diffs)
- branches/echoaudio/src/debugmodule/debugmodule.cpp (modified) (1 diff)
- branches/echoaudio/src/debugmodule/debugmodule.h (modified) (3 diffs)
- branches/echoaudio/src/devicemanager.cpp (modified) (1 diff)
- branches/echoaudio/src/iavdevice.h (modified) (1 diff)
- branches/echoaudio/src/libavc/avc_definitions.h (modified) (1 diff)
- branches/echoaudio/src/libavc/avc_extended_cmd_generic.cpp (modified) (4 diffs)
- branches/echoaudio/src/libavc/avc_extended_cmd_generic.h (modified) (2 diffs)
- branches/echoaudio/src/libavc/avc_extended_plug_info.h (modified) (2 diffs)
- branches/echoaudio/src/libavc/avc_generic.cpp (modified) (6 diffs)
- branches/echoaudio/src/libavc/avc_generic.h (modified) (4 diffs)
- branches/echoaudio/src/libavc/avc_plug_info.cpp (modified) (1 diff)
- branches/echoaudio/src/libavc/avc_plug_info.h (modified) (1 diff)
- branches/echoaudio/src/libavc/avc_serialize.cpp (modified) (9 diffs)
- branches/echoaudio/src/libavc/avc_serialize.h (modified) (9 diffs)
- branches/echoaudio/src/Makefile.am (modified) (4 diffs)
- branches/echoaudio/tests/Makefile.am (modified) (2 diffs)
- branches/echoaudio/tests/test-ffado.cpp (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/echoaudio/src/bebob/bebob_avdevice.cpp
r472 r499 283 283 *m_pConfigRom, 284 284 *m_pPlugManager, 285 AVCCommand::eST_Unit,285 eST_Unit, 286 286 0xff, 287 287 0xff, … … 316 316 *m_pConfigRom, 317 317 *m_pPlugManager, 318 AVCCommand::eST_Unit,318 eST_Unit, 319 319 0xff, 320 320 0xff, … … 437 437 438 438 AvPlugVector syncMSUInputPlugs = m_pPlugManager->getPlugsByType( 439 AVCCommand::eST_Music,439 eST_Music, 440 440 0, 441 441 0xff, … … 449 449 450 450 AvPlugVector syncMSUOutputPlugs = m_pPlugManager->getPlugsByType( 451 AVCCommand::eST_Music,451 eST_Music, 452 452 0, 453 453 0xff, … … 579 579 AvDeviceSubunit* subunit = 0; 580 580 switch( subunit_type ) { 581 case AVCCommand::eST_Audio:581 case eST_Audio: 582 582 subunit = new AvDeviceSubunitAudio( *this, 583 583 subunitId, … … 587 587 return false; 588 588 } 589 590 m_subunits.push_back( subunit ); 591 audioSubunitFound=true; 592 589 if ( !subunit ) { 590 debugFatal( "Could not allocate AvDeviceSubunitMusic\n" ); 591 return false; 592 } 593 594 if ( !subunit->discover() ) { 595 debugError( "enumerateSubUnits: Could not discover " 596 "subunit_id = %2d, subunit_type = %2d (%s)\n", 597 subunitId, 598 subunit_type, 599 subunitTypeToString( subunit_type ) ); 600 delete subunit; 601 return false; 602 } else { 603 m_subunits.push_back( subunit ); 604 audioSubunitFound=true; 605 } 606 593 607 break; 594 case AVCCommand::eST_Music:608 case eST_Music: 595 609 subunit = new AvDeviceSubunitMusic( *this, 596 610 subunitId, … … 600 614 return false; 601 615 } 602 603 m_subunits.push_back( subunit ); 604 musicSubunitFound=true; 616 if ( !subunit->discover() ) { 617 debugError( "enumerateSubUnits: Could not discover " 618 "subunit_id = %2d, subunit_type = %2d (%s)\n", 619 subunitId, 620 subunit_type, 621 subunitTypeToString( subunit_type ) ); 622 delete subunit; 623 return false; 624 } else { 625 m_subunits.push_back( subunit ); 626 musicSubunitFound=true; 627 } 605 628 606 629 break; … … 612 635 continue; 613 636 614 }615 616 if ( !subunit->discover() ) {617 debugError( "enumerateSubUnits: Could not discover "618 "subunit_id = %2d, subunit_type = %2d (%s)\n",619 subunitId,620 subunit_type,621 subunitTypeToString( subunit_type ) );622 delete subunit;623 return false;624 637 } 625 638 branches/echoaudio/src/bebob/bebob_avdevice_subunit.cpp
r451 r499 39 39 40 40 BeBoB::AvDeviceSubunit::AvDeviceSubunit( AvDevice& avDevice, 41 AVCCommand::ESubunitType type,41 ESubunitType type, 42 42 subunit_t id, 43 43 int verboseLevel ) … … 139 139 ++plugIdx ) 140 140 { 141 AVCCommand::ESubunitType subunitType =142 static_cast< AVCCommand::ESubunitType>( getSubunitType() );141 ESubunitType subunitType = 142 static_cast<ESubunitType>( getSubunitType() ); 143 143 AvPlug* plug = new AvPlug( m_avDevice->get1394Service(), 144 144 m_avDevice->getConfigRom(), … … 210 210 { 211 211 bool result; 212 AVCCommand::ESubunitType sbType;212 ESubunitType sbType; 213 213 result = deser.read( basePath + "m_sbType", sbType ); 214 214 215 215 AvDeviceSubunit* pSubunit = 0; 216 216 switch( sbType ) { 217 case AVCCommand::eST_Audio:217 case eST_Audio: 218 218 pSubunit = new AvDeviceSubunitAudio; 219 219 break; 220 case AVCCommand::eST_Music:220 case eST_Music: 221 221 pSubunit = new AvDeviceSubunitMusic; 222 222 break; … … 248 248 subunit_t id, 249 249 int verboseLevel ) 250 : AvDeviceSubunit( avDevice, AVCCommand::eST_Audio, id, verboseLevel )250 : AvDeviceSubunit( avDevice, eST_Audio, id, verboseLevel ) 251 251 { 252 252 } … … 578 578 subunit_t id, 579 579 int verboseLevel ) 580 : AvDeviceSubunit( avDevice, AVCCommand::eST_Music, id, verboseLevel )580 : AvDeviceSubunit( avDevice, eST_Music, id, verboseLevel ) 581 581 { 582 582 } branches/echoaudio/src/bebob/bebob_avdevice_subunit.h
r451 r499 42 42 public: 43 43 AvDeviceSubunit( AvDevice& avDevice, 44 AVCCommand::ESubunitType type,44 ESubunitType type, 45 45 subunit_t id, 46 46 int verboseLevel ); … … 55 55 subunit_t getSubunitId() 56 56 { return m_sbId; } 57 AVCCommand::ESubunitType getSubunitType()57 ESubunitType getSubunitType() 58 58 { return m_sbType; } 59 59 … … 86 86 protected: 87 87 AvDevice* m_avDevice; 88 AVCCommand::ESubunitType m_sbType;88 ESubunitType m_sbType; 89 89 subunit_t m_sbId; 90 90 int m_verboseLevel; branches/echoaudio/src/bebob/bebob_avplug.cpp
r447 r499 41 41 ConfigRom& configRom, 42 42 AvPlugManager& plugManager, 43 AVCCommand::ESubunitType subunitType,43 ESubunitType subunitType, 44 44 subunit_id_t subunitId, 45 45 function_block_type_t functionBlockType, … … 106 106 : m_p1394Service( 0 ) 107 107 , m_pConfigRom( 0 ) 108 , m_subunitType( AVCCommand::eST_Reserved ) // a good value for unknown/undefined?108 , m_subunitType( eST_Reserved ) // a good value for unknown/undefined? 109 109 , m_subunitId( 0 ) 110 110 , m_functionBlockType( 0 ) … … 953 953 954 954 switch( m_subunitType ) { 955 case AVCCommand::eST_Unit:955 case eST_Unit: 956 956 { 957 957 UnitPlugAddress::EPlugType ePlugType = … … 978 978 } 979 979 break; 980 case AVCCommand::eST_Music:981 case AVCCommand::eST_Audio:980 case eST_Music: 981 case eST_Audio: 982 982 { 983 983 switch( m_addressType ) { … … 1030 1030 subFunction ); 1031 1031 switch( m_subunitType ) { 1032 case AVCCommand::eST_Unit:1032 case eST_Unit: 1033 1033 { 1034 1034 UnitPlugAddress::EPlugType ePlugType = … … 1055 1055 } 1056 1056 break; 1057 case AVCCommand::eST_Music:1058 case AVCCommand::eST_Audio:1057 case eST_Music: 1058 case eST_Audio: 1059 1059 { 1060 1060 switch( m_addressType ) { … … 1103 1103 1104 1104 switch( m_subunitType ) { 1105 case AVCCommand::eST_Unit:1105 case eST_Unit: 1106 1106 { 1107 1107 SignalUnitAddress signalUnitAddr; … … 1114 1114 } 1115 1115 break; 1116 case AVCCommand::eST_Music:1117 case AVCCommand::eST_Audio:1116 case eST_Music: 1117 case eST_Audio: 1118 1118 { 1119 1119 SignalSubunitAddress signalSubunitAddr; … … 1129 1129 1130 1130 signalSourceCmd.setNodeId( m_pConfigRom->getNodeId() ); 1131 signalSourceCmd.setSubunitType( AVCCommand::eST_Unit );1131 signalSourceCmd.setSubunitType( eST_Unit ); 1132 1132 signalSourceCmd.setSubunitId( 0xff ); 1133 1133 … … 1140 1140 { 1141 1141 switch( plug.m_subunitType ) { 1142 case AVCCommand::eST_Unit:1142 case eST_Unit: 1143 1143 { 1144 1144 SignalUnitAddress signalUnitAddr; … … 1151 1151 } 1152 1152 break; 1153 case AVCCommand::eST_Music:1154 case AVCCommand::eST_Audio:1153 case eST_Music: 1154 case eST_Audio: 1155 1155 { 1156 1156 SignalSubunitAddress signalSubunitAddr; … … 1318 1318 1319 1319 if ( pUnitPlugAddress ) { 1320 subunitType = AVCCommand::eST_Unit;1320 subunitType = eST_Unit; 1321 1321 switch ( pUnitPlugAddress->m_plugType ) { 1322 1322 case UnitPlugSpecificDataPlugAddress::ePT_PCR: … … 1408 1408 } 1409 1409 1410 AVCCommand::ESubunitType enumSubunitType =1411 static_cast< AVCCommand::ESubunitType>( subunitType );1410 ESubunitType enumSubunitType = 1411 static_cast<ESubunitType>( subunitType ); 1412 1412 1413 1413 return m_plugManager->getPlug( … … 2035 2035 2036 2036 AvPlug* 2037 AvPlugManager::getPlug( AVCCommand::ESubunitType subunitType,2037 AvPlugManager::getPlug( ESubunitType subunitType, 2038 2038 subunit_id_t subunitId, 2039 2039 function_block_type_t functionBlockType, … … 2091 2091 2092 2092 AvPlugVector 2093 AvPlugManager::getPlugsByType( AVCCommand::ESubunitType subunitType,2093 AvPlugManager::getPlugsByType( ESubunitType subunitType, 2094 2094 subunit_id_t subunitId, 2095 2095 function_block_type_t functionBlockType, branches/echoaudio/src/bebob/bebob_avplug.h
r445 r499 81 81 ConfigRom& configRom, 82 82 AvPlugManager& plugManager, 83 AVCCommand::ESubunitType subunitType,83 ESubunitType subunitType, 84 84 subunit_id_t subunitId, 85 85 function_block_type_t functionBlockType, … … 102 102 plug_id_t getPlugId() const 103 103 { return m_id; } 104 AVCCommand::ESubunitType getSubunitType() const104 ESubunitType getSubunitType() const 105 105 { return m_subunitType; } 106 106 subunit_id_t getSubunitId() const … … 259 259 Ieee1394Service* m_p1394Service; 260 260 ConfigRom* m_pConfigRom; 261 AVCCommand::ESubunitType m_subunitType;261 ESubunitType m_subunitType; 262 262 subunit_id_t m_subunitId; 263 263 function_block_type_t m_functionBlockType; … … 298 298 void showPlugs() const; 299 299 300 AvPlug* getPlug( AVCCommand::ESubunitType subunitType,300 AvPlug* getPlug( ESubunitType subunitType, 301 301 subunit_id_t subunitId, 302 302 function_block_type_t functionBlockType, … … 306 306 plug_id_t plugId ) const; 307 307 AvPlug* getPlug( int iGlobalId ) const; 308 AvPlugVector getPlugsByType( AVCCommand::ESubunitType subunitType,308 AvPlugVector getPlugsByType( ESubunitType subunitType, 309 309 subunit_id_t subunitId, 310 310 function_block_type_t functionBlockType, branches/echoaudio/src/debugmodule/debugmodule.cpp
r474 r499 286 286 287 287 void 288 DebugModuleManager:: sync()288 DebugModuleManager::flush() 289 289 { 290 290 mb_flush(); branches/echoaudio/src/debugmodule/debugmodule.h
r445 r499 34 34 typedef short debug_level_t; 35 35 36 #define DEBUG_MAX_MESSAGE_LENGTH 256 37 36 38 /* MB_NEXT() relies on the fact that MB_BUFFERS is a power of two */ 37 #define MB_BUFFERS 8192 39 #define MB_BUFFERS 8192UL 38 40 #define MB_NEXT(index) ((index+1) & (MB_BUFFERS-1)) 39 #define MB_BUFFERSIZE 256/* message length limit */41 #define MB_BUFFERSIZE DEBUG_MAX_MESSAGE_LENGTH /* message length limit */ 40 42 41 43 #define debugFatal( format, args... ) \ … … 99 101 m_debugModule.getLevel( ) 100 102 103 #define flushDebugOutput() DebugModuleManager::instance()->flush() 101 104 102 105 #ifdef DEBUG … … 203 206 bool setMgrDebugLevel( std::string name, debug_level_t level ); 204 207 205 void sync();208 void flush(); 206 209 207 210 protected: branches/echoaudio/src/devicemanager.cpp
r475 r499 134 134 } 135 135 136 m_oscServer = new OSC::OscServer("17820");137 138 if (!m_oscServer) {139 debugFatal("failed to create osc server\n");140 delete m_1394Service;141 m_1394Service = 0;142 return false;143 }144 145 if (!m_oscServer->init()) {146 debugFatal("failed to init osc server\n");147 delete m_oscServer;148 m_oscServer = NULL;149 delete m_1394Service;150 m_1394Service = 0;151 return false;152 }153 154 if (!m_oscServer->registerAtRootNode(this)) {155 debugFatal("failed to register devicemanager at server\n");156 delete m_oscServer;157 m_oscServer = NULL;158 delete m_1394Service;159 m_1394Service = 0;160 return false;161 }162 163 if (!m_oscServer->start()) {164 debugFatal("failed to start osc server\n");165 delete m_oscServer;166 m_oscServer = NULL;167 delete m_1394Service;168 m_1394Service = 0;169 return false;170 }136 // m_oscServer = new OSC::OscServer("17820"); 137 // 138 // if (!m_oscServer) { 139 // debugFatal("failed to create osc server\n"); 140 // delete m_1394Service; 141 // m_1394Service = 0; 142 // return false; 143 // } 144 // 145 // if (!m_oscServer->init()) { 146 // debugFatal("failed to init osc server\n"); 147 // delete m_oscServer; 148 // m_oscServer = NULL; 149 // delete m_1394Service; 150 // m_1394Service = 0; 151 // return false; 152 // } 153 // 154 // if (!m_oscServer->registerAtRootNode(this)) { 155 // debugFatal("failed to register devicemanager at server\n"); 156 // delete m_oscServer; 157 // m_oscServer = NULL; 158 // delete m_1394Service; 159 // m_1394Service = 0; 160 // return false; 161 // } 162 // 163 // if (!m_oscServer->start()) { 164 // debugFatal("failed to start osc server\n"); 165 // delete m_oscServer; 166 // m_oscServer = NULL; 167 // delete m_1394Service; 168 // m_1394Service = 0; 169 // return false; 170 // } 171 171 172 172 setVerboseLevel(getDebugLevel()); branches/echoaudio/src/iavdevice.h
r450 r499 98 98 * these ID's are not fixed to a specific physical device. 99 99 * At some point, we will replaced this with a GUID based 100 * approach, which is tied to a physi scal device and is100 * approach, which is tied to a physical device and is 101 101 * bus & time independant. 102 102 * branches/echoaudio/src/libavc/avc_definitions.h
r445 r499 129 129 #define AVC1394_SUBUNIT_ID_RESERVED 0x06 130 130 131 enum ESubunitType { 132 eST_Monitor = AVC1394_SUBUNIT_VIDEO_MONITOR, 133 eST_Audio = AVC1394_SUBUNIT_AUDIO, 134 eST_Printer = AVC1394_SUBUNIT_PRINTER, 135 eST_Disc = AVC1394_SUBUNIT_DISC_RECORDER, 136 eST_VCR = AVC1394_SUBUNIT_VCR, 137 eST_Tuner = AVC1394_SUBUNIT_TUNER, 138 eST_CA = AVC1394_SUBUNIT_CA, 139 eST_Camera = AVC1394_SUBUNIT_VIDEO_CAMERA, 140 eST_Panel = AVC1394_SUBUNIT_PANEL, 141 eST_BulltinBoard = AVC1394_SUBUNIT_BULLETIN_BOARD, 142 eST_CameraStorage = AVC1394_SUBUNIT_CAMERA_STORAGE, 143 eST_Music = AVC1394_SUBUNIT_MUSIC, 144 eST_VendorUnique = AVC1394_SUBUNIT_VENDOR_UNIQUE, 145 eST_Reserved = AVC1394_SUBUNIT_RESERVED, 146 eST_Extended = AVC1394_SUBUNIT_EXTENDED, 147 eST_Unit = AVC1394_SUBUNIT_UNIT, 148 }; 149 150 131 151 #endif // AVDDEFINITIONS_H branches/echoaudio/src/libavc/avc_extended_cmd_generic.cpp
r445 r499 221 221 222 222 SubunitPlugSpecificDataPlugAddress::SubunitPlugSpecificDataPlugAddress( 223 AVCCommand::ESubunitType subunitType,223 ESubunitType subunitType, 224 224 subunit_id_t subunitId, 225 225 plug_id_t plugId ) … … 267 267 268 268 FunctionBlockPlugSpecificDataPlugAddress::FunctionBlockPlugSpecificDataPlugAddress( 269 AVCCommand::ESubunitType subunitType,269 ESubunitType subunitType, 270 270 subunit_id_t subunitId, 271 271 function_block_type_t functionBlockType, … … 530 530 m_plugAddressData = 531 531 new SubunitPlugSpecificDataPlugAddress( 532 AVCCommand::eST_Reserved,532 eST_Reserved, 533 533 0xff, 534 534 0xff ); … … 537 537 m_plugAddressData = 538 538 new FunctionBlockPlugSpecificDataPlugAddress( 539 AVCCommand::eST_Reserved,539 eST_Reserved, 540 540 0xff, 541 541 0xff, branches/echoaudio/src/libavc/avc_extended_cmd_generic.h
r445 r499 142 142 { 143 143 public: 144 SubunitPlugSpecificDataPlugAddress( AVCCommand::ESubunitType subunitType,144 SubunitPlugSpecificDataPlugAddress( ESubunitType subunitType, 145 145 subunit_id_t subunitId, 146 146 plug_id_t plugId ); … … 163 163 { 164 164 public: 165 FunctionBlockPlugSpecificDataPlugAddress( AVCCommand::ESubunitType subunitType,165 FunctionBlockPlugSpecificDataPlugAddress( ESubunitType subunitType, 166 166 subunit_id_t subunitId, 167 167 function_block_type_t functionBlockType, branches/echoaudio/src/libavc/avc_extended_plug_info.h
r445 r499 288 288 public: 289 289 enum ESubFunction { 290 eSF_ExtendedPlugInfoCmd = AVC1394_PLUG_INFO_SUBFUNCTION_EXTENDED_PLUG_INFO_CMD,290 eSF_ExtendedPlugInfoCmd = AVC1394_PLUG_INFO_SUBFUNCTION_EXTENDED_PLUG_INFO_CMD, 291 291 eSF_NotUsed = AVC1394_PLUG_INFO_SUBFUNCTION_SERIAL_BUS_NOT_USED, 292 292 }; … … 302 302 bool setPlugAddress( const PlugAddress& plugAddress ); 303 303 bool setSubFunction( ESubFunction subFunction ); 304 subfunction_t getSubFunction( ) {return m_subFunction;}; 304 305 bool setInfoType( const ExtendedPlugInfoInfoType& infoType ); 305 306 ExtendedPlugInfoInfoType* getInfoType() branches/echoaudio/src/libavc/avc_generic.cpp
r445 r499 120 120 } 121 121 122 AVCCommand::ESubunitType122 ESubunitType 123 123 AVCCommand::getSubunitType() 124 124 { … … 150 150 unsigned short frameSize ) const 151 151 { 152 // use an intermediate buffer to avoid a load of very small print's that cause the 153 // message ringbuffer to overflow 154 char msg[DEBUG_MAX_MESSAGE_LENGTH]; 155 int chars_written=0; 152 156 for ( int i = 0; i < frameSize; ++i ) { 153 157 if ( ( i % 16 ) == 0 ) { 154 158 if ( i > 0 ) { 155 debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "\n" ); 159 debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s\n", msg); 160 chars_written=0; 156 161 } 157 debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, " %3d:\t", i );162 chars_written+=snprintf(msg+chars_written,DEBUG_MAX_MESSAGE_LENGTH-chars_written," %3d:\t", i );; 158 163 } else if ( ( i % 4 ) == 0 ) { 159 debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, " ");164 chars_written+=snprintf(msg+chars_written,DEBUG_MAX_MESSAGE_LENGTH-chars_written," "); 160 165 } 161 debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%02x ", buf[i] ); 162 } 163 debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "\n" ); 166 chars_written+=snprintf(msg+chars_written,DEBUG_MAX_MESSAGE_LENGTH-chars_written, "%02x ", buf[i] ); 167 } 168 if (chars_written != 0) { 169 debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s\n", msg ); 170 } else { 171 debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "\n" ); 172 } 164 173 } 165 174 … … 171 180 BufferSerialize se( m_fcpFrame, sizeof( m_fcpFrame ) ); 172 181 if ( !serialize( se ) ) { 173 debugFatal( " ExtendedPlugInfoCmd::fire: Could not serialize\n" );182 debugFatal( "fire: Could not serialize\n" ); 174 183 return false; 175 184 } … … 184 193 StringSerializer se_dbg; 185 194 serialize( se_dbg ); 186 187 debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s\n", 188 se_dbg.getString().c_str()); 195 196 // output the debug message in smaller chunks to avoid problems 197 // with a max message size 198 unsigned int chars_to_write=se_dbg.getString().size(); 199 unsigned int chars_written=0; 200 while (chars_written<chars_to_write) { 201 debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s\n", 202 se_dbg.getString().substr(chars_written, DEBUG_MAX_MESSAGE_LENGTH).c_str()); 203 chars_written += DEBUG_MAX_MESSAGE_LENGTH-1; 204 } 189 205 } 190 206 … … 216 232 serialize( se_dbg ); 217 233 218 debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s\n", 219 se_dbg.getString().c_str()); 234 // output the debug message in smaller chunks to avoid problems 235 // with a max message size 236 unsigned int chars_to_write=se_dbg.getString().size(); 237 unsigned int chars_written=0; 238 while (chars_written<chars_to_write) { 239 debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s\n", 240 se_dbg.getString().substr(chars_written, DEBUG_MAX_MESSAGE_LENGTH).c_str()); 241 chars_written += DEBUG_MAX_MESSAGE_LENGTH-1; 242 } 243 220 244 } 221 245 break; … … 269 293 subunitTypeToString( subunit_type_t subunitType ) 270 294 { 271 if ( subunitType == AVCCommand::eST_Unit ) {295 if ( subunitType == eST_Unit ) { 272 296 return "Unit"; 273 297 } branches/echoaudio/src/libavc/avc_generic.h
r445 r499 39 39 typedef unsigned char fcp_frame_t[fcpFrameMaxLength]; 40 40 41 enum EAVCDiscoveryMode { 42 eDM_BeBoB = 0x00, 43 eDM_GenericAVC = 0x01, 44 eDM_Invalid = 0xFF, 45 }; 46 41 47 class IBusData { 42 48 public: … … 48 54 49 55 virtual IBusData* clone() const = 0; 50 56 51 57 protected: 52 58 DECLARE_DEBUG_MODULE; … … 74 80 eCT_GeneralInquiry = AVC1394_CTYP_GENERAL_INQUIRY, 75 81 eCT_Unknown = 0xff, 76 };77 78 enum ESubunitType {79 eST_Monitor = AVC1394_SUBUNIT_VIDEO_MONITOR,80 eST_Audio = AVC1394_SUBUNIT_AUDIO,81 eST_Printer = AVC1394_SUBUNIT_PRINTER,82 eST_Disc = AVC1394_SUBUNIT_DISC_RECORDER,83 eST_VCR = AVC1394_SUBUNIT_VCR,84 eST_Tuner = AVC1394_SUBUNIT_TUNER,85 eST_CA = AVC1394_SUBUNIT_CA,86 eST_Camera = AVC1394_SUBUNIT_VIDEO_CAMERA,87 eST_Panel = AVC1394_SUBUNIT_PANEL,88 eST_BulltinBoard = AVC1394_SUBUNIT_BULLETIN_BOARD,89 eST_CameraStorage = AVC1394_SUBUNIT_CAMERA_STORAGE,90 eST_Music = AVC1394_SUBUNIT_MUSIC,91 eST_VendorUnique = AVC1394_SUBUNIT_VENDOR_UNIQUE,92 eST_Reserved = AVC1394_SUBUNIT_RESERVED,93 eST_Extended = AVC1394_SUBUNIT_EXTENDED,94 eST_Unit = AVC1394_SUBUNIT_UNIT,95 82 }; 96 83 … … 139 126 ECommandType m_commandType; 140 127 static int m_time; 141 128 129 protected: 142 130 DECLARE_DEBUG_MODULE; 143 131 }; branches/echoaudio/src/libavc/avc_plug_info.cpp
r445 r499 62 62 PlugInfoCmd::~PlugInfoCmd() 63 63 { 64 } 65 66 void 67 PlugInfoCmd::clear() 68 { 69 m_serialBusIsochronousInputPlugs=0xff; 70 m_serialBusIsochronousOutputPlugs=0xff; 71 m_externalInputPlugs=0xff; 72 m_externalOutputPlugs=0xff; 73 m_serialBusAsynchronousInputPlugs=0xff; 74 m_serialBusAsynchronousOuputPlugs=0xff; 75 m_destinationPlugs=0xff; 76 m_sourcePlugs=0xff; 64 77 } 65 78 branches/echoaudio/src/libavc/avc_plug_info.h
r445 r499 53 53 virtual bool deserialize( IISDeserialize& de ); 54 54 55 virtual void clear(); 56 55 57 virtual const char* getCmdName() const 56 58 { return "PlugInfoCmd"; } branches/echoaudio/src/libavc/avc_serialize.cpp
r445 r499 30 30 31 31 IMPL_DEBUG_MODULE( CoutSerializer, CoutSerializer, DEBUG_LEVEL_NORMAL ); 32 IMPL_DEBUG_MODULE( StringSerializer, StringSerializer, DEBUG_LEVEL_NORMAL ); 33 IMPL_DEBUG_MODULE( BufferSerialize, BufferSerialize, DEBUG_LEVEL_NORMAL ); 34 IMPL_DEBUG_MODULE( BufferDeserialize, BufferDeserialize, DEBUG_LEVEL_NORMAL ); 32 35 33 36 bool 34 37 CoutSerializer::write( byte_t d, const char* name ) 35 38 { 36 debugOutput( DEBUG_LEVEL_NORMAL, " %3d: \t0x%02x\t%s\n", m_cnt, d, name );39 debugOutput( DEBUG_LEVEL_NORMAL, " %3d: 0x%02x %40s\n", m_cnt, d, name ); 37 40 m_cnt += sizeof( byte_t ); 38 41 … … 41 44 42 45 bool 46 CoutSerializer::write( uint16_t d, const char* name ) 47 { 48 debugOutput( DEBUG_LEVEL_NORMAL, " %3d: 0x%04x %40s\n", m_cnt, d, name ); 49 m_cnt += sizeof( uint16_t ); 50 51 return true; 52 } 53 54 bool 43 55 CoutSerializer::write( quadlet_t d, const char* name ) 44 56 { 45 debugOutput( DEBUG_LEVEL_NORMAL, " %3d: \t0x%08x\t%s\n", m_cnt, d, name );57 debugOutput( DEBUG_LEVEL_NORMAL, " %3d: 0x%08x %40s\n", m_cnt, d, name ); 46 58 m_cnt += sizeof( quadlet_t ); 47 59 return true; 48 60 } 49 61 62 bool 63 CoutSerializer::write( const char * v, size_t len, const char* name ) 64 { 65 debugOutput( DEBUG_LEVEL_NORMAL, " %3d: %s %40s\n", m_cnt, v, name ); 66 m_cnt += len; 67 return true; 68 } 50 69 ////////////////////////////////////////////////// 51 70 … … 65 84 66 85 bool 86 StringSerializer::write( uint16_t d, const char* name ) 87 { 88 char* result; 89 asprintf( &result, " %3d:\t0x%04x\t%s\n", m_cnt, d, name ); 90 91 m_string += result; 92 free( result ); 93 94 m_cnt += sizeof( uint16_t ); 95 96 return true; 97 } 98 99 bool 67 100 StringSerializer::write( quadlet_t d, const char* name ) 68 101 { … … 77 110 } 78 111 112 bool 113 StringSerializer::write( const char * v, size_t len, const char* name ) 114 { 115 char* result; 116 asprintf( &result, " %3d:\t%s\t%s\n", m_cnt, v, name ); 117 118 m_string += result; 119 free( result ); 120 121 m_cnt += len; 122 return true; 123 } 79 124 ////////////////////////////////////////////////// 80 125 … … 87 132 m_curPos += sizeof( byte_t ); 88 133 result = true; 134 } 135 return result; 136 } 137 138 bool 139 BufferSerialize::write( uint16_t value, const char* name ) 140 { 141 byte_t hi = (value & 0xFF00) >> 8; 142 byte_t lo = value & 0xFF; 143 144 bool result = false; 145 if ( isCurPosValid() ) { 146 *m_curPos = hi; 147 m_curPos += sizeof( byte_t ); 148 if ( isCurPosValid() ) { 149 *m_curPos = lo; 150 m_curPos += sizeof( byte_t ); 151 result = true; 152 } 89 153 } 90 154 return result; … … 104 168 105 169 bool 170 BufferSerialize::write( const char * v, size_t len, const char* name ) 171 { 172 bool result = false; 173 if ( isCurPosValid() ) { 174 m_curPos += len; 175 // avoid write beyond buffer 176 if ( isCurPosValid() ) { 177 m_curPos -= len; 178 memcpy(m_curPos, v, len); 179 m_curPos += len; 180 result = true; 181 } 182 } 183 return result; 184 } 185 186 bool 106 187 BufferSerialize::isCurPosValid() const 107 188 { … … 127 208 128 209 bool 210 BufferDeserialize::read( uint16_t* value ) 211 { 212 byte_t hi; 213 byte_t lo; 214 bool result = false; 215 if ( isCurPosValid() ) { 216 hi = *((byte_t *)m_curPos); 217 m_curPos += sizeof( byte_t ); 218 if ( isCurPosValid() ) { 219 lo = *((byte_t *)m_curPos); 220 m_curPos += sizeof( byte_t ); 221 *value=(hi << 8) | lo; 222 result = true; 223 } 224 } 225 return result; 226 } 227 228 bool 129 229 BufferDeserialize::read( quadlet_t* value ) 130 230 { … … 144 244 if ( isCurPosValid() ) { 145 245 *value = ( char* )m_curPos; 146 m_curPos += length; 147 result = true; 246 247 m_curPos += length-1; 248 if ( !isCurPosValid() ) { 249 debugError("Read past end of response\n"); 250 result=false; 251 } else { 252 m_curPos++; 253 result = true; 254 } 148 255 } 149 256 return result; … … 159 266 } 160 267 return result; 268 } 269 270 bool 271 BufferDeserialize::peek( uint16_t* value, size_t offset ) 272 { 273 byte_t hi; 274 byte_t lo; 275 bool result = false; 276 m_curPos+=offset; 277 if ( isCurPosValid() ) { 278 hi = *((byte_t *)m_curPos); 279 m_curPos += sizeof( byte_t ); 280 if ( isCurPosValid() ) { 281 lo = *((byte_t *)m_curPos); 282 *value=(hi << 8) | lo; 283 result = true; 284 } 285 m_curPos -= sizeof( byte_t ); 286 } 287 m_curPos-=offset; 288 return result; 289 } 290 291 bool 292 BufferDeserialize::skip( size_t length ) { 293 m_curPos+=length; 294 return true; 161 295 } 162 296 branches/echoaudio/src/libavc/avc_serialize.h
r445 r499 38 38 39 39 virtual bool write( byte_t value, const char* name = "" ) = 0; 40 virtual bool write( uint16_t value, const char* name = "" ) = 0; 40 41 virtual bool write( quadlet_t value, const char* name = "" ) = 0; 42 virtual bool write( const char *values, size_t len, const char* name = "" ) = 0; 41 43 }; 42 44 … … 47 49 48 50 virtual bool read( byte_t* value ) = 0; 51 virtual bool read( uint16_t* value ) = 0; 49 52 virtual bool read( quadlet_t* value ) = 0; 50 53 virtual bool read( char** value, size_t length ) = 0; 51 54 virtual bool peek( byte_t* value ) = 0; 55 virtual bool peek( uint16_t* value, size_t offset )=0; 56 virtual bool skip( size_t length ) = 0; 57 virtual int getNrOfConsumedBytes() const = 0; 52 58 }; 53 59 … … 63 69 64 70 virtual bool write( byte_t value, const char* name = "" ); 71 virtual bool write( uint16_t value, const char* name = "" ); 65 72 virtual bool write( quadlet_t value, const char* name = "" ); 73 virtual bool write( const char *values, size_t len, const char* name = "" ); 66 74 67 75 private: … … 80 88 81 89 virtual bool write( byte_t value, const char* name = "" ); 90 virtual bool write( uint16_t value, const char* name = "" ); 82 91 virtual bool write( quadlet_t value, const char* name = "" ); 92 virtual bool write( const char *values, size_t len, const char* name = "" ); 83 93 virtual std::string getString( ) { return m_string;}; 84 94 … … 86 96 unsigned int m_cnt; 87 97 std::string m_string; 88 98 DECLARE_DEBUG_MODULE; 89 99 }; 90 100 … … 100 110 101 111 virtual bool write( byte_t value, const char* name = "" ); 112 virtual bool write( uint16_t value, const char* name = "" ); 102 113 virtual bool write( quadlet_t value, const char* name = "" ); 114 virtual bool write( const char *values, size_t len, const char* name = "" ); 103 115 104 116 int getNrOfProducesBytes() const … … 112 124 unsigned char* m_curPos; 113 125 size_t m_length; 126 DECLARE_DEBUG_MODULE; 114 127 }; 115 128 … … 125 138 126 139 virtual bool read( byte_t* value ); 140 virtual bool read( uint16_t* value ); 127 141 virtual bool read( quadlet_t* value ); 128 142 virtual bool read( char** value, size_t length ); 129 143 virtual bool peek( byte_t* value ); 144 virtual bool peek( uint16_t* value, size_t offset ); 145 virtual bool skip( size_t length ); 130 146 131 147 int getNrOfConsumedBytes() const … … 139 155 unsigned char* m_curPos; // current read pos 140 156 size_t m_length; // size of buffer 157 DECLARE_DEBUG_MODULE; 141 158 }; 142 159 branches/echoaudio/src/Makefile.am
r475 r499 55 55 maudio/maudio_avdevice.h motu/motu_avdevice.h rme/rme_avdevice.h \ 56 56 metrichalo/mh_avdevice.h dice/dice_avdevice.h \ 57 genericavc/avc_avdevice.h \ 57 58 libavc/avc_connect.h \ 58 59 libavc/avc_definitions.h libavc/avc_extended_cmd_generic.h \ … … 61 62 libavc/avc_plug_info.h libavc/avc_serialize.h libavc/avc_signal_source.h \ 62 63 libavc/avc_subunit_info.h libavc/avc_unit_info.h \ 64 libavc/avc_descriptor.h libavc/avc_descriptor_cmd.h libavc/avc_descriptor_music.h \ 63 65 libosc/OscArgument.h libosc/OscNode.h libosc/OscResponse.h libosc/OscServer.h libosc/OscMessage.h \ 64 66 libosc/OscClient.h \ … … 85 87 libavc/avc_connect.cpp \ 86 88 libavc/avc_definitions.cpp \ 89 libavc/avc_descriptor.cpp \ 90 libavc/avc_descriptor_cmd.cpp \ 91 libavc/avc_descriptor_music.cpp \ 87 92 libavc/avc_extended_cmd_generic.cpp \ 88 93 libavc/avc_extended_plug_info.cpp \ … … 140 145 141 146 genericavc_src = \ 142 genericavc/avc_avdevice.cpp \ 143 genericavc/avc_avdevice.h 147 genericavc/avc_avdevice.cpp 144 148 145 149 motu_src = \ branches/echoaudio/tests/Makefile.am
r464 r499 32 32 33 33 if BUILD_TESTS 34 noinst_PROGRAMS += test-ffado test-extplugcmd test-fw410 \ 35 test-volume test-mixer test-cycletimer test-sytmonitor \ 36 test-timestampedbuffer test-ieee1394service test-streamdump 34 #noinst_PROGRAMS += test-ffado test-extplugcmd test-fw410 test-echo \ 35 # test-volume test-mixer test-cycletimer test-sytmonitor \ 36 # test-timestampedbuffer test-ieee1394service test-streamdump 37 noinst_PROGRAMS += test-ffado test-echo 37 38 endif 38 39 … … 43 44 $(LIBXML_LIBS) $(LIBAVC1394_LIBS) $(LIBIEC61883_LIBS) 44 45 45 test_extplugcmd_SOURCES = test-extplugcmd.cpp 46 test_extplugcmd_LDADD = $(top_builddir)/src/libffado.la \ 47 $(LIBAVC1394_LIBS) 48 49 test_volume_SOURCES = test-volume.cpp 50 test_volume_LDADD = $(top_builddir)/src/libffado.la \ 51 $(LIBAVC1394_LIBS) 52 53 test_mixer_SOURCES = test-mixer.cpp 54 test_mixer_LDADD = $(top_builddir)/src/libffado.la \ 55 $(LIBAVC1394_LIBS) 56 57 test_fw410_SOURCES = test-fw410.cpp 58 test_fw410_LDADD = $(LIBAVC1394_LIBS) $(LIBIEC61883_LIBS) -lrom1394 59 60 test_streamdump_SOURCES = test-streamdump.cpp 61 test_streamdump_LDADD = $(LIBAVC1394_LIBS) $(LIBIEC61883_LIBS) -lrom1394 62 63 test_ieee1394service_SOURCES = test-ieee1394service.cpp 64 test_ieee1394service_LDADD = $(top_builddir)/src/libffado.la \ 65 $(LIBAVC1394_LIBS) $(LIBIEC61883_LIBS) -lrom1394 46 # test_extplugcmd_SOURCES = test-extplugcmd.cpp 47 # test_extplugcmd_LDADD = $(top_builddir)/src/libffado.la \ 48 # $(LIBAVC1394_LIBS) 49 # 50 # test_volume_SOURCES = test-volume.cpp 51 # test_volume_LDADD = $(top_builddir)/src/libffado.la \ 52 # $(LIBAVC1394_LIBS) 53 # 54 # test_mixer_SOURCES = test-mixer.cpp 55 # test_mixer_LDADD = $(top_builddir)/src/libffado.la \ 56 # $(LIBAVC1394_LIBS) 57 # 58 # test_fw410_SOURCES = test-fw410.cpp 59 # test_fw410_LDADD = $(LIBAVC1394_LIBS) $(LIBIEC61883_LIBS) -lrom1394 60 # 61 test_echo_SOURCES = test-echo.cpp 62 test_echo_LDADD = $(LIBAVC1394_LIBS) $(LIBIEC61883_LIBS) $(LIBRAW1394_LIBS) -lrom1394 63 # 64 # test_streamdump_SOURCES = test-streamdump.cpp 65 # test_streamdump_LDADD = $(LIBAVC1394_LIBS) $(LIBIEC61883_LIBS) -lrom1394 66 # 67 # test_ieee1394service_SOURCES = test-ieee1394service.cpp 68 # test_ieee1394service_LDADD = $(top_builddir)/src/libffado.la \ 69 # $(LIBAVC1394_LIBS) $(LIBIEC61883_LIBS) -lrom1394 66 70 67 71 #TESTS_ENVIRONMENT 68 TEST = test-ffado 69 70 test_cycletimer_LDADD = $(top_builddir)/src/libffado.la $(LIBIEC61883_LIBS) \71 $(LIBRAW1394_LIBS) $(LIBAVC1394_LIBS)72 test_cycletimer_SOURCES = test-cycletimer.cpp73 74 test_sytmonitor_LDADD = $(top_builddir)/src/libffado.la $(LIBIEC61883_LIBS) \75 $(LIBRAW1394_LIBS) $(LIBAVC1394_LIBS)76 test_sytmonitor_SOURCES = test-sytmonitor.cpp SytMonitor.cpp \77 SytMonitor.h78 79 test_timestampedbuffer_LDADD = $(top_builddir)/src/libffado.la $(LIBIEC61883_LIBS) \80 $(LIBRAW1394_LIBS) $(LIBAVC1394_LIBS)81 test_timestampedbuffer_SOURCES = test-timestampedbuffer.cpp72 TEST = test-ffado test-echo 73 # 74 # test_cycletimer_LDADD = $(top_builddir)/src/libffado.la $(LIBIEC61883_LIBS) \ 75 # $(LIBRAW1394_LIBS) $(LIBAVC1394_LIBS) 76 # test_cycletimer_SOURCES = test-cycletimer.cpp 77 # 78 # test_sytmonitor_LDADD = $(top_builddir)/src/libffado.la $(LIBIEC61883_LIBS) \ 79 # $(LIBRAW1394_LIBS) $(LIBAVC1394_LIBS) 80 # test_sytmonitor_SOURCES = test-sytmonitor.cpp SytMonitor.cpp \ 81 # SytMonitor.h 82 # 83 # test_timestampedbuffer_LDADD = $(top_builddir)/src/libffado.la $(LIBIEC61883_LIBS) \ 84 # $(LIBRAW1394_LIBS) $(LIBAVC1394_LIBS) 85 # test_timestampedbuffer_SOURCES = test-timestampedbuffer.cpp branches/echoaudio/tests/test-ffado.cpp
r475 r499 193 193 static struct argp argp = { options, parse_opt, args_doc, doc }; 194 194 195 int exitfunction( int retval ) { 196 debugOutput( DEBUG_LEVEL_NORMAL, "Debug output flushed...\n" ); 197 flushDebugOutput(); 198 199 return retval; 200 } 201 195 202 int 196 203 main( int argc, char **argv ) … … 207 214 arguments.args[1] = ""; 208 215 216 setDebugLevel(arguments.verbose); 217 209 218 // Parse our arguments; every option seen by `parse_opt' will 210 219 // be reflected in `arguments'. 211 220 if ( argp_parse ( &argp, argc, argv, 0, 0, &arguments ) ) { 212 221 fprintf( stderr, "Could not parse command line\n" ); 213 return -1;222 return exitfunction(-1); 214 223 } 215 224 … … 222 231 if ( !m_deviceManager ) { 223 232 fprintf( stderr, "Could not allocate device manager\n" ); 224 return -1;233 return exitfunction(-1); 225 234 } 226 235 if ( arguments.verbose ) { … … 230 239 fprintf( stderr, "Could not initialize device manager\n" ); 231 240 delete m_deviceManager; 232 return -1;241 return exitfunction(-1); 233 242 } 234 243 if ( arguments.verbose ) { … … 238 247 fprintf( stderr, "Could not discover devices\n" ); 239 248 delete m_deviceManager; 240 return -1;249 return exitfunction(-1); 241 250 } 242 251 delete m_deviceManager; 243 return 0;252 return exitfunction(0); 244 253 } else if ( strcmp( arguments.args[0], "SetSamplerate" ) == 0 ) { 245 254 char* tail; … … 247 256 if ( errno ) { 248 257 fprintf( stderr, "Could not parse samplerate argument\n" ); 249 return -1;258 return exitfunction(-1); 250 259 } 251 260 … … 253 262 if ( !m_deviceManager ) { 254 263 fprintf( stderr, "Could not allocate device manager\n" ); 255 return -1;264 return exitfunction(-1); 256 265 } 257 266 if ( arguments.verbose ) { … … 261 270 fprintf( stderr, "Could not initialize device manager\n" ); 262 271 delete m_deviceManager; 263 return -1;272 return exitfunction(-1); 264 273 } 265 274 if ( arguments.verbose ) { … … 269 278 fprintf( stderr, "Could not discover devices\n" ); 270 279 delete m_deviceManager; 271 return -1;280 return exitfunction(-1); 272 281 } 273 282 … … 299 308 } 300 309 delete m_deviceManager; 301 return 0;310 return exitfunction(0); 302 311 } else if ( strcmp( arguments.args[0], "ListOscSpace" ) == 0 ) { 303 312 // list osc space by using OSC messages … … 320 329 if ( !m_deviceManager ) { 321 330 fprintf( stderr, "Could not allocate device manager\n" ); 322 return -1;331 return exitfunction(-1); 323 332 } 324 333 if ( !m_deviceManager->initialize( arguments.port ) ) { 325 334 fprintf( stderr, "Could not initialize device manager\n" ); 326 335 delete m_deviceManager; 327 return -1;336 return exitfunction(-1); 328 337 } 329 338 if ( arguments.verbose ) { … … 333 342 fprintf( stderr, "Could not discover devices\n" ); 334 343 delete m_deviceManager; 335 return -1;344 return exitfunction(-1); 336 345 } 337 346 … … 351 360 printf("server stopped\n"); 352 361 delete m_deviceManager; 353 return 0;362 return exitfunction(0); 354 363 355 364 } else {