diff -r 7ffbca63fc72 -r 59be91dfcbe1 tool/cmd_data.cpp --- a/tool/cmd_data.cpp Thu Jul 24 08:15:44 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/***************************************************************************** - * - * $Id$ - * - ****************************************************************************/ - -#include -using namespace std; - -#include "globals.h" - -/*****************************************************************************/ - -const char *help_data = - "[OPTIONS]\n" - "\n" - "Output binary domain data.\n" - "\n" - "Command-specific options:\n" - " --domain -d Positive numerical domain index, or 'all' for\n" - " all domains (default). In this case, data of all\n" - " domains are concatenated.\n" - "\n" - "Numerical values can be specified either with decimal (no prefix),\n" - "octal (prefix '0') or hexadecimal (prefix '0x') base.\n"; - -/****************************************************************************/ - -void outputDomainData(unsigned int); - -/****************************************************************************/ - -void command_data() -{ - masterDev.open(MasterDevice::Read); - - if (domainIndex == -1) { - unsigned int i; - ec_ioctl_master_t master; - - masterDev.getMaster(&master); - - for (i = 0; i < master.domain_count; i++) { - outputDomainData(i); - } - } else { - outputDomainData(domainIndex); - } -} - -/****************************************************************************/ - -void outputDomainData(unsigned int domainIndex) -{ - ec_ioctl_domain_t domain; - ec_ioctl_domain_data_t data; - unsigned char *processData; - unsigned int i; - - masterDev.getDomain(&domain, domainIndex); - - if (!domain.data_size) - return; - - processData = new unsigned char[domain.data_size]; - - try { - masterDev.getData(&data, domainIndex, domain.data_size, processData); - } catch (MasterDeviceException &e) { - delete [] processData; - throw e; - } - - for (i = 0; i < data.data_size; i++) - cout << processData[i]; - cout.flush(); - - delete [] processData; -} - -/****************************************************************************/