mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-02-06 03:41:52 +08:00
Added getSingleMasterIndex() for command-line tool.
This commit is contained in:
@@ -81,7 +81,6 @@ string CommandRegWrite::helpString() const
|
||||
|
||||
void CommandRegWrite::execute(const StringVector &args)
|
||||
{
|
||||
MasterIndexList masterIndices;
|
||||
stringstream strOffset, err;
|
||||
ec_ioctl_slave_reg_t data;
|
||||
ifstream file;
|
||||
@@ -101,13 +100,6 @@ void CommandRegWrite::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 (getDataType().empty()) {
|
||||
if (args[1] == "-") {
|
||||
loadRegData(&data, cin);
|
||||
@@ -157,6 +149,7 @@ void CommandRegWrite::execute(const StringVector &args)
|
||||
throwInvalidUsageException(err);
|
||||
}
|
||||
|
||||
MasterDevice m(getSingleMasterIndex());
|
||||
try {
|
||||
m.open(MasterDevice::ReadWrite);
|
||||
} catch (MasterDeviceException &e) {
|
||||
|
||||
Reference in New Issue
Block a user