fp@1126: /***************************************************************************** fp@1126: * fp@1126: * $Id$ fp@1126: * fp@1126: ****************************************************************************/ fp@1126: fp@1126: #include fp@1126: using namespace std; fp@1126: fp@1126: #include "globals.h" fp@1126: fp@1126: /*****************************************************************************/ fp@1126: fp@1126: const char *help_data = fp@1126: "[OPTIONS]\n" fp@1126: "\n" fp@1126: "Output binary domain data.\n" fp@1126: "\n" fp@1126: "Command-specific options:\n" fp@1133: " --domain -d Positive numerical domain index, or 'all' for\n" fp@1133: " all domains (default). In this case, data of all\n" fp@1137: " domains are concatenated.\n" fp@1137: "\n" fp@1137: "Numerical values can be specified either with decimal (no prefix),\n" fp@1137: "octal (prefix '0') or hexadecimal (prefix '0x') base.\n"; fp@1126: fp@1126: /****************************************************************************/ fp@1126: fp@1126: void outputDomainData(unsigned int); fp@1126: fp@1126: /****************************************************************************/ fp@1126: fp@1126: void command_data() fp@1126: { fp@1126: masterDev.open(MasterDevice::Read); fp@1126: fp@1126: if (domainIndex == -1) { fp@1126: unsigned int i; fp@1126: ec_ioctl_master_t master; fp@1126: fp@1126: masterDev.getMaster(&master); fp@1126: fp@1126: for (i = 0; i < master.domain_count; i++) { fp@1126: outputDomainData(i); fp@1126: } fp@1126: } else { fp@1126: outputDomainData(domainIndex); fp@1126: } fp@1126: } fp@1126: fp@1126: /****************************************************************************/ fp@1126: fp@1126: void outputDomainData(unsigned int domainIndex) fp@1126: { fp@1126: ec_ioctl_domain_t domain; fp@1126: ec_ioctl_domain_data_t data; fp@1126: unsigned char *processData; fp@1126: unsigned int i; fp@1126: fp@1126: masterDev.getDomain(&domain, domainIndex); fp@1126: fp@1126: if (!domain.data_size) fp@1126: return; fp@1126: fp@1126: processData = new unsigned char[domain.data_size]; fp@1126: fp@1126: try { fp@1126: masterDev.getData(&data, domainIndex, domain.data_size, processData); fp@1126: } catch (MasterDeviceException &e) { fp@1126: delete [] processData; fp@1126: throw e; fp@1126: } fp@1126: fp@1126: for (i = 0; i < data.data_size; i++) fp@1126: cout << processData[i]; fp@1126: cout.flush(); fp@1126: fp@1126: delete [] processData; fp@1126: } fp@1126: fp@1126: /****************************************************************************/