tool/CommandSiiWrite.cpp
changeset 1826 ec6223c3b7ec
parent 1804 742607c464c4
child 1869 14f634f5b613
--- a/tool/CommandSiiWrite.cpp	Tue Feb 23 17:40:46 2010 +0100
+++ b/tool/CommandSiiWrite.cpp	Wed Feb 24 16:27:11 2010 +0100
@@ -34,6 +34,7 @@
 
 #include "CommandSiiWrite.h"
 #include "sii_crc.h"
+#include "MasterDevice.h"
 
 /*****************************************************************************/
 
@@ -75,7 +76,7 @@
 
 /****************************************************************************/
 
-void CommandSiiWrite::execute(MasterDevice &m, const StringVector &args)
+void CommandSiiWrite::execute(const StringVector &args)
 {
     stringstream err;
     ec_ioctl_slave_sii_t data;
@@ -87,6 +88,12 @@
         throwInvalidUsageException(err);
     }
 
+    if (getMasterIndices().size() != 1) {
+        err << getName() << " requires to select a single master!";
+        throwInvalidUsageException(err);
+    }
+    MasterDevice m(getMasterIndices().front());
+
     if (args[0] == "-") {
         loadSiiData(&data, cin);
     } else {