Changeset 942

Show
Ignore:
Timestamp:
03/12/08 12:54:46 (16 years ago)
Author:
ppalmers
Message:

add support for the device spec strings (no more auto-grab-all)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/devicemanager.cpp

    r932 r942  
    2727#include "devicemanager.h" 
    2828#include "ffadodevice.h" 
     29#include "DeviceStringParser.h" 
    2930 
    3031#include "libieee1394/configrom.h" 
     
    8283    : Control::Container("devicemanager") 
    8384    , m_processorManager( new Streaming::StreamProcessorManager() ) 
     85    , m_deviceStringParser( new DeviceStringParser() ) 
    8486{ 
    8587    addOption(Util::OptionContainer::Option("slaveMode",false)); 
     
    115117        delete *it; 
    116118    } 
     119 
     120    delete m_deviceStringParser; 
    117121} 
    118122 
     
    188192    if(isSpecStringValid(spec)) { 
    189193        debugOutput(DEBUG_LEVEL_VERBOSE, "Adding spec string %s\n", spec.c_str()); 
    190         m_SpecStrings.push_back(spec); 
     194        assert(m_deviceStringParser); 
     195        m_deviceStringParser->parseString(spec); 
    191196        return true; 
    192197    } else { 
     
    198203bool 
    199204DeviceManager::isSpecStringValid(std::string s) { 
    200     return true; 
     205    assert(m_deviceStringParser); 
     206    return m_deviceStringParser->isValidString(s); 
    201207} 
    202208 
     
    239245    } 
    240246    m_avDevices.clear(); 
     247 
     248    assert(m_deviceStringParser); 
     249    // show the spec strings we're going to use 
     250    if(getDebugLevel() >= DEBUG_LEVEL_VERBOSE) { 
     251        m_deviceStringParser->show(); 
     252    } 
    241253 
    242254    if (!slaveMode) { 
     
    282294                    } 
    283295                } 
    284                 if (already_in_vector) { 
     296                if(already_in_vector) { 
    285297                    debugWarning("Device with GUID %s already discovered on other port, skipping device...\n", 
    286298                                 configRom->getGuidString().c_str()); 
     
    288300                } 
    289301 
    290                 if( getDebugLevel() >= DEBUG_LEVEL_VERBOSE) { 
     302                if(getDebugLevel() >= DEBUG_LEVEL_VERBOSE) { 
    291303                    configRom->printConfigRomDebug(); 
    292304                } 
    293305 
     306                // if spec strings are given, only add those devices 
     307                // that match the spec string(s). 
     308                // if no (valid) spec strings are present, grab all 
     309                // supported devices. 
     310                if(m_deviceStringParser->countDeviceStrings() && 
     311                  !m_deviceStringParser->match(*configRom.get())) { 
     312                    debugOutput(DEBUG_LEVEL_VERBOSE, "Device doesn't match any of the spec strings. skipping...\n"); 
     313                    continue; 
     314                } 
     315 
     316                // find a driver 
    294317                FFADODevice* avDevice = getDriverForDevice( configRom, 
    295318                                                            nodeId ); 
     
    770793    Control::Element::setVerboseLevel(l); 
    771794    m_processorManager->setVerboseLevel(l); 
     795    m_deviceStringParser->setVerboseLevel(l); 
    772796    for ( FFADODeviceVectorIterator it = m_avDevices.begin(); 
    773797          it != m_avDevices.end(); 
  • trunk/libffado/src/devicemanager.h

    r932 r942  
    4343class Ieee1394Service; 
    4444class FFADODevice; 
     45class DeviceStringParser; 
     46 
    4547namespace Streaming { 
    4648    class StreamProcessor; 
     
    126128private: 
    127129    Streaming::StreamProcessorManager*  m_processorManager; 
     130    DeviceStringParser*                 m_deviceStringParser; 
    128131protected: 
    129     std::vector<std::string>          m_SpecStrings; 
     132    std::vector<std::string>            m_SpecStrings; 
    130133 
    131134    bool m_thread_realtime; 
  • trunk/libffado/src/SConscript

    r939 r942  
    3535        ffadodevice.cpp \ 
    3636        debugmodule/debugmodule.cpp \ 
     37        DeviceStringParser.cpp \ 
    3738        libavc/streamformat/avc_extended_stream_format.cpp \ 
    3839        libavc/musicsubunit/avc_descriptor_music.cpp \ 
  • trunk/libffado/tests/SConscript

    r939 r942  
    5353        "test-bufferops" : "test-bufferops.cpp", 
    5454        "test-watchdog" : "test-watchdog.cpp", 
     55        "test-devicestringparser" : "test-devicestringparser.cpp", 
    5556        "dumpiso_mod" : "dumpiso_mod.cpp" 
    5657}