mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-09-22 10:03:51 +08:00
Added getSingleMasterIndex() for command-line tool.
This commit is contained in:
@@ -82,7 +82,6 @@ string CommandFoeWrite::helpString() const
|
||||
|
||||
void CommandFoeWrite::execute(const StringVector &args)
|
||||
{
|
||||
MasterIndexList masterIndices;
|
||||
stringstream err;
|
||||
ec_ioctl_slave_foe_t data;
|
||||
ifstream file;
|
||||
@@ -94,13 +93,6 @@ void CommandFoeWrite::execute(const StringVector &args)
|
||||
throwInvalidUsageException(err);
|
||||
}
|
||||
|
||||
masterIndices = getMasterIndices();
|
||||
if (masterIndices.size() != 1) {
|
||||
err << getName() << " requires to select a single master!";
|
||||
throwInvalidUsageException(err);
|
||||
}
|
||||
MasterDevice m(masterIndices.front());
|
||||
|
||||
if (args[0] == "-") {
|
||||
loadFoeData(&data, cin);
|
||||
if (getOutputFile().empty()) {
|
||||
@@ -128,6 +120,7 @@ void CommandFoeWrite::execute(const StringVector &args)
|
||||
}
|
||||
}
|
||||
|
||||
MasterDevice m(getSingleMasterIndex());
|
||||
try {
|
||||
m.open(MasterDevice::ReadWrite);
|
||||
} catch (MasterDeviceException &e) {
|
||||
|
||||
Reference in New Issue
Block a user