tool/CommandSlaves.cpp
branchredundancy
changeset 2374 e898451c054a
parent 1968 4f682084c643
child 2421 bc2d4bf9cbe5
equal deleted inserted replaced
2373:593272e5a169 2374:e898451c054a
   142         const SlaveList &slaves,
   142         const SlaveList &slaves,
   143         bool doIndent
   143         bool doIndent
   144         )
   144         )
   145 {
   145 {
   146     ec_ioctl_master_t master;
   146     ec_ioctl_master_t master;
   147     unsigned int i;
   147     unsigned int i, lastDevice;
   148     ec_ioctl_slave_t slave;
   148     ec_ioctl_slave_t slave;
   149     uint16_t lastAlias, aliasIndex;
   149     uint16_t lastAlias, aliasIndex;
   150     Info info;
   150     Info info;
   151     typedef list<Info> InfoList;
   151     typedef list<Info> InfoList;
   152     InfoList infoList;
   152     InfoList infoList;
   182             info.relPos = str.str();
   182             info.relPos = str.str();
   183             str.str("");
   183             str.str("");
   184 
   184 
   185             info.state = alStateString(slave.al_state);
   185             info.state = alStateString(slave.al_state);
   186             info.flag = (slave.error_flag ? 'E' : '+');
   186             info.flag = (slave.error_flag ? 'E' : '+');
       
   187             info.device = slave.device_index;
   187 
   188 
   188             if (strlen(slave.name)) {
   189             if (strlen(slave.name)) {
   189                 info.name = slave.name;
   190                 info.name = slave.name;
   190             } else {
   191             } else {
   191                 str << "0x" << hex << setfill('0')
   192                 str << "0x" << hex << setfill('0')
   213 
   214 
   214     if (infoList.size() && doIndent) {
   215     if (infoList.size() && doIndent) {
   215         cout << "Master" << dec << m.getIndex() << endl;
   216         cout << "Master" << dec << m.getIndex() << endl;
   216     }
   217     }
   217 
   218 
       
   219     lastDevice = EC_DEVICE_MAIN;
   218     for (iter = infoList.begin(); iter != infoList.end(); iter++) {
   220     for (iter = infoList.begin(); iter != infoList.end(); iter++) {
       
   221         if (iter->device != lastDevice) {
       
   222             lastDevice = iter->device;
       
   223             cout << "xxx LINK FAILURE xxx" << endl;
       
   224         }
   219         cout << indent << setfill(' ') << right
   225         cout << indent << setfill(' ') << right
   220             << setw(maxPosWidth) << iter->pos << "  "
   226             << setw(maxPosWidth) << iter->pos << "  "
   221             << setw(maxAliasWidth) << iter->alias
   227             << setw(maxAliasWidth) << iter->alias
   222             << ":" << left
   228             << ":" << left
   223             << setw(maxRelPosWidth) << iter->relPos << "  "
   229             << setw(maxRelPosWidth) << iter->relPos << "  "
   243 
   249 
   244         if (si->alias)
   250         if (si->alias)
   245             cout << "Alias: " << si->alias << endl;
   251             cout << "Alias: " << si->alias << endl;
   246 
   252 
   247         cout
   253         cout
       
   254             << "Device: " << (si->device_index ? "Backup" : "Main") << endl
   248             << "State: " << alStateString(si->al_state) << endl
   255             << "State: " << alStateString(si->al_state) << endl
   249             << "Flag: " << (si->error_flag ? 'E' : '+') << endl
   256             << "Flag: " << (si->error_flag ? 'E' : '+') << endl
   250             << "Identity:" << endl
   257             << "Identity:" << endl
   251             << "  Vendor Id:       0x"
   258             << "  Vendor Id:       0x"
   252             << hex << setfill('0')
   259             << hex << setfill('0')
   330                 } else {
   337                 } else {
   331                     cout << "-";
   338                     cout << "-";
   332                 }
   339                 }
   333                 cout << "  " << setw(10);
   340                 cout << "  " << setw(10);
   334                 if (!si->ports[i].link.loop_closed) {
   341                 if (!si->ports[i].link.loop_closed) {
   335                     cout << si->ports[i].receive_time - si->ports[0].receive_time;
   342                     cout << si->ports[i].receive_time -
       
   343                         si->ports[0].receive_time;
   336                 } else {
   344                 } else {
   337                     cout << "-";
   345                     cout << "-";
   338                 }
   346                 }
   339                 cout << "  " << setw(10);
   347                 cout << "  " << setw(10);
   340                 if (!si->ports[i].link.loop_closed) {
   348                 if (!si->ports[i].link.loop_closed) {
   404             if (si->mailbox_protocols & EC_MBOX_COE) {
   412             if (si->mailbox_protocols & EC_MBOX_COE) {
   405                 cout << "  CoE details:" << endl
   413                 cout << "  CoE details:" << endl
   406                     << "    Enable SDO: "
   414                     << "    Enable SDO: "
   407                     << (si->coe_details.enable_sdo ? "yes" : "no") << endl
   415                     << (si->coe_details.enable_sdo ? "yes" : "no") << endl
   408                     << "    Enable SDO Info: "
   416                     << "    Enable SDO Info: "
   409                     << (si->coe_details.enable_sdo_info ? "yes" : "no") << endl
   417                     << (si->coe_details.enable_sdo_info ? "yes" : "no")
       
   418                     << endl
   410                     << "    Enable PDO Assign: "
   419                     << "    Enable PDO Assign: "
   411                     << (si->coe_details.enable_pdo_assign
   420                     << (si->coe_details.enable_pdo_assign
   412                             ? "yes" : "no") << endl
   421                             ? "yes" : "no") << endl
   413                     << "    Enable PDO Configuration: "
   422                     << "    Enable PDO Configuration: "
   414                     << (si->coe_details.enable_pdo_configuration
   423                     << (si->coe_details.enable_pdo_configuration