Changeset 607
- Timestamp:
- 08/31/07 01:56:53 (16 years ago)
- Files:
-
- trunk/libffado/src/bebob/bebob_avdevice.cpp (modified) (2 diffs)
- trunk/libffado/src/fireworks/fireworks_device.cpp (modified) (2 diffs)
- trunk/libffado/src/genericavc/avc_avdevice.cpp (modified) (4 diffs)
- trunk/libffado/src/genericavc/avc_avdevice.h (modified) (1 diff)
- trunk/libffado/src/genericavc/avc_vendormodel.cpp (modified) (3 diffs)
- trunk/libffado/src/genericavc/avc_vendormodel.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/bebob/bebob_avdevice.cpp
r599 r607 79 79 if ( vendorModel.parse() ) { 80 80 vendorModel.printTable(); 81 return vendorModel. find( vendorId, modelId );81 return vendorModel.isPresent( vendorId, modelId ); 82 82 } 83 83 … … 121 121 } 122 122 123 if ( m_model != NULL) {123 if (GenericAVC::VendorModel::isValid(m_model)) { 124 124 debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n", 125 m_model ->vendor_name.c_str(),126 m_model ->model_name.c_str());125 m_model.vendor_name.c_str(), 126 m_model.model_name.c_str()); 127 127 } else return false; 128 128 trunk/libffado/src/fireworks/fireworks_device.cpp
r599 r607 63 63 if ( vendorModel.parse() ) { 64 64 vendorModel.printTable(); 65 return vendorModel. find( vendorId, modelId );65 return vendorModel.isPresent( vendorId, modelId ); 66 66 } 67 67 … … 75 75 unsigned int modelId = m_pConfigRom->getModelId(); 76 76 77 GenericAVC::VendorModel vendorModel( SHAREDIR "/ffado_driver_ bebob.txt" );77 GenericAVC::VendorModel vendorModel( SHAREDIR "/ffado_driver_fireworks.txt" ); 78 78 if ( vendorModel.parse() ) { 79 79 m_model = vendorModel.find( vendorId, modelId ); 80 80 } 81 81 82 if ( m_model == NULL) {82 if (!GenericAVC::VendorModel::isValid(m_model)) { 83 83 return false; 84 84 } 85 85 debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n", 86 m_model ->vendor_name.c_str(), m_model->model_name.c_str());86 m_model.vendor_name.c_str(), m_model.model_name.c_str()); 87 87 88 88 if ( !GenericAVC::AvDevice::discover() ) { trunk/libffado/src/genericavc/avc_avdevice.cpp
r599 r607 56 56 std::auto_ptr<ConfigRom>( configRom )) 57 57 : FFADODevice( ieee1394Service, configRom ) 58 , m_model( NULL )59 60 58 { 61 59 debugOutput( DEBUG_LEVEL_VERBOSE, "Created GenericAVC::AvDevice (NodeID %d)\n", … … 78 76 if ( vendorModel.parse() ) { 79 77 vendorModel.printTable(); 80 return vendorModel. find( vendorId, modelId );78 return vendorModel.isPresent( vendorId, modelId ); 81 79 } 82 80 … … 94 92 AvDevice::discover() 95 93 { 94 // check if we already have a valid VendorModel entry 95 // e.g. because a subclass called this function 96 if (!GenericAVC::VendorModel::isValid(m_model)) { 97 unsigned int vendorId = m_pConfigRom->getNodeVendorId(); 98 unsigned int modelId = m_pConfigRom->getModelId(); 99 100 GenericAVC::VendorModel vendorModel( SHAREDIR "/ffado_driver_genericavc.txt" ); 101 if ( vendorModel.parse() ) { 102 m_model = vendorModel.find( vendorId, modelId ); 103 } 104 105 if (!GenericAVC::VendorModel::isValid(m_model)) { 106 return false; 107 } 108 debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n", 109 m_model.vendor_name.c_str(), m_model.model_name.c_str()); 110 } 111 96 112 if ( !Unit::discover() ) { 97 113 debugError( "Could not discover unit\n" ); … … 232 248 233 249 debugOutput(DEBUG_LEVEL_NORMAL, 234 "%s %s\n", m_model ->vendor_name.c_str(), m_model->model_name.c_str());250 "%s %s\n", m_model.vendor_name.c_str(), m_model.model_name.c_str()); 235 251 236 252 AVC::Unit::show(); trunk/libffado/src/genericavc/avc_avdevice.h
r583 r607 85 85 AVC::ESamplingFrequency samplingFrequency );*/ 86 86 87 struct VendorModelEntry *m_model;87 struct VendorModelEntry m_model; 88 88 89 89 // streaming stuff trunk/libffado/src/genericavc/avc_vendormodel.cpp
r599 r607 83 83 84 84 return *this; 85 } 86 87 bool 88 GenericAVC::VendorModelEntry::operator == ( const VendorModelEntry& rhs ) const 89 { 90 bool equal=true; 91 92 equal &= (vendor_id == rhs.vendor_id); 93 equal &= (model_id == rhs.model_id); 94 equal &= (vendor_name == rhs.vendor_name); 95 equal &= (model_name == rhs.model_name); 96 97 return equal; 85 98 } 86 99 … … 194 207 }; 195 208 196 GenericAVC::VendorModelEntry *209 GenericAVC::VendorModelEntry 197 210 GenericAVC::VendorModel::find( unsigned int vendor_id, unsigned model_id ) 198 211 { … … 202 215 is_same( vendor_id, model_id ) ); 203 216 if ( it != m_vendorModelEntries.end() ) 204 return &*it; 205 206 return 0; 217 return *it; 218 219 struct VendorModelEntry invalid; 220 return invalid; 221 } 222 223 bool 224 GenericAVC::VendorModel::isPresent( unsigned int vendor_id, unsigned model_id ) 225 { 226 VendorModelEntryVector::iterator it = 227 find_if ( m_vendorModelEntries.begin(), 228 m_vendorModelEntries.end(), 229 is_same( vendor_id, model_id ) ); 230 if ( it != m_vendorModelEntries.end() ) 231 return true; 232 233 return false; 234 } 235 236 bool 237 GenericAVC::VendorModel::isValid( const GenericAVC::VendorModelEntry& vme ) 238 { 239 struct VendorModelEntry invalid; 240 return !(vme==invalid); 207 241 } 208 242 trunk/libffado/src/genericavc/avc_vendormodel.h
r599 r607 35 35 VendorModelEntry(const VendorModelEntry& rhs); 36 36 VendorModelEntry& operator = (const VendorModelEntry& rhs); 37 bool operator == (const VendorModelEntry& rhs) const; 37 38 virtual ~VendorModelEntry(); 38 39 … … 56 57 std::vector<std::string>::const_iterator& b, 57 58 std::vector<std::string>::const_iterator& e ); 58 VendorModelEntry* find( unsigned int vendor_id, unsigned model_id ); 59 VendorModelEntry find( unsigned int vendor_id, unsigned model_id ); 60 bool isPresent( unsigned int vendor_id, unsigned model_id ); 61 static bool isValid( const VendorModelEntry& vme ); 59 62 60 63 const VendorModelEntryVector& getVendorModelEntries() const; … … 62 65 std::string m_filename; 63 66 VendorModelEntryVector m_vendorModelEntries; 67 64 68 }; 65 69