Changeset 1229
- Timestamp:
- 05/27/08 14:46:09 (13 years ago)
- Files:
-
- branches/libffado-2.0/src/bebob/bebob_avdevice.cpp (modified) (2 diffs)
- branches/libffado-2.0/src/bebob/bebob_avdevice.h (modified) (1 diff)
- branches/libffado-2.0/src/devicemanager.cpp (modified) (5 diffs)
- branches/libffado-2.0/src/devicemanager.h (modified) (1 diff)
- branches/libffado-2.0/src/fireworks/fireworks_device.cpp (modified) (2 diffs)
- branches/libffado-2.0/src/fireworks/fireworks_device.h (modified) (1 diff)
- branches/libffado-2.0/src/genericavc/avc_avdevice.cpp (modified) (3 diffs)
- branches/libffado-2.0/src/genericavc/avc_avdevice.h (modified) (1 diff)
- branches/libffado-2.0/src/libavc/general/avc_unit.cpp (modified) (1 diff)
- branches/libffado-2.0/src/motu/motu_avdevice.cpp (modified) (1 diff)
- branches/libffado-2.0/src/motu/motu_avdevice.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/libffado-2.0/src/bebob/bebob_avdevice.cpp
r1213 r1229 80 80 81 81 bool 82 AvDevice::probe( ConfigRom& configRom ) 83 { 84 unsigned int vendorId = configRom.getNodeVendorId(); 85 unsigned int modelId = configRom.getModelId(); 86 87 GenericAVC::VendorModel vendorModel( SHAREDIR "/ffado_driver_bebob.txt" ); 88 if ( vendorModel.parse() ) { 89 return vendorModel.isPresent( vendorId, modelId ); 90 } 91 92 return false; 82 AvDevice::probe( ConfigRom& configRom, bool generic ) 83 { 84 if(generic) { 85 return false; 86 // try a bebob-specific command to check for the firmware 87 ExtendedPlugInfoCmd extPlugInfoCmd( configRom.get1394Service() ); 88 UnitPlugAddress unitPlugAddress( UnitPlugAddress::ePT_PCR, 89 configRom.getNodeId() ); 90 extPlugInfoCmd.setPlugAddress( PlugAddress( PlugAddress::ePD_Input, 91 PlugAddress::ePAM_Unit, 92 unitPlugAddress ) ); 93 extPlugInfoCmd.setNodeId( configRom.getNodeId() ); 94 extPlugInfoCmd.setCommandType( AVCCommand::eCT_Status ); 95 extPlugInfoCmd.setVerbose( configRom.getVerboseLevel() ); 96 ExtendedPlugInfoInfoType extendedPlugInfoInfoType( 97 ExtendedPlugInfoInfoType::eIT_NoOfChannels ); 98 extendedPlugInfoInfoType.initialize(); 99 extPlugInfoCmd.setInfoType( extendedPlugInfoInfoType ); 100 101 if ( !extPlugInfoCmd.fire() ) { 102 debugError( "Number of channels command failed\n" ); 103 return false; 104 } 105 106 ExtendedPlugInfoInfoType* infoType = extPlugInfoCmd.getInfoType(); 107 if ( infoType 108 && infoType->m_plugNrOfChns ) 109 { 110 return true; 111 } 112 return false; 113 } else { 114 // check if device is in supported devices list 115 unsigned int vendorId = configRom.getNodeVendorId(); 116 unsigned int modelId = configRom.getModelId(); 117 118 GenericAVC::VendorModel vendorModel( SHAREDIR "/ffado_driver_bebob.txt" ); 119 if ( vendorModel.parse() ) { 120 return vendorModel.isPresent( vendorId, modelId ); 121 } 122 return false; 123 } 93 124 } 94 125 … … 156 187 m_model.vendor_name.c_str(), 157 188 m_model.model_name.c_str()); 158 } else return false; 189 } else { 190 debugWarning("Using generic BeBoB support for unsupported device '%s %s'\n", 191 getConfigRom().getVendorName().c_str(), getConfigRom().getModelName().c_str()); 192 } 159 193 160 194 if ( !Unit::discover() ) { branches/libffado-2.0/src/bebob/bebob_avdevice.h
r1175 r1229 63 63 virtual ~AvDevice(); 64 64 65 static bool probe( ConfigRom& configRom );65 static bool probe( ConfigRom& configRom, bool generic = false ); 66 66 virtual bool loadFromCache(); 67 67 virtual bool saveCache(); branches/libffado-2.0/src/devicemanager.cpp
r1213 r1229 436 436 } 437 437 438 std::auto_ptr<ConfigRom> configRom = 439 std::auto_ptr<ConfigRom>( new ConfigRom( *portService, nodeId ) ); 438 ConfigRom *configRom = new ConfigRom( *portService, nodeId ); 440 439 if ( !configRom->initialize() ) { 441 440 // \todo If a PHY on the bus is in power safe mode then … … 478 477 // supported devices. 479 478 if(m_deviceStringParser->countDeviceStrings() && 480 !m_deviceStringParser->match(*configRom .get())) {479 !m_deviceStringParser->match(*configRom)) { 481 480 debugOutput(DEBUG_LEVEL_VERBOSE, "Device doesn't match any of the spec strings. skipping...\n"); 482 481 continue; … … 528 527 529 528 debugOutput( DEBUG_LEVEL_NORMAL, "discovery of node %d on port %d done...\n", nodeId, portService->getPort() ); 529 } else { 530 // we didn't get a device, hence we have to delete the configrom ptr manually 531 delete configRom; 530 532 } 531 533 } … … 799 801 800 802 FFADODevice* 801 DeviceManager::getDriverForDevice ( std::auto_ptr<ConfigRom>( configRom ),802 int id )803 DeviceManager::getDriverForDeviceDo( ConfigRom *configRom, 804 int id, bool generic ) 803 805 { 804 806 #ifdef ENABLE_BEBOB 805 807 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying BeBoB...\n" ); 806 if ( BeBoB::AvDevice::probe( *configRom .get()) ) {807 return BeBoB::AvDevice::createDevice( *this, configRom);808 if ( BeBoB::AvDevice::probe( *configRom, generic ) ) { 809 return BeBoB::AvDevice::createDevice( *this, std::auto_ptr<ConfigRom>( configRom ) ); 808 810 } 809 811 #endif 810 812 813 #ifdef ENABLE_FIREWORKS 814 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying ECHO Audio FireWorks...\n" ); 815 if ( FireWorks::Device::probe( *configRom, generic ) ) { 816 return FireWorks::Device::createDevice( *this, std::auto_ptr<ConfigRom>( configRom ) ); 817 } 818 #endif 819 820 // we want to try the non-generic AV/C platforms before trying the generic ones 811 821 #ifdef ENABLE_GENERICAVC 812 822 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying Generic AV/C...\n" ); 813 if ( GenericAVC::AvDevice::probe( *configRom.get() ) ) { 814 return GenericAVC::AvDevice::createDevice( *this, configRom ); 815 } 816 #endif 817 818 #ifdef ENABLE_FIREWORKS 819 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying ECHO Audio FireWorks...\n" ); 820 if ( FireWorks::Device::probe( *configRom.get() ) ) { 821 return FireWorks::Device::createDevice( *this, configRom ); 823 if ( GenericAVC::AvDevice::probe( *configRom, generic ) ) { 824 return GenericAVC::AvDevice::createDevice( *this, std::auto_ptr<ConfigRom>( configRom ) ); 822 825 } 823 826 #endif … … 825 828 #ifdef ENABLE_MOTU 826 829 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying Motu...\n" ); 827 if ( Motu::MotuDevice::probe( *configRom .get()) ) {828 return Motu::MotuDevice::createDevice( *this, configRom);830 if ( Motu::MotuDevice::probe( *configRom, generic ) ) { 831 return Motu::MotuDevice::createDevice( *this, std::auto_ptr<ConfigRom>( configRom ) ); 829 832 } 830 833 #endif 831 834 835 return NULL; 836 } 837 838 FFADODevice* 839 DeviceManager::getDriverForDevice( ConfigRom *configRom, 840 int id ) 841 { 842 debugOutput( DEBUG_LEVEL_VERBOSE, "Probing for supported device...\n" ); 843 FFADODevice* dev = getDriverForDeviceDo(configRom, id, false); 844 if(dev) { 845 debugOutput( DEBUG_LEVEL_VERBOSE, " found supported device...\n" ); 846 return dev; 847 } 848 849 debugOutput( DEBUG_LEVEL_VERBOSE, " no supported device found, trying generic support...\n" ); 850 dev = getDriverForDeviceDo(configRom, id, true); 851 if(dev) { 852 debugOutput( DEBUG_LEVEL_VERBOSE, " found generic support for device...\n" ); 853 return dev; 854 } 855 debugOutput( DEBUG_LEVEL_VERBOSE, " device not supported...\n" ); 832 856 return 0; 833 857 } branches/libffado-2.0/src/devicemanager.h
r1163 r1229 131 131 132 132 protected: 133 FFADODevice* getDriverForDevice( std::auto_ptr<ConfigRom>( configRom ), 133 FFADODevice* getDriverForDeviceDo( ConfigRom *configRom, 134 int id, bool generic ); 135 FFADODevice* getDriverForDevice( ConfigRom *configRom, 134 136 int id ); 135 137 FFADODevice* getSlaveDriver( std::auto_ptr<ConfigRom>( configRom ) ); branches/libffado-2.0/src/fireworks/fireworks_device.cpp
r1158 r1229 75 75 76 76 bool 77 Device::probe( ConfigRom& configRom ) 78 { 79 unsigned int vendorId = configRom.getNodeVendorId(); 80 unsigned int modelId = configRom.getModelId(); 81 82 GenericAVC::VendorModel vendorModel( SHAREDIR "/ffado_driver_fireworks.txt" ); 83 if ( vendorModel.parse() ) { 84 return vendorModel.isPresent( vendorId, modelId ); 85 } 86 return false; 77 Device::probe( ConfigRom& configRom, bool generic ) 78 { 79 if(generic) { 80 // try an EFC command 81 EfcOverAVCCmd cmd( configRom.get1394Service() ); 82 cmd.setCommandType( AVC::AVCCommand::eCT_Control ); 83 cmd.setNodeId( configRom.getNodeId() ); 84 cmd.setSubunitType( AVC::eST_Unit ); 85 cmd.setSubunitId( 0xff ); 86 cmd.setVerbose( configRom.getVerboseLevel() ); 87 88 EfcHardwareInfoCmd hwInfo; 89 hwInfo.setVerboseLevel(configRom.getVerboseLevel()); 90 cmd.m_cmd = &hwInfo; 91 92 if ( !cmd.fire()) { 93 return false; 94 } 95 96 if ( cmd.getResponse() != AVC::AVCCommand::eR_Accepted) { 97 return false; 98 } 99 if ( hwInfo.m_header.retval != EfcCmd::eERV_Ok 100 && hwInfo.m_header.retval != EfcCmd::eERV_FlashBusy) { 101 debugError( "EFC command failed\n" ); 102 return false; 103 } 104 return true; 105 } else { 106 unsigned int vendorId = configRom.getNodeVendorId(); 107 unsigned int modelId = configRom.getModelId(); 108 109 GenericAVC::VendorModel vendorModel( SHAREDIR "/ffado_driver_fireworks.txt" ); 110 if ( vendorModel.parse() ) { 111 return vendorModel.isPresent( vendorId, modelId ); 112 } 113 return false; 114 } 87 115 } 88 116 … … 99 127 100 128 if (!GenericAVC::VendorModel::isValid(m_model)) { 101 return false; 102 } 103 debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n", 104 m_model.vendor_name.c_str(), m_model.model_name.c_str()); 129 debugWarning("Using generic ECHO Audio FireWorks support for unsupported device '%s %s'\n", 130 getConfigRom().getVendorName().c_str(), getConfigRom().getModelName().c_str()); 131 } else { 132 debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n", 133 m_model.vendor_name.c_str(), m_model.model_name.c_str()); 134 } 105 135 106 136 // get the info from the EFC branches/libffado-2.0/src/fireworks/fireworks_device.h
r1133 r1229 46 46 virtual ~Device(); 47 47 48 static bool probe( ConfigRom& configRom );48 static bool probe( ConfigRom& configRom, bool generic = false ); 49 49 static FFADODevice * createDevice( DeviceManager& d, std::auto_ptr<ConfigRom>( configRom )); 50 50 virtual bool discover(); branches/libffado-2.0/src/genericavc/avc_avdevice.cpp
r1203 r1229 31 31 #include "libavc/general/avc_plug_info.h" 32 32 #include "libavc/general/avc_extended_plug_info.h" 33 #include "libavc/general/avc_subunit_info.h" 33 34 34 35 #include "debugmodule/debugmodule.h" … … 76 77 77 78 bool 78 AvDevice::probe( ConfigRom& configRom ) 79 { 80 unsigned int vendorId = configRom.getNodeVendorId(); 81 unsigned int modelId = configRom.getModelId(); 82 83 GenericAVC::VendorModel vendorModel( SHAREDIR "/ffado_driver_genericavc.txt" ); 84 if ( vendorModel.parse() ) { 85 return vendorModel.isPresent( vendorId, modelId ); 86 } 87 88 return false; 79 AvDevice::probe( ConfigRom& configRom, bool generic ) 80 { 81 if(generic) { 82 // check if we have a music subunit 83 SubUnitInfoCmd subUnitInfoCmd( configRom.get1394Service() ); 84 subUnitInfoCmd.setCommandType( AVCCommand::eCT_Status ); 85 subUnitInfoCmd.m_page = 0; 86 subUnitInfoCmd.setNodeId( configRom.getNodeId() ); 87 subUnitInfoCmd.setVerbose( configRom.getVerboseLevel() ); 88 if ( !subUnitInfoCmd.fire() ) { 89 debugError( "Subunit info command failed\n" ); 90 return false; 91 } 92 for ( int i = 0; i < subUnitInfoCmd.getNrOfValidEntries(); ++i ) { 93 subunit_type_t subunit_type 94 = subUnitInfoCmd.m_table[i].m_subunit_type; 95 if (subunit_type == eST_Music) return true; 96 } 97 98 return false; 99 } else { 100 // check if device is in supported devices list 101 unsigned int vendorId = configRom.getNodeVendorId(); 102 unsigned int modelId = configRom.getModelId(); 103 104 GenericAVC::VendorModel vendorModel( SHAREDIR "/ffado_driver_genericavc.txt" ); 105 if ( vendorModel.parse() ) { 106 return vendorModel.isPresent( vendorId, modelId ); 107 } 108 return false; 109 } 89 110 } 90 111 … … 111 132 112 133 if (!GenericAVC::VendorModel::isValid(m_model)) { 113 return false; 114 } 115 debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n", 116 m_model.vendor_name.c_str(), m_model.model_name.c_str()); 134 debugWarning("Using generic AV/C support for unsupported device '%s %s'\n", 135 getConfigRom().getVendorName().c_str(), getConfigRom().getModelName().c_str()); 136 } else { 137 debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n", 138 m_model.vendor_name.c_str(), m_model.model_name.c_str()); 139 } 117 140 } 118 141 branches/libffado-2.0/src/genericavc/avc_avdevice.h
r1154 r1229 51 51 virtual ~AvDevice(); 52 52 53 static bool probe( ConfigRom& configRom );53 static bool probe( ConfigRom& configRom, bool generic = false ); 54 54 virtual bool discover(); 55 55 static FFADODevice * createDevice( DeviceManager& d, std::auto_ptr<ConfigRom>( configRom )); branches/libffado-2.0/src/libavc/general/avc_unit.cpp
r1228 r1229 787 787 } 788 788 } 789 debugOutput( DEBUG_LEVEL_NORMAL, 790 "Active Sync Connection: %s, '%s' -> '%s'\n", 791 m_activeSyncInfo->m_description.c_str(), 792 plug->getName(), 793 msuPlug->getName() ); 789 if(m_activeSyncInfo) { 790 debugOutput( DEBUG_LEVEL_NORMAL, 791 "Active Sync Connection: %s, '%s' -> '%s'\n", 792 m_activeSyncInfo->m_description.c_str(), 793 plug->getName(), 794 msuPlug->getName() ); 795 } 794 796 } 795 797 } branches/libffado-2.0/src/motu/motu_avdevice.cpp
r1209 r1229 587 587 588 588 bool 589 MotuDevice::probe( ConfigRom& configRom ) 590 { 589 MotuDevice::probe( ConfigRom& configRom, bool generic) 590 { 591 if(generic) return false; 592 591 593 unsigned int vendorId = configRom.getNodeVendorId(); 592 594 unsigned int unitVersion = configRom.getUnitVersion(); branches/libffado-2.0/src/motu/motu_avdevice.h
r1128 r1229 151 151 virtual bool destroyMixer(); 152 152 153 static bool probe( ConfigRom& configRom );153 static bool probe( ConfigRom& configRom, bool generic = false ); 154 154 static FFADODevice * createDevice( DeviceManager& d, std::auto_ptr<ConfigRom>( configRom )); 155 155 static int getConfigurationId( );