# HG changeset patch # User Florian Pose # Date 1217247325 0 # Node ID f02ff486b31303123ba6993a73b45b6f69ebdb38 # Parent 25cc77cf39934ea6ed455e7e551fc66f4f9e86b2 Removed MasterDevice::slaveCount(). diff -r 25cc77cf3993 -r f02ff486b313 TODO --- a/TODO Mon Jul 28 12:11:50 2008 +0000 +++ b/TODO Mon Jul 28 12:15:25 2008 +0000 @@ -20,7 +20,6 @@ - Data type abbreviations. - Add a -n (numeric) switch. - Check for options, remove global variables. - - Remove MasterDevice::slaveCount(). - Add 'etherlab version'. Future issues: diff -r 25cc77cf3993 -r f02ff486b313 tool/Command.cpp --- a/tool/Command.cpp Mon Jul 28 12:11:50 2008 +0000 +++ b/tool/Command.cpp Mon Jul 28 12:15:25 2008 +0000 @@ -108,15 +108,18 @@ Command::SlaveList Command::selectedSlaves(MasterDevice &m) { - unsigned int numSlaves = m.slaveCount(), i, aliasIndex; + ec_ioctl_master_t master; + unsigned int i, aliasIndex; uint16_t lastAlias; ec_ioctl_slave_t slave; SlaveList list; + m.getMaster(&master); + if (alias == -1) { // no alias given if (position == -1) { // no alias and position given // all items - for (i = 0; i < numSlaves; i++) { + for (i = 0; i < master.slave_count; i++) { m.getSlave(&slave, i); list.push_back(slave); } @@ -129,7 +132,7 @@ if (position == -1) { // alias, but no position given // take all items with a given alias lastAlias = 0; - for (i = 0; i < numSlaves; i++) { + for (i = 0; i < master.slave_count; i++) { m.getSlave(&slave, i); if (slave.alias) { lastAlias = slave.alias; @@ -141,7 +144,7 @@ } else { // alias and position given lastAlias = 0; aliasIndex = 0; - for (i = 0; i < numSlaves; i++) { + for (i = 0; i < master.slave_count; i++) { m.getSlave(&slave, i); if (slave.alias && slave.alias == (uint16_t) alias) { lastAlias = slave.alias; diff -r 25cc77cf3993 -r f02ff486b313 tool/CommandSlaves.cpp --- a/tool/CommandSlaves.cpp Mon Jul 28 12:11:50 2008 +0000 +++ b/tool/CommandSlaves.cpp Mon Jul 28 12:15:25 2008 +0000 @@ -102,7 +102,8 @@ const SlaveList &slaves ) { - unsigned int numSlaves, i; + ec_ioctl_master_t master; + unsigned int i; ec_ioctl_slave_t slave; uint16_t lastAlias, aliasIndex; Info info; @@ -113,11 +114,11 @@ unsigned int maxPosWidth = 0, maxAliasWidth = 0, maxRelPosWidth = 0, maxStateWidth = 0; - numSlaves = m.slaveCount(); + m.getMaster(&master); lastAlias = 0; aliasIndex = 0; - for (i = 0; i < numSlaves; i++) { + for (i = 0; i < master.slave_count; i++) { m.getSlave(&slave, i); if (slave.alias) { diff -r 25cc77cf3993 -r f02ff486b313 tool/MasterDevice.cpp --- a/tool/MasterDevice.cpp Mon Jul 28 12:11:50 2008 +0000 +++ b/tool/MasterDevice.cpp Mon Jul 28 12:15:25 2008 +0000 @@ -68,16 +68,6 @@ /****************************************************************************/ -unsigned int MasterDevice::slaveCount() -{ - ec_ioctl_master_t data; - - getMaster(&data); - return data.slave_count; -} - -/****************************************************************************/ - void MasterDevice::getMaster(ec_ioctl_master_t *data) { if (ioctl(fd, EC_IOCTL_MASTER, data) < 0) { diff -r 25cc77cf3993 -r f02ff486b313 tool/MasterDevice.h --- a/tool/MasterDevice.h Mon Jul 28 12:11:50 2008 +0000 +++ b/tool/MasterDevice.h Mon Jul 28 12:15:25 2008 +0000 @@ -42,8 +42,6 @@ void open(Permissions); void close(); - unsigned int slaveCount(); - void getMaster(ec_ioctl_master_t *); void getConfig(ec_ioctl_config_t *, unsigned int); void getConfigPdo(ec_ioctl_config_pdo_t *, unsigned int, uint8_t,