equal
deleted
inserted
replaced
33 #include <iomanip> |
33 #include <iomanip> |
34 using namespace std; |
34 using namespace std; |
35 |
35 |
36 #include "CommandFoeRead.h" |
36 #include "CommandFoeRead.h" |
37 #include "foe.h" |
37 #include "foe.h" |
|
38 #include "MasterDevice.h" |
38 |
39 |
39 /*****************************************************************************/ |
40 /*****************************************************************************/ |
40 |
41 |
41 CommandFoeRead::CommandFoeRead(): |
42 CommandFoeRead::CommandFoeRead(): |
42 FoeCommand("foe_read", "Read a file from a slave via FoE.") |
43 FoeCommand("foe_read", "Read a file from a slave via FoE.") |
71 return str.str(); |
72 return str.str(); |
72 } |
73 } |
73 |
74 |
74 /****************************************************************************/ |
75 /****************************************************************************/ |
75 |
76 |
76 void CommandFoeRead::execute(MasterDevice &m, const StringVector &args) |
77 void CommandFoeRead::execute(const StringVector &args) |
77 { |
78 { |
78 SlaveList slaves; |
79 SlaveList slaves; |
79 ec_ioctl_slave_t *slave; |
80 ec_ioctl_slave_t *slave; |
80 ec_ioctl_slave_foe_t data; |
81 ec_ioctl_slave_foe_t data; |
81 unsigned int i; |
82 unsigned int i; |
84 if (args.size() != 1) { |
85 if (args.size() != 1) { |
85 err << "'" << getName() << "' takes exactly one argument!"; |
86 err << "'" << getName() << "' takes exactly one argument!"; |
86 throwInvalidUsageException(err); |
87 throwInvalidUsageException(err); |
87 } |
88 } |
88 |
89 |
|
90 if (getMasterIndices().size() != 1) { |
|
91 err << getName() << " requires to select a single master!"; |
|
92 throwInvalidUsageException(err); |
|
93 } |
|
94 MasterDevice m(getMasterIndices().front()); |
89 m.open(MasterDevice::Read); |
95 m.open(MasterDevice::Read); |
90 slaves = selectedSlaves(m); |
96 slaves = selectedSlaves(m); |
91 |
97 |
92 if (slaves.size() != 1) { |
98 if (slaves.size() != 1) { |
93 throwSingleSlaveRequired(slaves.size()); |
99 throwSingleSlaveRequired(slaves.size()); |