Index: /trunk/libffado/src/ffadodevice.cpp =================================================================== --- /trunk/libffado/src/ffadodevice.cpp (revision 581) +++ /trunk/libffado/src/ffadodevice.cpp (revision 583) @@ -35,20 +35,27 @@ IMPL_DEBUG_MODULE( FFADODevice, FFADODevice, DEBUG_LEVEL_NORMAL ); -FFADODevice::FFADODevice( std::auto_ptr< ConfigRom >( configRom ), - Ieee1394Service& ieee1394service, - int nodeId ) +FFADODevice::FFADODevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )) : Control::Container() , m_pConfigRom( configRom ) - , m_p1394Service( &ieee1394service ) - , m_nodeId ( nodeId ) + , m_p1394Service( &ieee1394Service ) { addOption(Util::OptionContainer::Option("id",std::string("dev?"))); std::ostringstream nodestr; - nodestr << "node" << nodeId; + nodestr << "node" << m_pConfigRom->getNodeId(); + // setOscBase(nodestr.str()); - ConfigRom& c = getConfigRom(); +// ConfigRom& c = getConfigRom(); +// addChildOscNode(&c); +} -// addChildOscNode(&c); +FFADODevice * +FFADODevice::createDevice( Ieee1394Service& , + std::auto_ptr( x )) +{ + // re-implement this!! + assert(0); + return NULL; } @@ -57,4 +64,10 @@ { return getConfigRom().getGuidString(); +} + +int +FFADODevice::getNodeId() +{ + return getConfigRom().getNodeId(); } Index: /trunk/libffado/src/rme/rme_avdevice.h =================================================================== --- /trunk/libffado/src/rme/rme_avdevice.h (revision 554) +++ /trunk/libffado/src/rme/rme_avdevice.h (revision 583) @@ -49,10 +49,11 @@ public: - RmeDevice( std::auto_ptr( configRom ), - Ieee1394Service& ieee1394Service, - int nodeId ); + RmeDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )); virtual ~RmeDevice(); static bool probe( ConfigRom& configRom ); + static FFADODevice * createDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )); static int getConfigurationId( ); virtual bool discover(); Index: /trunk/libffado/src/rme/rme_avdevice.cpp =================================================================== --- /trunk/libffado/src/rme/rme_avdevice.cpp (revision 554) +++ /trunk/libffado/src/rme/rme_avdevice.cpp (revision 583) @@ -50,12 +50,11 @@ }; -RmeDevice::RmeDevice( std::auto_ptr< ConfigRom >( configRom ), - Ieee1394Service& ieee1394service, - int nodeId ) - : FFADODevice( configRom, ieee1394service, nodeId ) +RmeDevice::RmeDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )) + : FFADODevice( ieee1394Service, configRom ) , m_model( NULL ) { debugOutput( DEBUG_LEVEL_VERBOSE, "Created Rme::RmeDevice (NodeID %d)\n", - nodeId ); + configRom->getNodeId() ); } @@ -84,4 +83,11 @@ return false; +} + +FFADODevice * +RmeDevice::createDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )) +{ + return new RmeDevice(ieee1394Service, configRom ); } @@ -156,5 +162,5 @@ debugOutput(DEBUG_LEVEL_VERBOSE, "%s %s at node %d\n", m_model->vendor_name, m_model->model_name, - m_nodeId); + getNodeId()); } Index: /trunk/libffado/src/motu/motu_avdevice.h =================================================================== --- /trunk/libffado/src/motu/motu_avdevice.h (revision 554) +++ /trunk/libffado/src/motu/motu_avdevice.h (revision 583) @@ -94,10 +94,11 @@ public: - MotuDevice( std::auto_ptr( configRom ), - Ieee1394Service& ieee1394Service, - int nodeId ); + MotuDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )); virtual ~MotuDevice(); static bool probe( ConfigRom& configRom ); + static FFADODevice * createDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )); static int getConfigurationId( ); virtual bool discover(); Index: /trunk/libffado/src/motu/motu_avdevice.cpp =================================================================== --- /trunk/libffado/src/motu/motu_avdevice.cpp (revision 554) +++ /trunk/libffado/src/motu/motu_avdevice.cpp (revision 583) @@ -56,8 +56,7 @@ }; -MotuDevice::MotuDevice( std::auto_ptr< ConfigRom >( configRom ), - Ieee1394Service& ieee1394service, - int nodeId) - : FFADODevice( configRom, ieee1394service, nodeId ) +MotuDevice::MotuDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )) + : FFADODevice( ieee1394Service, configRom ) , m_motu_model( MOTUFW_MODEL_NONE ) , m_iso_recv_channel ( -1 ) @@ -69,5 +68,5 @@ { debugOutput( DEBUG_LEVEL_VERBOSE, "Created Motu::MotuDevice (NodeID %d)\n", - nodeId ); + configRom->getNodeId() ); } @@ -109,4 +108,11 @@ return false; +} + +FFADODevice * +MotuDevice::createDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )) +{ + return new MotuDevice(ieee1394Service, configRom ); } @@ -316,5 +322,5 @@ debugOutput(DEBUG_LEVEL_VERBOSE, "%s %s at node %d\n", m_model->vendor_name, m_model->model_name, - m_nodeId); + getNodeId()); } @@ -866,5 +872,5 @@ quadlet = 0; // Note: 1394Service::read() expects a physical ID, not the node id - if (m_p1394Service->read(0xffc0 | m_nodeId, MOTUFW_BASE_ADDR+reg, 1, &quadlet) < 0) { + if (m_p1394Service->read(0xffc0 | getNodeId(), MOTUFW_BASE_ADDR+reg, 1, &quadlet) < 0) { debugError("Error doing motu read from register 0x%06x\n",reg); } @@ -882,5 +888,5 @@ // Note: 1394Service::write() expects a physical ID, not the node id - if (m_p1394Service->write(0xffc0 | m_nodeId, MOTUFW_BASE_ADDR+reg, 1, &data) < 0) { + if (m_p1394Service->write(0xffc0 | getNodeId(), MOTUFW_BASE_ADDR+reg, 1, &data) < 0) { err = 1; debugError("Error doing motu write to register 0x%06x\n",reg); Index: /trunk/libffado/src/ffadodevice.h =================================================================== --- /trunk/libffado/src/ffadodevice.h (revision 581) +++ /trunk/libffado/src/ffadodevice.h (revision 583) @@ -48,7 +48,6 @@ { public: - FFADODevice( std::auto_ptr< ConfigRom >( configRom ), - Ieee1394Service& ieee1394service, - int nodeId ); + FFADODevice( Ieee1394Service& ieee1394service, + std::auto_ptr< ConfigRom >( configRom ) ); virtual ~FFADODevice() {}; @@ -97,4 +96,21 @@ /** + * @brief This is called by the DeviceManager to create an instance of the device + * + * This function enables the FFADODevice to return a subclass of itself should that + * be needed. If we don't do this we'd need to know about the subclasses in the + * devicemanager, whilst now we don't. + * + * The function should return an instance of either the class itself or a subclass + * of itself. + * + * This should be overridden in any subclass. + * + * @return a new instance of the AvDevice type, NULL when unsuccessful + */ + static FFADODevice * createDevice( Ieee1394Service& , + std::auto_ptr( x )); + + /** * @brief This is called by the DeviceManager to discover & configure the device * @@ -286,5 +302,5 @@ * @return the node id */ - int getNodeId() { return m_nodeId;}; + int getNodeId(); // the Control::Container functions @@ -297,5 +313,4 @@ std::auto_ptr( m_pConfigRom ); Ieee1394Service* m_p1394Service; - int m_nodeId; DECLARE_DEBUG_MODULE; Index: /trunk/libffado/src/metrichalo/mh_avdevice.h =================================================================== --- /trunk/libffado/src/metrichalo/mh_avdevice.h (revision 554) +++ /trunk/libffado/src/metrichalo/mh_avdevice.h (revision 583) @@ -47,10 +47,11 @@ class MHAvDevice : public FFADODevice { public: - MHAvDevice( std::auto_ptr( configRom ), - Ieee1394Service& ieee1394Service, - int nodeId ); + MHAvDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )); virtual ~MHAvDevice(); static bool probe( ConfigRom& configRom ); + static FFADODevice * createDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )); static int getConfigurationId(); virtual bool discover(); Index: /trunk/libffado/src/metrichalo/mh_avdevice.cpp =================================================================== --- /trunk/libffado/src/metrichalo/mh_avdevice.cpp (revision 554) +++ /trunk/libffado/src/metrichalo/mh_avdevice.cpp (revision 583) @@ -50,13 +50,12 @@ }; -MHAvDevice::MHAvDevice( std::auto_ptr< ConfigRom >( configRom ), - Ieee1394Service& ieee1394service, - int nodeId ) - : FFADODevice( configRom, ieee1394service, nodeId ) +MHAvDevice::MHAvDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )) + : FFADODevice( ieee1394Service, configRom ) , m_model( NULL ) { debugOutput( DEBUG_LEVEL_VERBOSE, "Created MetricHalo::MHAvDevice (NodeID %d)\n", - nodeId ); + configRom->getNodeId() ); } @@ -85,4 +84,11 @@ return false; +} + +FFADODevice * +MHAvDevice::createDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )) +{ + return new MHAvDevice(ieee1394Service, configRom ); } @@ -149,5 +155,5 @@ debugOutput(DEBUG_LEVEL_VERBOSE, "%s %s at node %d\n", m_model->vendor_name, m_model->model_name, - m_nodeId); + getNodeId()); } Index: /trunk/libffado/src/dice/dice_avdevice.h =================================================================== --- /trunk/libffado/src/dice/dice_avdevice.h (revision 554) +++ /trunk/libffado/src/dice/dice_avdevice.h (revision 583) @@ -56,12 +56,14 @@ class DiceNotifier; public: - DiceAvDevice( std::auto_ptr( configRom ), - Ieee1394Service& ieee1394Service, - int nodeId); + DiceAvDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )); ~DiceAvDevice(); static bool probe( ConfigRom& configRom ); + static FFADODevice * createDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )); + virtual bool discover(); + static int getConfigurationId( ); - virtual bool discover(); virtual void showDevice(); Index: /trunk/libffado/src/dice/dice_avdevice.cpp =================================================================== --- /trunk/libffado/src/dice/dice_avdevice.cpp (revision 554) +++ /trunk/libffado/src/dice/dice_avdevice.cpp (revision 583) @@ -51,8 +51,7 @@ }; -DiceAvDevice::DiceAvDevice( std::auto_ptr< ConfigRom >( configRom ), - Ieee1394Service& ieee1394service, - int nodeId ) - : FFADODevice( configRom, ieee1394service, nodeId ) +DiceAvDevice::DiceAvDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )) + : FFADODevice( ieee1394Service, configRom ) , m_model( NULL ) , m_global_reg_offset (0xFFFFFFFFLU) @@ -73,5 +72,5 @@ { debugOutput( DEBUG_LEVEL_VERBOSE, "Created Dice::DiceAvDevice (NodeID %d)\n", - nodeId ); + configRom->getNodeId() ); } @@ -105,4 +104,11 @@ return false; +} + +FFADODevice * +DiceAvDevice::createDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )) +{ + return new DiceAvDevice(ieee1394Service, configRom ); } @@ -282,5 +288,5 @@ debugOutput(DEBUG_LEVEL_VERBOSE, "%s %s at node %d\n", m_model->vendor_name, m_model->model_name, - m_nodeId); + getNodeId()); debugOutput(DEBUG_LEVEL_VERBOSE," DICE Parameter Space info:\n"); @@ -666,5 +672,5 @@ debugOutput(DEBUG_LEVEL_VERBOSE, "Locking %s %s at node %d\n", - m_model->vendor_name, m_model->model_name, m_nodeId); + m_model->vendor_name, m_model->model_name, getNodeId()); // get a notifier to handle device notifications @@ -710,5 +716,5 @@ swap_value |= m_notifier->getStart(); - if (!m_p1394Service->lockCompareSwap64( m_nodeId | 0xFFC0, addr, DICE_OWNER_NO_OWNER, + if (!m_p1394Service->lockCompareSwap64( getNodeId() | 0xFFC0, addr, DICE_OWNER_NO_OWNER, swap_value, &result )) { debugWarning("Could not register ourselves as device owner\n"); @@ -747,5 +753,5 @@ compare_value |= m_notifier->getStart(); - if (!m_p1394Service->lockCompareSwap64( m_nodeId | 0xFFC0, addr, compare_value, + if (!m_p1394Service->lockCompareSwap64( getNodeId() | 0xFFC0, addr, compare_value, DICE_OWNER_NO_OWNER, &result )) { debugWarning("Could not unregister ourselves as device owner\n"); @@ -1202,5 +1208,5 @@ fb_nodeaddr_t addr=DICE_REGISTER_BASE + offset; - fb_nodeid_t nodeId=m_nodeId | 0xFFC0; + fb_nodeid_t nodeId=getNodeId() | 0xFFC0; if(!m_p1394Service->read_quadlet( nodeId, addr, result ) ) { @@ -1227,5 +1233,5 @@ fb_nodeaddr_t addr=DICE_REGISTER_BASE + offset; - fb_nodeid_t nodeId=m_nodeId | 0xFFC0; + fb_nodeid_t nodeId=getNodeId() | 0xFFC0; if(!m_p1394Service->write_quadlet( nodeId, addr, htonl(data) ) ) { @@ -1247,5 +1253,5 @@ fb_nodeaddr_t addr=DICE_REGISTER_BASE + offset; - fb_nodeid_t nodeId=m_nodeId | 0xFFC0; + fb_nodeid_t nodeId=getNodeId() | 0xFFC0; if(!m_p1394Service->read( nodeId, addr, length/4, data ) ) { @@ -1272,5 +1278,5 @@ fb_nodeaddr_t addr=DICE_REGISTER_BASE + offset; - fb_nodeid_t nodeId=m_nodeId | 0xFFC0; + fb_nodeid_t nodeId=getNodeId() | 0xFFC0; fb_quadlet_t data_out[length/4]; Index: /trunk/libffado/src/genericavc/avc_avdevice.cpp =================================================================== --- /trunk/libffado/src/genericavc/avc_avdevice.cpp (revision 560) +++ /trunk/libffado/src/genericavc/avc_avdevice.cpp (revision 583) @@ -56,13 +56,12 @@ }; -AvDevice::AvDevice( std::auto_ptr< ConfigRom >( configRom ), - Ieee1394Service& ieee1394service, - int nodeId ) - : FFADODevice( configRom, ieee1394service, nodeId ) +AvDevice::AvDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )) + : FFADODevice( ieee1394Service, configRom ) , m_model( NULL ) { debugOutput( DEBUG_LEVEL_VERBOSE, "Created GenericAVC::AvDevice (NodeID %d)\n", - nodeId ); + configRom->getNodeId() ); addOption(Util::OptionContainer::Option("snoopMode",false)); } @@ -92,4 +91,11 @@ return false; +} + +FFADODevice * +AvDevice::createDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )) +{ + return new AvDevice(ieee1394Service, configRom ); } Index: /trunk/libffado/src/genericavc/avc_avdevice.h =================================================================== --- /trunk/libffado/src/genericavc/avc_avdevice.h (revision 557) +++ /trunk/libffado/src/genericavc/avc_avdevice.h (revision 583) @@ -47,11 +47,12 @@ class AvDevice : public FFADODevice, public AVC::Unit { public: - AvDevice( std::auto_ptr( configRom ), - Ieee1394Service& ieee1394Service, - int nodeId ); + AvDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )); virtual ~AvDevice(); static bool probe( ConfigRom& configRom ); virtual bool discover(); + static FFADODevice * createDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )); virtual void setVerboseLevel(int l); Index: /trunk/libffado/src/bebob/bebob_avdevice.cpp =================================================================== --- /trunk/libffado/src/bebob/bebob_avdevice.cpp (revision 580) +++ /trunk/libffado/src/bebob/bebob_avdevice.cpp (revision 583) @@ -82,12 +82,11 @@ }; -AvDevice::AvDevice( std::auto_ptr< ConfigRom >( configRom ), - Ieee1394Service& ieee1394service, - int nodeId ) - : GenericAVC::AvDevice( configRom, ieee1394service, nodeId ) +AvDevice::AvDevice( Ieee1394Service& ieee1394service, + std::auto_ptr< ConfigRom >( configRom ) ) + : GenericAVC::AvDevice( ieee1394service, configRom ) , m_Mixer ( NULL ) { debugOutput( DEBUG_LEVEL_VERBOSE, "Created BeBoB::AvDevice (NodeID %d)\n", - nodeId ); + configRom->getNodeId() ); } @@ -171,4 +170,11 @@ } +FFADODevice * +AvDevice::createDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )) +{ + return new AvDevice(ieee1394Service, configRom ); +} + bool AvDevice::discover() @@ -240,10 +246,10 @@ ExtendedStreamFormatCmd extStreamFormatCmd( *m_p1394Service ); UnitPlugAddress unitPlugAddress( UnitPlugAddress::ePT_PCR, - m_nodeId ); + getNodeId() ); extStreamFormatCmd.setPlugAddress( PlugAddress( PlugAddress::ePD_Input, PlugAddress::ePAM_Unit, unitPlugAddress ) ); - extStreamFormatCmd.setNodeId( m_nodeId ); + extStreamFormatCmd.setNodeId( getNodeId() ); extStreamFormatCmd.setCommandType( AVCCommand::eCT_Status ); extStreamFormatCmd.setVerbose( true ); @@ -274,9 +280,9 @@ ExtendedPlugInfoCmd extPlugInfoCmd( *m_p1394Service ); UnitPlugAddress unitPlugAddress( UnitPlugAddress::ePT_PCR, - m_nodeId ); + getNodeId() ); extPlugInfoCmd.setPlugAddress( PlugAddress( ePlugDirection, PlugAddress::ePAM_Unit, unitPlugAddress ) ); - extPlugInfoCmd.setNodeId( m_nodeId ); + extPlugInfoCmd.setNodeId( getNodeId() ); extPlugInfoCmd.setCommandType( AVCCommand::eCT_Status ); extPlugInfoCmd.setVerbose( true ); @@ -311,5 +317,5 @@ signalUnitAddr.m_plugId = 0x01; signalSourceCmd.setSignalDestination( signalUnitAddr ); - signalSourceCmd.setNodeId( m_nodeId ); + signalSourceCmd.setNodeId( getNodeId() ); signalSourceCmd.setSubunitType( eST_Unit ); signalSourceCmd.setSubunitId( 0xff ); Index: /trunk/libffado/src/bebob/bebob_avdevice.h =================================================================== --- /trunk/libffado/src/bebob/bebob_avdevice.h (revision 580) +++ /trunk/libffado/src/bebob/bebob_avdevice.h (revision 583) @@ -58,7 +58,6 @@ class AvDevice : public GenericAVC::AvDevice { public: - AvDevice( std::auto_ptr( configRom ), - Ieee1394Service& ieee1394Service, - int nodeId ); + AvDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )); virtual ~AvDevice(); @@ -67,4 +66,7 @@ virtual bool saveCache(); virtual bool discover(); + + static FFADODevice * createDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )); virtual AVC::Subunit* createSubunit(AVC::Unit& unit, Index: /trunk/libffado/src/devicemanager.cpp =================================================================== --- /trunk/libffado/src/devicemanager.cpp (revision 581) +++ /trunk/libffado/src/devicemanager.cpp (revision 583) @@ -330,5 +330,5 @@ debugOutput( DEBUG_LEVEL_VERBOSE, "Trying BeBoB...\n" ); if ( BeBoB::AvDevice::probe( *configRom.get() ) ) { - return new BeBoB::AvDevice( configRom, *m_1394Service, id ); + return BeBoB::AvDevice::createDevice( *m_1394Service, configRom ); } #endif @@ -337,5 +337,5 @@ debugOutput( DEBUG_LEVEL_VERBOSE, "Trying Generic AV/C...\n" ); if ( GenericAVC::AvDevice::probe( *configRom.get() ) ) { - return new GenericAVC::AvDevice( configRom, *m_1394Service, id ); + return GenericAVC::AvDevice::createDevice( *m_1394Service, configRom ); } #endif @@ -344,5 +344,5 @@ debugOutput( DEBUG_LEVEL_VERBOSE, "Trying M-Audio...\n" ); if ( MAudio::AvDevice::probe( *configRom.get() ) ) { - return new MAudio::AvDevice( configRom, *m_1394Service, id ); + return MAudio::AvDevice::createDevice( *m_1394Service, configRom ); } #endif @@ -351,5 +351,5 @@ debugOutput( DEBUG_LEVEL_VERBOSE, "Trying Motu...\n" ); if ( Motu::MotuDevice::probe( *configRom.get() ) ) { - return new Motu::MotuDevice( configRom, *m_1394Service, id ); + return Motu::MotuDevice::createDevice( *m_1394Service, configRom ); } #endif @@ -358,5 +358,5 @@ debugOutput( DEBUG_LEVEL_VERBOSE, "Trying Dice...\n" ); if ( Dice::DiceAvDevice::probe( *configRom.get() ) ) { - return new Dice::DiceAvDevice( configRom, *m_1394Service, id ); + return Dice::DiceAvDevice::createDevice( *m_1394Service, configRom ); } #endif @@ -365,5 +365,5 @@ debugOutput( DEBUG_LEVEL_VERBOSE, "Trying Metric Halo...\n" ); if ( MetricHalo::MHAvDevice::probe( *configRom.get() ) ) { - return new MetricHalo::MHAvDevice( configRom, *m_1394Service, id ); + return MetricHalo::MHAvDevice::createDevice( *m_1394Service, configRom ); } #endif @@ -372,5 +372,5 @@ debugOutput( DEBUG_LEVEL_VERBOSE, "Trying RME...\n" ); if ( Rme::RmeDevice::probe( *configRom.get() ) ) { - return new Rme::RmeDevice( configRom, *m_1394Service, id ); + return Rme::RmeDevice::createDevice( *m_1394Service, configRom ); } #endif @@ -379,5 +379,5 @@ debugOutput( DEBUG_LEVEL_VERBOSE, "Trying Bounce...\n" ); if ( Bounce::BounceDevice::probe( *configRom.get() ) ) { - return new Bounce::BounceDevice( configRom, *m_1394Service, id ); + return Bounce::BounceDevice::createDevice( *m_1394Service, configRom ); } #endif @@ -392,5 +392,5 @@ #ifdef ENABLE_BOUNCE if ( Bounce::BounceSlaveDevice::probe( *configRom.get() ) ) { - return new Bounce::BounceSlaveDevice( configRom, *m_1394Service ); + return Bounce::BounceSlaveDevice::createDevice( *m_1394Service, configRom ); } #endif Index: /trunk/libffado/src/bounce/bounce_slave_avdevice.h =================================================================== --- /trunk/libffado/src/bounce/bounce_slave_avdevice.h (revision 445) +++ /trunk/libffado/src/bounce/bounce_slave_avdevice.h (revision 583) @@ -45,9 +45,11 @@ public: - BounceSlaveDevice( std::auto_ptr( configRom ), - Ieee1394Service& ieee1394Service ); + BounceSlaveDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )); virtual ~BounceSlaveDevice(); static bool probe( ConfigRom& configRom ); + static FFADODevice * createDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )); bool discover(); bool prepare(); Index: /trunk/libffado/src/bounce/bounce_avdevice.cpp =================================================================== --- /trunk/libffado/src/bounce/bounce_avdevice.cpp (revision 554) +++ /trunk/libffado/src/bounce/bounce_avdevice.cpp (revision 583) @@ -52,8 +52,7 @@ }; -BounceDevice::BounceDevice( std::auto_ptr< ConfigRom >( configRom ), - Ieee1394Service& ieee1394service, - int nodeId ) - : FFADODevice( configRom, ieee1394service, nodeId ) +BounceDevice::BounceDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )) + : FFADODevice( ieee1394Service, configRom ) , m_samplerate (44100) , m_model( NULL ) @@ -61,5 +60,5 @@ { debugOutput( DEBUG_LEVEL_VERBOSE, "Created Bounce::BounceDevice (NodeID %d)\n", - nodeId ); + configRom->getNodeId() ); addOption(Util::OptionContainer::Option("snoopMode",false)); } @@ -97,9 +96,16 @@ } +FFADODevice * +BounceDevice::createDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )) +{ + return new BounceDevice(ieee1394Service, configRom ); +} + bool BounceDevice::discover() { debugOutput( DEBUG_LEVEL_VERBOSE, "discovering BounceDevice (NodeID %d)\n", - m_nodeId ); + getNodeId() ); // unsigned int vendorId = m_pConfigRom->getNodeVendorId(); @@ -165,5 +171,5 @@ debugOutput(DEBUG_LEVEL_NORMAL, "Vendor Name : %s\n", m_model->vendor_name); debugOutput(DEBUG_LEVEL_NORMAL, "Model Name : %s\n", m_model->model_name); - debugOutput(DEBUG_LEVEL_NORMAL, "Node : %d\n", m_nodeId); + debugOutput(DEBUG_LEVEL_NORMAL, "Node : %d\n", getNodeId()); debugOutput(DEBUG_LEVEL_NORMAL, "GUID : 0x%016llX\n", m_pConfigRom->getGuid()); debugOutput(DEBUG_LEVEL_NORMAL, "\n" ); @@ -525,5 +531,5 @@ fb_nodeaddr_t addr=BOUNCE_REGISTER_BASE + offset; - fb_nodeid_t nodeId=m_nodeId | 0xFFC0; + fb_nodeid_t nodeId=getNodeId() | 0xFFC0; if(!m_p1394Service->read_quadlet( nodeId, addr, result ) ) { @@ -547,5 +553,5 @@ fb_nodeaddr_t addr=BOUNCE_REGISTER_BASE + offset; - fb_nodeid_t nodeId=m_nodeId | 0xFFC0; + fb_nodeid_t nodeId=getNodeId() | 0xFFC0; if(!m_p1394Service->write_quadlet( nodeId, addr, data ) ) { @@ -567,5 +573,5 @@ fb_nodeaddr_t addr=BOUNCE_REGISTER_BASE + offset; - fb_nodeid_t nodeId=m_nodeId | 0xFFC0; + fb_nodeid_t nodeId=getNodeId() | 0xFFC0; if(!m_p1394Service->read( nodeId, addr, length, data ) ) { @@ -587,5 +593,5 @@ fb_nodeaddr_t addr=BOUNCE_REGISTER_BASE + offset; - fb_nodeid_t nodeId=m_nodeId | 0xFFC0; + fb_nodeid_t nodeId=getNodeId() | 0xFFC0; if(!m_p1394Service->write( nodeId, addr, length, data ) ) { Index: /trunk/libffado/src/bounce/bounce_avdevice.h =================================================================== --- /trunk/libffado/src/bounce/bounce_avdevice.h (revision 554) +++ /trunk/libffado/src/bounce/bounce_avdevice.h (revision 583) @@ -69,10 +69,11 @@ class BounceNotifier; public: - BounceDevice( std::auto_ptr( configRom ), - Ieee1394Service& ieee1394Service, - int nodeId ); + BounceDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )); virtual ~BounceDevice(); static bool probe( ConfigRom& configRom ); + static FFADODevice * createDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )); static int getConfigurationId( ); virtual bool discover(); Index: /trunk/libffado/src/bounce/bounce_slave_avdevice.cpp =================================================================== --- /trunk/libffado/src/bounce/bounce_slave_avdevice.cpp (revision 445) +++ /trunk/libffado/src/bounce/bounce_slave_avdevice.cpp (revision 583) @@ -41,9 +41,7 @@ }; -BounceSlaveDevice::BounceSlaveDevice( std::auto_ptr< ConfigRom >( configRom ), - Ieee1394Service& ieee1394service ) - : BounceDevice( configRom, - ieee1394service, - ieee1394service.getLocalNodeId() ) +BounceSlaveDevice::BounceSlaveDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )) + : BounceDevice( ieee1394Service, configRom ) { addOption(Util::OptionContainer::Option("isoTimeoutSecs",(int64_t)120)); @@ -59,4 +57,11 @@ // we are always capable of constructing a slave device return true; +} + +FFADODevice * +BounceSlaveDevice::createDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )) +{ + return new BounceSlaveDevice(ieee1394Service, configRom ); } @@ -104,5 +109,5 @@ // This should be handled more carefuly. debugError( "Could not reread config rom from device (node id %d).\n", - m_nodeId ); + getNodeId() ); return false; } @@ -119,5 +124,5 @@ BounceSlaveDevice::lock() { debugOutput(DEBUG_LEVEL_VERBOSE, "Locking %s %s at node %d\n", - m_model->vendor_name, m_model->model_name, m_nodeId); + m_model->vendor_name, m_model->model_name, getNodeId()); // get a notifier to handle device notifications Index: /trunk/libffado/src/maudio/maudio_avdevice.cpp =================================================================== --- /trunk/libffado/src/maudio/maudio_avdevice.cpp (revision 554) +++ /trunk/libffado/src/maudio/maudio_avdevice.cpp (revision 583) @@ -40,14 +40,11 @@ namespace MAudio { -AvDevice::AvDevice( std::auto_ptr< ConfigRom >( configRom ), - Ieee1394Service& ieee1394service, - int iNodeId ) - : BeBoB::AvDevice( configRom, - ieee1394service, - iNodeId ) +AvDevice::AvDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )) + : BeBoB::AvDevice( ieee1394Service, configRom) , m_model ( NULL ) { debugOutput( DEBUG_LEVEL_VERBOSE, "Created MAudio::AvDevice (NodeID %d)\n", - iNodeId ); + configRom->getNodeId() ); } @@ -82,4 +79,11 @@ } return false; +} + +FFADODevice * +AvDevice::createDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )) +{ + return new AvDevice(ieee1394Service, configRom ); } Index: /trunk/libffado/src/maudio/maudio_avdevice.h =================================================================== --- /trunk/libffado/src/maudio/maudio_avdevice.h (revision 554) +++ /trunk/libffado/src/maudio/maudio_avdevice.h (revision 583) @@ -53,13 +53,15 @@ class AvDevice : public BeBoB::AvDevice { public: - AvDevice( std::auto_ptr( configRom ), - Ieee1394Service& ieee1394Service, - int nodeId ); + AvDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )); virtual ~AvDevice(); static bool probe( ConfigRom& configRom ); - static int getConfigurationId( ); + static FFADODevice * createDevice( Ieee1394Service& ieee1394Service, + std::auto_ptr( configRom )); virtual bool discover(); + static int getConfigurationId( ); + virtual void showDevice();