tool/CommandSiiWrite.cpp
changeset 1151 1fc1535dec29
parent 1142 59be91dfcbe1
child 1155 bd4e5b544473
--- a/tool/CommandSiiWrite.cpp	Fri Jul 25 14:14:47 2008 +0000
+++ b/tool/CommandSiiWrite.cpp	Fri Jul 25 14:19:29 2008 +0000
@@ -51,6 +51,7 @@
 
 void CommandSiiWrite::execute(MasterDevice &m, const StringVector &args)
 {
+    SlaveList slaves;
     stringstream err;
     ec_ioctl_slave_sii_t data;
     ifstream file;
@@ -59,12 +60,14 @@
     uint16_t categoryType, categorySize;
     uint8_t crc;
 
-    if (slavePosition < 0) {
-        err << "'" << getName() << "' requires a slave! "
-            << "Please specify --slave.";
+    slaves = selectedSlaves(m);
+
+    if (slaves.size() != 1) {
+        err << "'" << getName() << "' requires a single slave ("
+            << slaves.size() << " selected).";
         throwInvalidUsageException(err);
     }
-    data.slave_position = slavePosition;
+    data.slave_position = slaves.front().position;
 
     if (args.size() != 1) {
         err << "'" << getName() << "' takes exactly one argument!";