Changeset 1336 for trunk/libffado/support/firmware
- Timestamp:
- 09/23/08 03:42:04 (16 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/support/firmware/bridgeco-downloader.cpp
r1234 r1336 42 42 const char *argp_program_bug_address = "<ffado-devel@lists.sf.net>"; 43 43 const char *doc = "bridgeco-downloader -- firmware downloader application for BridgeCo devices\n\n" 44 "OPERATION: display\n"45 " setguidGUID\n"46 " firmware FILE\n"47 " cne FILE\n"48 " bcd FILE\n";44 "OPERATION: GUID display\n" 45 " GUID setguid NEW_GUID\n" 46 " GUID firmware FILE\n" 47 " GUID cne FILE\n" 48 " GUID bcd FILE\n"; 49 49 static struct argp_option _options[] = { 50 50 {"verbose", 'v', "level", 0, "Produce verbose output" }, … … 88 88 ConfigRom configRom(service, i); 89 89 configRom.initialize(); 90 90 91 91 if (configRom.getGuid() == guid) 92 92 node_id = configRom.getNodeId(); … … 135 135 } else { 136 136 cout << "Firmware download was successful" << endl; 137 cout << "Please reboot the device by removing the power and firewire connections." << endl; 137 138 } 138 139 } else if ( strcmp( args->args[1], "cne" ) == 0 ) { … … 148 149 } else { 149 150 cout << "CnE download was successful" << endl; 151 cout << "Please reboot the device by removing the power and firewire connections." << endl; 150 152 } 151 153 } else if ( strcmp( args->args[1], "display" ) == 0 ) { trunk/libffado/support/firmware/fireworks-downloader.cpp
r1234 r1336 25 25 #include "downloader.h" 26 26 27 #include "config.h" 28 27 29 #include "src/fireworks/fireworks_device.h" 28 30 #include "src/fireworks/fireworks_firmware.h" 31 #include "src/fireworks/fireworks_session_block.h" 29 32 30 33 #include "libieee1394/configrom.h" 31 34 #include "libieee1394/ieee1394service.h" 35 #include "libutil/Configuration.h" 32 36 33 37 #include "debugmodule/debugmodule.h" … … 49 53 // arg parsing 50 54 //////////////////////////////////////////////// 51 const char *argp_program_version = "fireworks-downloader 0. 2";55 const char *argp_program_version = "fireworks-downloader 0.3"; 52 56 const char *argp_program_bug_address = "<ffado-devel@lists.sf.net>"; 53 57 const char *doc = "fireworks-downloader -- firmware downloader application for ECHO Fireworks devices\n\n" … … 67 71 " Verify that the firmware contained in the device corresponds\n" 68 72 " to the one contained in FILE\n" 73 " session_display\n" 74 " show information about the session on the device\n" 75 " session_info FILE\n" 76 " show information about the session in FILE\n" 77 " session_download FILE\n" 78 " Download the session content from the device to FILE\n" 79 " session_upload FILE\n" 80 " Upload the session from FILE to the device\n" 69 81 ; 70 82 … … 148 160 f.dumpData(); 149 161 return 0; 162 } else if ( strcmp( args->args[0], "session_info" ) == 0 ) { 163 if (!args->args[1] ) { 164 printMessage("FILE argument is missing\n"); 165 return -1; 166 } 167 std::string str( args->args[1] ); 168 169 // load the file 170 Session s = Session(); 171 s.setVerboseLevel( args->verbose ); 172 173 if (!s.loadFromFile(str)) { 174 printMessage("Could not load session\n"); 175 return -1; 176 } 177 s.show(); 178 return 0; 150 179 } else if ( strcmp( args->args[0], "list" ) == 0 ) { 151 180 printDeviceList(); … … 169 198 ConfigRom configRom(service, i); 170 199 configRom.initialize(); 171 172 200 if (configRom.getGuid() == guid) { 173 201 node_id = configRom.getNodeId(); … … 195 223 } 196 224 197 if ( !FireWorks::Device::probe(*configRom) ) { 225 Util::Configuration c; 226 c.openFile( USER_CONFIG_FILE, Util::Configuration::eFM_ReadOnly ); 227 c.openFile( SYSTEM_CONFIG_FILE, Util::Configuration::eFM_ReadOnly ); 228 229 if ( !FireWorks::Device::probe(c, *configRom) ) { 198 230 printMessage( "Device with node id %d is not an ECHO FireWorks device.\n", 199 231 node_id ); … … 201 233 return -1; 202 234 } 203 235 204 236 DeviceManager d = DeviceManager(); 205 237 Device *dev = new Device(d, std::auto_ptr<ConfigRom>(configRom) ); … … 382 414 printMessage(" => Verify successful. Firmware upload successful.\n"); 383 415 } 416 } else if ( strcmp( args->args[0], "session_display" ) == 0 ) { 417 // load the session 418 Session s = Session(); 419 s.setVerboseLevel( args->verbose ); 420 421 if (!s.loadFromDevice(*dev)) { 422 printMessage("Could not load session\n"); 423 return -1; 424 } 425 s.show(); 426 } else if ( strcmp( args->args[0], "session_download" ) == 0 ) { 427 if (!args->args[1] ) { 428 printMessage("FILE argument is missing\n"); 429 delete dev; 430 return -1; 431 } 432 std::string str( args->args[1] ); 433 434 printMessage("Downloading session to file: %s\n", str.c_str()); 435 436 printMessage(" loading session...\n"); 437 // load the session 438 Session s = Session(); 439 s.setVerboseLevel( args->verbose ); 440 441 if (!s.loadFromDevice(*dev)) { 442 printMessage("Could not load session from device\n"); 443 return -1; 444 } 445 446 printMessage(" saving session...\n"); 447 if (!s.saveToFile(str)) { 448 printMessage("Could not save session to file\n"); 449 return -1; 450 } 451 } else if ( strcmp( args->args[0], "session_upload" ) == 0 ) { 452 if (!args->args[1] ) { 453 printMessage("FILE argument is missing\n"); 454 delete dev; 455 return -1; 456 } 457 std::string str( args->args[1] ); 458 459 printMessage("Uploading session from file: %s\n", str.c_str()); 460 461 printMessage(" loading session...\n"); 462 // load the session 463 Session s = Session(); 464 s.setVerboseLevel( args->verbose ); 465 if (!s.loadFromFile(str)) { 466 printMessage("Could not load session from file\n"); 467 return -1; 468 } 469 470 printMessage(" saving session...\n"); 471 if (!s.saveToDevice(*dev)) { 472 printMessage("Could not save session to device\n"); 473 return -1; 474 } 475 384 476 } else { 385 477 printMessage("Unknown operation\n");