tool/CommandRegWrite.cpp
changeset 1869 14f634f5b613
parent 1868 489ea0becd74
child 1870 0cee1fb7f0fd
equal deleted inserted replaced
1868:489ea0becd74 1869:14f634f5b613
    79 
    79 
    80 /****************************************************************************/
    80 /****************************************************************************/
    81 
    81 
    82 void CommandRegWrite::execute(const StringVector &args)
    82 void CommandRegWrite::execute(const StringVector &args)
    83 {
    83 {
       
    84 	MasterIndexList masterIndices;
    84     stringstream strOffset, err;
    85     stringstream strOffset, err;
    85     ec_ioctl_slave_reg_t data;
    86     ec_ioctl_slave_reg_t data;
    86     ifstream file;
    87     ifstream file;
    87     SlaveList slaves;
    88     SlaveList slaves;
    88 
    89 
    98     if (strOffset.fail()) {
    99     if (strOffset.fail()) {
    99         err << "Invalid offset '" << args[0] << "'!";
   100         err << "Invalid offset '" << args[0] << "'!";
   100         throwInvalidUsageException(err);
   101         throwInvalidUsageException(err);
   101     }
   102     }
   102   
   103   
   103     if (getMasterIndices().size() != 1) {
   104 	masterIndices = getMasterIndices();
       
   105     if (masterIndices.size() != 1) {
   104         err << getName() << " requires to select a single master!";
   106         err << getName() << " requires to select a single master!";
   105         throwInvalidUsageException(err);
   107         throwInvalidUsageException(err);
   106     }
   108     }
   107     MasterDevice m(getMasterIndices().front());
   109     MasterDevice m(masterIndices.front());
   108 
   110 
   109     if (getDataType().empty()) {
   111     if (getDataType().empty()) {
   110         if (args[1] == "-") {
   112         if (args[1] == "-") {
   111             loadRegData(&data, cin);
   113             loadRegData(&data, cin);
   112         } else {
   114         } else {