Open master device as late as possible.

This commit is contained in:
Florian Pose
2010-03-11 15:03:52 +01:00
parent fb8a75570d
commit ddaee8a1fc
27 changed files with 154 additions and 107 deletions
+4 -2
View File
@@ -80,6 +80,7 @@ string CommandSoeWrite::helpString() const
void CommandSoeWrite::execute(const StringVector &args)
{
MasterIndexList masterIndices;
stringstream strIdn, err;
const DataType *dataType = NULL;
ec_ioctl_slave_soe_write_t ioctl;
@@ -98,11 +99,12 @@ void CommandSoeWrite::execute(const StringVector &args)
throwInvalidUsageException(err);
}
if (getMasterIndices().size() != 1) {
masterIndices = getMasterIndices();
if (masterIndices.size() != 1) {
err << getName() << " requires to select a single master!";
throwInvalidUsageException(err);
}
MasterDevice m(getMasterIndices().front());
MasterDevice m(masterIndices.front());
m.open(MasterDevice::ReadWrite);
slaves = selectedSlaves(m);
if (slaves.size() != 1) {