Changeset 555

Show
Ignore:
Timestamp:
08/22/07 13:27:15 (16 years ago)
Author:
ppalmers
Message:

implement Focusrite specific AV/C commands

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/bebob/bebob_avdevice.h

    r554 r555  
    4747 
    4848#include "ffadodevice.h" 
     49 
     50#include "vendorspecific/focusrite.h" 
    4951 
    5052#include <sstream> 
  • trunk/libffado/src/debugmodule/debugmodule.h

    r554 r555  
    3434typedef short debug_level_t; 
    3535 
    36 #define DEBUG_MAX_MESSAGE_LENGTH 256 
     36#define DEBUG_MAX_MESSAGE_LENGTH 1024 
    3737 
    3838/* MB_NEXT() relies on the fact that MB_BUFFERS is a power of two */ 
  • trunk/libffado/src/Makefile.am

    r554 r555  
    5252        bebob/bebob_avdevice_subunit.h bebob/bebob_avplug.h bebob/bebob_dl_bcd.h bebob/bebob_dl_codes.h \ 
    5353        bebob/bebob_dl_mgr.h bebob/bebob_functionblock.h bounce/bounce_avdevice.h bounce/bounce_slave_avdevice.h bebob/bebob_configparser.h \ 
    54         bebob/GenericMixer.h
     54        bebob/GenericMixer.h bebob/vendorspecific/focusrite.h
    5555        maudio/maudio_avdevice.h motu/motu_avdevice.h rme/rme_avdevice.h \ 
    5656        metrichalo/mh_avdevice.h dice/dice_avdevice.h \ 
     
    7676        libavc/general/avc_subunit.h \ 
    7777        libavc/general/avc_plug.h \ 
     78        libavc/general/avc_vendor_dependent_cmd.h \ 
    7879        libavc/avc_definitions.h \ 
    7980        libavc/ccm/avc_signal_source.h \ 
     
    120121        libavc/general/avc_subunit.cpp \ 
    121122        libavc/general/avc_plug.cpp \ 
     123        libavc/general/avc_vendor_dependent_cmd.cpp \ 
    122124        libavc/avc_definitions.cpp \ 
    123125        libavc/ccm/avc_signal_source.cpp \ 
     
    164166            bebob/bebob_configparser.cpp \ 
    165167            bebob/GenericMixer.cpp \ 
     168            bebob/vendorspecific/focusrite.cpp \ 
    166169            maudio/maudio_avdevice.cpp 
    167170 
  • trunk/libffado/tests/test-ffado.cpp

    r554 r555  
    3636#include "ffadodevice.h" 
    3737 
     38#include "bebob/vendorspecific/focusrite.h" 
     39 
    3840#include <signal.h> 
    3941 
     
    8890static char doc[] = "FFADO -- a driver for Firewire Audio devices (test application)\n\n" 
    8991                    "OPERATION: Discover\n" 
    90                     "           SetSamplerate\n" 
     92                    "           SetSamplerate samplerate\n" 
    9193                    "           ListOscSpace\n" 
    92                     "           OscServer\n"; 
     94                    "           OscServer\n" 
     95                    "           FocusriteSetPhantom [0=ch1-4, 1=ch5-8] [1=on, 0=off]\n" 
     96                    ; 
    9397 
    9498// A description of the arguments we accept. 
     
    172176        break; 
    173177    case ARGP_KEY_ARG: 
    174         if (state->arg_num >= 2) { 
     178        if (state->arg_num >= 3) { 
    175179            // Too many arguments. 
    176180            argp_usage( state ); 
     
    359363 
    360364        printf("server stopped\n"); 
     365        delete m_deviceManager; 
     366        return exitfunction(0); 
     367    } else if ( strcmp( arguments.args[0], "FocusriteSetPhantom" ) == 0 ) { 
     368        char* tail; 
     369        int inputchannels = strtol( arguments.args[1], &tail, 0 ); 
     370        if ( errno ) { 
     371            fprintf( stderr,  "Could not parse inputchannels argument\n" ); 
     372            return exitfunction(-1); 
     373        } 
     374        int onoff = strtol( arguments.args[2], &tail, 0 ); 
     375        if ( errno ) { 
     376            fprintf( stderr,  "Could not parse on/off argument\n" ); 
     377            return exitfunction(-1); 
     378        } 
     379         
     380        DeviceManager *m_deviceManager = new DeviceManager(); 
     381        if ( !m_deviceManager ) { 
     382            fprintf( stderr, "Could not allocate device manager\n" ); 
     383            return exitfunction(-1); 
     384        } 
     385        if ( arguments.verbose ) { 
     386            m_deviceManager->setVerboseLevel(arguments.verbose); 
     387        } 
     388        if ( !m_deviceManager->initialize( arguments.port ) ) { 
     389            fprintf( stderr, "Could not initialize device manager\n" ); 
     390            delete m_deviceManager; 
     391            return exitfunction(-1); 
     392        } 
     393        if ( arguments.verbose ) { 
     394            m_deviceManager->setVerboseLevel(arguments.verbose); 
     395        } 
     396        if ( !m_deviceManager->discover() ) { 
     397            fprintf( stderr, "Could not discover devices\n" ); 
     398            delete m_deviceManager; 
     399            return exitfunction(-1); 
     400        } 
     401 
     402        if(arguments.node_id_set) { 
     403            FFADODevice* avDevice = m_deviceManager->getAvDevice( arguments.node_id ); 
     404            if ( avDevice ) { 
     405                if ( avDevice->getConfigRom().getNodeVendorId() == 0x00130e ) { 
     406                     
     407                    BeBoB::FocusriteVendorDependentCmd cmd( avDevice->get1394Service() ); 
     408                    cmd.setCommandType( AVC::AVCCommand::eCT_Control ); 
     409                    cmd.setNodeId( avDevice->getConfigRom().getNodeId() ); 
     410                    cmd.setVerbose( arguments.verbose ); 
     411                     
     412//                         if (inputchannels) { 
     413//                             cmd.m_id=99; 
     414//                         } else { 
     415//                             cmd.m_id=98; 
     416//                         } 
     417//                         if (onoff) { 
     418//                             cmd.m_value=1; 
     419//                         } else { 
     420//                             cmd.m_value=0; 
     421//                         } 
     422                        cmd.m_id=inputchannels; 
     423                        cmd.m_value=onoff; 
     424                     
     425                    if ( !cmd.fire() ) { 
     426                        debugError( "FocusriteVendorDependentCmd info command failed\n" ); 
     427                        // shouldn't this be an error situation? 
     428                        return exitfunction(-1); 
     429                    } 
     430 
     431                } else { 
     432                    fprintf( stderr, "Not a Focusrite device: id=0x%06X ...\n", avDevice->getConfigRom().getNodeVendorId()); 
     433                } 
     434            } 
     435        } else { 
     436            int i=0; 
     437 
     438            int devices_on_bus = m_deviceManager->getNbDevices(); 
     439            printf("  port = %d, devices_on_bus = %d\n", arguments.port, devices_on_bus); 
     440 
     441            for(i=0;i<devices_on_bus;i++) { 
     442                int node_id=m_deviceManager->getDeviceNodeId(i); 
     443                printf("  set phantom power for device = %d, node = %d\n", i, node_id); 
     444                FFADODevice* avDevice = m_deviceManager->getAvDevice( arguments.node_id ); 
     445                if ( avDevice ) { 
     446                    if ( avDevice->getConfigRom().getNodeVendorId() == 0x00130e ) { 
     447                         
     448                        BeBoB::FocusriteVendorDependentCmd cmd( avDevice->get1394Service() ); 
     449                        cmd.setCommandType( AVC::AVCCommand::eCT_Control ); 
     450                        cmd.setNodeId( avDevice->getConfigRom().getNodeId() ); 
     451                        cmd.setVerbose( arguments.verbose ); 
     452                         
     453//                         if (inputchannels) { 
     454//                             cmd.m_id=99; 
     455//                         } else { 
     456//                             cmd.m_id=98; 
     457//                         } 
     458//                         if (onoff) { 
     459//                             cmd.m_value=1; 
     460//                         } else { 
     461//                             cmd.m_value=0; 
     462//                         } 
     463                        cmd.m_id=inputchannels; 
     464                        cmd.m_value=onoff; 
     465                         
     466                        if ( !cmd.fire() ) { 
     467                            debugError( "FocusriteVendorDependentCmd info command failed\n" ); 
     468                            // shouldn't this be an error situation? 
     469                            return exitfunction(-1); 
     470                        } 
     471     
     472                    } else { 
     473                        fprintf( stderr, "Not a Focusrite device: id=0x%06X ...\n", avDevice->getConfigRom().getNodeVendorId()); 
     474                    } 
     475                } 
     476 
     477            } 
     478        } 
    361479        delete m_deviceManager; 
    362480        return exitfunction(0);