Changeset 599
- Timestamp:
- 08/29/07 14:17:58 (16 years ago)
- Files:
-
- trunk/libffado/config.h.in (modified) (1 diff)
- trunk/libffado/src/bebob/bebob_avdevice.cpp (modified) (4 diffs)
- trunk/libffado/src/bebob/ffado_driver_bebob.txt (added)
- trunk/libffado/src/fireworks/ffado_driver_fireworks.txt (added)
- trunk/libffado/src/fireworks/fireworks_device.cpp (modified) (5 diffs)
- trunk/libffado/src/genericavc/avc_avdevice.cpp (modified) (5 diffs)
- trunk/libffado/src/genericavc/avc_vendormodel.cpp (modified) (3 diffs)
- trunk/libffado/src/genericavc/avc_vendormodel.h (modified) (2 diffs)
- trunk/libffado/src/genericavc/ffado_driver_genericavc.txt (added)
- trunk/libffado/src/SConscript (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/config.h.in
r598 r599 27 27 #define CACHEDIR "$cachedir" 28 28 29 #define SHAREDIR "$sharedir" trunk/libffado/src/bebob/bebob_avdevice.cpp
r587 r599 54 54 namespace BeBoB { 55 55 56 static GenericAVC::VendorModelEntry supportedDeviceList[] =57 {58 {FW_VENDORID_MACKIE, 0x00010065, "Mackie", "Onyx Firewire"},59 60 {FW_VENDORID_APOGEE, 0x00010048, "Apogee Electronics", "Rosetta 200"},61 62 {FW_VENDORID_BRIDGECO, 0x00010048, "BridgeCo", "RD Audio1"},63 64 {FW_VENDORID_PRESONUS, 0x00010000, "PreSonus", "FIREBOX"},65 {FW_VENDORID_PRESONUS, 0x00010066, "PreSonus", "FirePOD"},66 67 {FW_VENDORID_TERRATEC, 0x00000003, "TerraTec Electronic GmbH", "Phase 88 FW"},68 {FW_VENDORID_TERRATEC, 0x00000004, "TerraTec Electronic GmbH", "Phase X24 FW (model version 4)"},69 {FW_VENDORID_TERRATEC, 0x00000007, "TerraTec Electronic GmbH", "Phase X24 FW (model version 7)"},70 71 {FW_VENDORID_ESI, 0x00010064, "ESI", "Quatafire 610"},72 73 {FW_VENDORID_FOCUSRITE, 0x00000000, "Focusrite", "Saffire (LE)"},74 {FW_VENDORID_FOCUSRITE, 0x00000003, "Focusrite", "Saffire Pro26IO"},75 {FW_VENDORID_FOCUSRITE, 0x00000006, "Focusrite", "Saffire Pro10IO"},76 77 {FW_VENDORID_EDIROL, 0x00010048, "EDIROL", "FA-101"},78 {FW_VENDORID_EDIROL, 0x00010049, "EDIROL", "FA-66"},79 80 {FW_VENDORID_MAUDIO, 0x00010062, "M-Audio", "FW Solo"},81 {FW_VENDORID_MAUDIO, 0x00010081, "M-Audio", "NRV10"},82 };83 84 56 AvDevice::AvDevice( Ieee1394Service& ieee1394service, 85 57 std::auto_ptr< ConfigRom >( configRom ) ) … … 104 76 unsigned int modelId = configRom.getModelId(); 105 77 106 //GenericAVC::VendorModel vendorModel( "/home/wagi/src/libffado/src/bebob/ffado_driver_bebob.txt" ); 107 108 for ( unsigned int i = 0; 109 i < ( sizeof( supportedDeviceList )/sizeof( GenericAVC::VendorModelEntry ) ); 110 ++i ) 111 { 112 if ( ( supportedDeviceList[i].vendor_id == vendorId ) 113 && ( supportedDeviceList[i].model_id == modelId ) ) 114 { 115 return true; 116 } 117 } 78 GenericAVC::VendorModel vendorModel( SHAREDIR "/ffado_driver_bebob.txt" ); 79 if ( vendorModel.parse() ) { 80 vendorModel.printTable(); 81 return vendorModel.find( vendorId, modelId ); 82 } 83 118 84 return false; 119 85 } … … 126 92 unsigned int modelId = configRom->getModelId(); 127 93 return new Focusrite::SaffireProDevice(ieee1394Service, configRom); 128 94 129 95 switch (vendorId) { 130 96 case FW_VENDORID_TERRATEC: … … 150 116 unsigned int modelId = m_pConfigRom->getModelId(); 151 117 152 for ( unsigned int i = 0; 153 i < ( sizeof( supportedDeviceList )/sizeof( GenericAVC::VendorModelEntry ) ); 154 ++i ) 155 { 156 if ( ( supportedDeviceList[i].vendor_id == vendorId ) 157 && ( supportedDeviceList[i].model_id == modelId ) 158 ) 159 { 160 m_model = &(supportedDeviceList[i]); 161 break; 162 } 118 GenericAVC::VendorModel vendorModel( SHAREDIR "/ffado_driver_bebob.txt" ); 119 if ( vendorModel.parse() ) { 120 m_model = vendorModel.find( vendorId, modelId ); 163 121 } 164 122 165 123 if (m_model != NULL) { 166 124 debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n", 167 m_model->vendor_name, m_model->model_name); 125 m_model->vendor_name.c_str(), 126 m_model->model_name.c_str()); 168 127 } else return false; 169 128 trunk/libffado/src/fireworks/fireworks_device.cpp
r589 r599 29 29 #include "libieee1394/ieee1394service.h" 30 30 31 #include "config.h" 32 31 33 // FireWorks is the platform used and developed by ECHO AUDIO 32 34 namespace FireWorks { 33 34 // to define the supported devices35 static GenericAVC::VendorModelEntry supportedDeviceList[] =36 {37 {FW_VENDORID_ECHO, 0x00000af2, "Echo", "AudioFire2"},38 };39 35 40 36 Device::Device( Ieee1394Service& ieee1394Service, … … 64 60 unsigned int modelId = configRom.getModelId(); 65 61 66 for ( unsigned int i = 0; 67 i < ( sizeof( supportedDeviceList )/sizeof( GenericAVC::VendorModelEntry ) ); 68 ++i ) 69 { 70 if ( ( supportedDeviceList[i].vendor_id == vendorId ) 71 && ( supportedDeviceList[i].model_id == modelId ) 72 ) 73 { 74 return true; 75 } 62 GenericAVC::VendorModel vendorModel( SHAREDIR "/ffado_driver_fireworks.txt" ); 63 if ( vendorModel.parse() ) { 64 vendorModel.printTable(); 65 return vendorModel.find( vendorId, modelId ); 76 66 } 77 67 … … 85 75 unsigned int modelId = m_pConfigRom->getModelId(); 86 76 87 for ( unsigned int i = 0; 88 i < ( sizeof( supportedDeviceList )/sizeof( GenericAVC::VendorModelEntry ) ); 89 ++i ) 90 { 91 if ( ( supportedDeviceList[i].vendor_id == vendorId ) 92 && ( supportedDeviceList[i].model_id == modelId ) 93 ) 94 { 95 m_model = &(supportedDeviceList[i]); 96 } 77 GenericAVC::VendorModel vendorModel( SHAREDIR "/ffado_driver_bebob.txt" ); 78 if ( vendorModel.parse() ) { 79 m_model = vendorModel.find( vendorId, modelId ); 97 80 } 98 81 … … 101 84 } 102 85 debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n", 103 m_model->vendor_name , m_model->model_name);86 m_model->vendor_name.c_str(), m_model->model_name.c_str()); 104 87 105 88 if ( !GenericAVC::AvDevice::discover() ) { … … 117 100 unsigned int vendorId = configRom->getNodeVendorId(); 118 101 unsigned int modelId = configRom->getModelId(); 119 102 120 103 switch(vendorId) { 121 104 case FW_VENDORID_ECHO: return new ECHO::AudioFire(ieee1394Service, configRom ); trunk/libffado/src/genericavc/avc_avdevice.cpp
r589 r599 35 35 #include "debugmodule/debugmodule.h" 36 36 37 #include "config.h" 38 37 39 #include <string> 38 40 #include <stdint.h> … … 50 52 IMPL_DEBUG_MODULE( AvDevice, AvDevice, DEBUG_LEVEL_VERBOSE ); 51 53 52 // to define the supported devices53 static VendorModelEntry supportedDeviceList[] =54 {55 56 };57 54 58 55 AvDevice::AvDevice( Ieee1394Service& ieee1394Service, … … 78 75 unsigned int modelId = configRom.getModelId(); 79 76 80 for ( unsigned int i = 0; 81 i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) ); 82 ++i ) 83 { 84 if ( ( supportedDeviceList[i].vendor_id == vendorId ) 85 && ( supportedDeviceList[i].model_id == modelId ) 86 ) 87 { 88 return true; 89 } 77 GenericAVC::VendorModel vendorModel( SHAREDIR "/ffado_driver_genericavc.txt" ); 78 if ( vendorModel.parse() ) { 79 vendorModel.printTable(); 80 return vendorModel.find( vendorId, modelId ); 90 81 } 91 82 … … 239 230 { 240 231 FFADODevice::showDevice(); 241 232 242 233 debugOutput(DEBUG_LEVEL_NORMAL, 243 "%s %s\n", m_model->vendor_name , m_model->model_name);234 "%s %s\n", m_model->vendor_name.c_str(), m_model->model_name.c_str()); 244 235 245 236 AVC::Unit::show(); … … 418 409 ); 419 410 break; 420 411 421 412 case ExtendedPlugInfoClusterInfoSpecificData::ePT_NoType: 422 413 default: trunk/libffado/src/genericavc/avc_vendormodel.cpp
r558 r599 28 28 #include <iostream> 29 29 #include <iterator> 30 #include <cerrno> 31 #include <functional> 32 #include <algorithm> 30 33 31 34 using namespace std; … … 52 55 } 53 56 57 //------------------------------------------------- 58 59 GenericAVC::VendorModelEntry::VendorModelEntry() 60 : vendor_id( 0 ) 61 , model_id( 0 ) 62 { 63 } 64 65 GenericAVC::VendorModelEntry::VendorModelEntry( const VendorModelEntry& rhs ) 66 : vendor_id( rhs.vendor_id ) 67 , model_id( rhs.model_id ) 68 , vendor_name( rhs.vendor_name ) 69 , model_name( rhs.model_name ) 70 { 71 } 72 73 GenericAVC::VendorModelEntry& 74 GenericAVC::VendorModelEntry::operator = ( const VendorModelEntry& rhs ) 75 { 76 // check for assignment to self 77 if ( this == &rhs ) return *this; 78 79 vendor_id = rhs.vendor_id; 80 model_id = rhs.model_id; 81 vendor_name = rhs.vendor_name; 82 model_name = rhs.model_name; 83 84 return *this; 85 } 86 87 GenericAVC::VendorModelEntry::~VendorModelEntry() 88 { 89 } 90 54 91 GenericAVC::VendorModel::VendorModel( const char* filename ) 55 { 56 ifstream in ( filename ); 92 : m_filename( filename ) 93 { 94 } 95 96 GenericAVC::VendorModel::~VendorModel() 97 { 98 } 99 100 101 bool 102 GenericAVC::VendorModel::parse() 103 { 104 ifstream in ( m_filename.c_str() ); 57 105 58 106 if ( !in ) { 59 perror( filename ); 60 return; 61 } 62 63 cout << "vendorId\t\tmodelId\t\tvendorName\t\tmodelName" << endl; 107 perror( m_filename.c_str() ); 108 return false; 109 } 110 64 111 string line; 65 112 while ( !getline( in, line ).eof() ) { 66 113 string::size_type i = line.find_first_not_of( " \t\n\v" ); 67 114 if ( i != string::npos && line[i] == '#' ) 115 // this line starts with a '#' -> comment 68 116 continue; 69 117 … … 71 119 tokenize( line, tokens, "," ); 72 120 73 for ( vector<string>::iterator it = tokens.begin(); 74 it != tokens.end(); 75 ++it ) 76 { 77 string vendorId = *it++; 78 string modelId = *it++; 79 string vendorName = *it++; 80 string modelName= *it; 81 cout << vendorId << "\t" << modelId << "\t" <<vendorName << "\t" << modelName << endl; 82 } 121 if ( tokens.size() < 4 ) 122 // ignore this line, it has not all needed mandatory entries 123 continue; 124 125 VendorModelEntry vme; 126 vector<string>::const_iterator it = tokens.begin(); 127 char* tail; 128 129 errno = 0; 130 vme.vendor_id = strtol( it++->c_str(), &tail, 0 ); 131 vme.model_id = strtol( it++->c_str(), &tail, 0 ); 132 vme.vendor_name = *it++; 133 vme.model_name = *it++; 134 135 if ( errno ) 136 // string -> int conversion failed 137 continue; 138 139 vector<string>::const_iterator end = tokens.end(); 140 if ( it != end ) 141 handleAdditionalEntries( vme, tokens, it, end ); 142 143 m_vendorModelEntries.push_back( vme ); 83 144 } 84 145 85 146 if ( !in.eof() ) { 86 cout << "GenericAVC::VendorModel::VendorModel: error in parsing" << endl; 87 } 88 } 89 90 GenericAVC::VendorModel::~VendorModel() 91 { 92 for ( VendorModelEntryVector::iterator it = m_vendorModelEntries.begin(); 147 cerr << "GenericAVC::VendorModel::VendorModel: error in parsing" << endl; 148 return false; 149 } 150 151 return true; 152 } 153 154 bool 155 GenericAVC::VendorModel::printTable() const 156 { 157 // Some debug output 158 cout << "vendorId\t\tmodelId\t\tvendorName\t\t\t\tmodelName" << endl; 159 for ( VendorModelEntryVector::const_iterator it = m_vendorModelEntries.begin(); 93 160 it != m_vendorModelEntries.end(); 94 161 ++it ) 95 162 { 96 delete *it; 97 } 163 cout << it->vendor_id << "\t\t\t" 164 << it->model_id << "\t" 165 << it->vendor_name << "\t" 166 << it->model_name << endl; 167 } 168 return true; 169 } 170 171 bool 172 GenericAVC::VendorModel::handleAdditionalEntries(VendorModelEntry& vme, 173 vector<string>& v, 174 vector<string>::const_iterator& b, 175 vector<string>::const_iterator& e ) 176 { 177 return true; 178 } 179 180 class is_same : public unary_function<GenericAVC::VendorModelEntry, bool> { 181 public: 182 is_same( unsigned int vendor_id, unsigned model_id ) 183 : m_vendor_id( vendor_id ) 184 , m_model_id( model_id ) 185 {} 186 187 bool operator () ( const GenericAVC::VendorModelEntry& vme ) const { 188 return vme.vendor_id == m_vendor_id && vme.model_id == m_model_id; 189 } 190 191 private: 192 unsigned int m_vendor_id; 193 unsigned int m_model_id; 194 }; 195 196 GenericAVC::VendorModelEntry* 197 GenericAVC::VendorModel::find( unsigned int vendor_id, unsigned model_id ) 198 { 199 VendorModelEntryVector::iterator it = 200 find_if ( m_vendorModelEntries.begin(), 201 m_vendorModelEntries.end(), 202 is_same( vendor_id, model_id ) ); 203 if ( it != m_vendorModelEntries.end() ) 204 return &*it; 205 206 return 0; 98 207 } 99 208 trunk/libffado/src/genericavc/avc_vendormodel.h
r557 r599 25 25 #define GENERICAVC_VENDORMODEL_H 26 26 27 #include <string> 27 28 #include <vector> 28 29 … … 31 32 // struct to define the supported devices 32 33 struct VendorModelEntry { 34 VendorModelEntry(); 35 VendorModelEntry(const VendorModelEntry& rhs); 36 VendorModelEntry& operator = (const VendorModelEntry& rhs); 37 virtual ~VendorModelEntry(); 38 33 39 unsigned int vendor_id; 34 40 unsigned int model_id; 35 char *vendor_name;36 char *model_name;41 std::string vendor_name; 42 std::string model_name; 37 43 }; 38 44 39 typedef std::vector<VendorModelEntry *> VendorModelEntryVector;45 typedef std::vector<VendorModelEntry> VendorModelEntryVector; 40 46 41 47 class VendorModel { 42 48 public: 43 49 VendorModel( const char* filename ); 44 ~VendorModel(); 50 virtual ~VendorModel(); 51 52 virtual bool parse(); 53 virtual bool printTable() const; 54 virtual bool handleAdditionalEntries(VendorModelEntry& vme, 55 std::vector<std::string>& v, 56 std::vector<std::string>::const_iterator& b, 57 std::vector<std::string>::const_iterator& e ); 58 VendorModelEntry* find( unsigned int vendor_id, unsigned model_id ); 45 59 46 60 const VendorModelEntryVector& getVendorModelEntries() const; 47 61 private: 62 std::string m_filename; 48 63 VendorModelEntryVector m_vendorModelEntries; 49 64 }; trunk/libffado/src/SConscript
r594 r599 91 91 maudio/fw410.xml \ 92 92 maudio/fwap.xml \ 93 bebob/ffado_driver_bebob.txt \ 93 94 ' ) 94 95 … … 98 99 ' ) 99 100 101 genericavc_pkgdata = env.Split( '\ 102 genericavc/ffado_driver_genericavc.txt \ 103 ' ) 104 100 105 fireworks_source = env.Split( '\ 101 106 fireworks/fireworks_device.cpp \ 102 107 fireworks/audiofire/audiofire_device.cpp \ 108 ' ) 109 110 fireworks_pkgdata = env.Split( '\ 111 fireworks/ffado_driver_fireworks.txt \ 103 112 ' ) 104 113 … … 210 219 libenv.Alias( "install", libenv.Install( "$sharedir", data ) ) 211 220 221 for data in genericavc_pkgdata: 222 libenv.Alias( "install", libenv.Install( "$sharedir", data ) ) 223 224 for data in fireworks_pkgdata: 225 libenv.Alias( "install", libenv.Install( "$sharedir", data ) ) 226 212 227 # 213 228 # For the debugging apps