| 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 | } |
---|