Changeset 447
- Timestamp:
- 04/08/07 04:28:58 (16 years ago)
- Files:
-
- trunk/libffado/src/bebob/bebob_avplug.cpp (modified) (1 diff)
- trunk/libffado/tests/test-mixer.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/bebob/bebob_avplug.cpp
r445 r447 1964 1964 AvPlug* plug = *it; 1965 1965 if ( plug->getFunctionBlockType() != 0xff ) { 1966 std::ostringstream strstrm; 1967 switch(plug->getFunctionBlockType()) { 1968 case 0x80: 1969 strstrm << "Selector FB"; 1970 break; 1971 case 0x81: 1972 strstrm << "Feature FB"; 1973 break; 1974 case 0x82: 1975 strstrm << "Processing FB"; 1976 break; 1977 case 0x83: 1978 strstrm << "CODEC FB"; 1979 break; 1980 default: 1981 strstrm << plug->getFunctionBlockType(); 1982 } 1983 1966 1984 if ( plug->getPlugDirection() == AvPlug::eAPD_Input ) { 1967 printf( "\t\"(%d) %s\" -> \"( 0x%02x,%d)\"\n",1985 printf( "\t\"(%d) %s\" -> \"(%s, ID %d)\"\n", 1968 1986 plug->getGlobalId(), 1969 1987 plug->getName(), 1970 plug->getFunctionBlockType(),1988 strstrm.str().c_str(), 1971 1989 plug->getFunctionBlockId() ); 1972 1990 } else { 1973 printf( "\t\"( 0x%02x,%d)\" -> \t\"(%d) %s\"\n",1974 plug->getFunctionBlockType(),1991 printf( "\t\"(%s, ID %d)\" -> \t\"(%d) %s\"\n", 1992 strstrm.str().c_str(), 1975 1993 plug->getFunctionBlockId(), 1976 1994 plug->getGlobalId(), trunk/libffado/tests/test-mixer.cpp
r445 r447 25 25 #include "libavc/avc_function_block.h" 26 26 #include "libavc/avc_serialize.h" 27 #include "debugmodule/debugmodule.h" 27 28 28 29 #include "libieee1394/ieee1394service.h" 30 #include <string.h> 31 32 DECLARE_GLOBAL_DEBUG_MODULE; 29 33 30 34 const bool bVerbose = true; … … 42 46 fbCmd.m_pFBProcessing->m_pEnhancedMixer = new FunctionBlockProcessingEnhancedMixer; 43 47 44 fbCmd.m_pFBProcessing->m_fbInputPlugNumber = 0x01; 48 debugOutput(DEBUG_LEVEL_NORMAL, "Requesting mixer programmable state...\n"); 49 50 fbCmd.m_pFBProcessing->m_fbInputPlugNumber = 0x00; 45 51 fbCmd.m_pFBProcessing->m_inputAudioChannelNumber = 0xff; 46 52 fbCmd.m_pFBProcessing->m_outputAudioChannelNumber = 0xff; 47 53 fbCmd.m_pFBProcessing->m_pEnhancedMixer->m_statusSelector 48 54 = FunctionBlockProcessingEnhancedMixer::eSS_ProgramableState; 49 // fbCmd.m_pFBProcessing->m_pEnhancedMixer->m_statusSelector50 // = FunctionBlockProcessingEnhancedMixer::eSS_Level;51 55 52 56 fbCmd.setVerbose( bVerbose ); … … 56 60 57 61 if ( !fbCmd.fire() ) { 58 printf( "cmd failed\n" ); 62 debugError( "cmd failed\n" ); 63 } 64 65 if ( bVerbose ) { 66 CoutSerializer se; 67 fbCmd.serialize( se ); 68 } 69 70 debugOutput(DEBUG_LEVEL_NORMAL, "Requesting mixer level state...\n"); 71 72 fbCmd.m_pFBProcessing->m_fbInputPlugNumber = 0x00; 73 fbCmd.m_pFBProcessing->m_inputAudioChannelNumber = 0x00; 74 fbCmd.m_pFBProcessing->m_outputAudioChannelNumber = 0x00; 75 fbCmd.m_pFBProcessing->m_pEnhancedMixer->m_statusSelector 76 = FunctionBlockProcessingEnhancedMixer::eSS_Level; 77 78 if ( !fbCmd.fire() ) { 79 debugError( "cmd failed\n" ); 80 } 81 82 if ( bVerbose ) { 83 CoutSerializer se; 84 fbCmd.serialize( se ); 85 } 86 87 return true; 88 } 89 90 bool 91 doApp2( Ieee1394Service& ieee1394service, int node_id, int fb_id ) 92 { 93 FunctionBlockCmd fbCmd( ieee1394service, 94 FunctionBlockCmd::eFBT_Selector, 95 fb_id, 96 FunctionBlockCmd::eCA_Current ); 97 fbCmd.setNodeId( node_id ); 98 fbCmd.setSubunitId( 0x00 ); 99 fbCmd.setCommandType( AVCCommand::eCT_Status ); 100 fbCmd.m_pFBSelector->m_inputFbPlugNumber=0; 101 102 debugOutput(DEBUG_LEVEL_NORMAL, "Requesting selector state...\n"); 103 104 fbCmd.setVerbose( bVerbose ); 105 if (bVerbose) { 106 ieee1394service.setVerboseLevel( DEBUG_LEVEL_VERY_VERBOSE ); 107 } 108 109 if ( !fbCmd.fire() ) { 110 debugError( "cmd failed\n" ); 111 } 112 113 if ( bVerbose ) { 114 CoutSerializer se; 115 fbCmd.serialize( se ); 116 } 117 118 return true; 119 } 120 121 bool 122 doApp3( Ieee1394Service& ieee1394service, int node_id, int fb_id , int val ) 123 { 124 FunctionBlockCmd fbCmd( ieee1394service, 125 FunctionBlockCmd::eFBT_Selector, 126 fb_id, 127 FunctionBlockCmd::eCA_Current ); 128 fbCmd.setNodeId( node_id ); 129 fbCmd.setSubunitId( 0x00 ); 130 fbCmd.setCommandType( AVCCommand::eCT_Control ); 131 fbCmd.m_pFBSelector->m_inputFbPlugNumber=val; 132 133 debugOutput(DEBUG_LEVEL_NORMAL, "Setting selector state to %d...\n", val); 134 135 fbCmd.setVerbose( bVerbose ); 136 if (bVerbose) { 137 ieee1394service.setVerboseLevel( DEBUG_LEVEL_VERY_VERBOSE ); 138 } 139 140 if ( !fbCmd.fire() ) { 141 debugError( "cmd failed\n" ); 59 142 } 60 143 … … 75 158 76 159 if (argc < 3) { 77 printf("usage: PORT NODE_ID FB_ID\n");160 debugError("usage: PORT NODE_ID FB_ID\n"); 78 161 exit(0); 79 162 } … … 86 169 87 170 if (errno) { 88 perror("argument parsing failed:");171 debugError("argument parsing failed: %s", strerror(errno)); 89 172 return -1; 90 173 } 91 174 Ieee1394Service ieee1394service; 92 175 if ( !ieee1394service.initialize( port ) ) { 93 fprintf( stderr,"could not set port on ieee1394service\n" );176 debugError( "could not set port on ieee1394service\n" ); 94 177 return -1; 95 178 } 96 179 97 180 doApp( ieee1394service, node_id, fb_id ); 181 doApp2( ieee1394service, node_id, fb_id ); 182 doApp3( ieee1394service, node_id, fb_id , 0 ); 183 sleep(1); 184 doApp3( ieee1394service, node_id, fb_id , 1 ); 185 sleep(1); 186 doApp3( ieee1394service, node_id, fb_id , 0 ); 98 187 99 188 return 0;