From c04fe65fefb30a45d012ad23010d0e4455e4493c Mon Sep 17 00:00:00 2001 From: Bjarne von Horn Date: Wed, 20 Sep 2023 10:40:35 +0200 Subject: [PATCH] enable ip command in tool only if EC_EOE defined --- tool/Makefile.am | 10 ++++------ tool/MasterDevice.cpp | 2 ++ tool/MasterDevice.h | 2 ++ tool/main.cpp | 6 +++++- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/tool/Makefile.am b/tool/Makefile.am index 5961aabf..18a3acb6 100644 --- a/tool/Makefile.am +++ b/tool/Makefile.am @@ -49,7 +49,6 @@ ethercat_SOURCES = \ CommandFoeRead.cpp \ CommandFoeWrite.cpp \ CommandGraph.cpp \ - CommandIp.cpp \ CommandMaster.cpp \ CommandPdos.cpp \ CommandRegRead.cpp \ @@ -75,9 +74,9 @@ ethercat_SOURCES = \ sii_crc.cpp if ENABLE_EOE -ethercat_SOURCES += CommandEoe.cpp +ethercat_SOURCES += CommandEoe.cpp CommandIp.cpp else -EXTRA_DIST += CommandEoe.cpp +EXTRA_DIST += CommandEoe.cpp CommandIp.cpp endif noinst_HEADERS = \ @@ -93,7 +92,6 @@ noinst_HEADERS = \ CommandFoeRead.h \ CommandFoeWrite.h \ CommandGraph.h \ - CommandIp.h \ CommandMaster.h \ CommandPdos.h \ CommandRegRead.h \ @@ -118,9 +116,9 @@ noinst_HEADERS = \ sii_crc.h if ENABLE_EOE -noinst_HEADERS += CommandEoe.h +noinst_HEADERS += CommandEoe.h CommandIp.h else -EXTRA_DIST += CommandEoe.h +EXTRA_DIST += CommandEoe.h CommandIp.h endif REV = `if test -s $(top_srcdir)/revision; then \ diff --git a/tool/MasterDevice.cpp b/tool/MasterDevice.cpp index 4238affa..d5faa524 100644 --- a/tool/MasterDevice.cpp +++ b/tool/MasterDevice.cpp @@ -609,6 +609,7 @@ void MasterDevice::writeSoe(ec_ioctl_slave_soe_write_t *data) /****************************************************************************/ +#ifdef EC_EOE void MasterDevice::setIpParam(ec_ioctl_slave_eoe_ip_t *data) { if (ioctl(fd, EC_IOCTL_SLAVE_EOE_IP_PARAM, data) < 0) { @@ -621,5 +622,6 @@ void MasterDevice::setIpParam(ec_ioctl_slave_eoe_ip_t *data) } } } +#endif /*****************************************************************************/ diff --git a/tool/MasterDevice.h b/tool/MasterDevice.h index c0d6c694..0ad32420 100644 --- a/tool/MasterDevice.h +++ b/tool/MasterDevice.h @@ -94,6 +94,7 @@ class MasterDeviceSoeException: /****************************************************************************/ +#ifdef EC_EOE class MasterDeviceEoeException: public MasterDeviceException { @@ -108,6 +109,7 @@ class MasterDeviceEoeException: MasterDeviceException("EoE set IP parameter failed."), result(result) {}; }; +#endif /****************************************************************************/ diff --git a/tool/main.cpp b/tool/main.cpp index dc756071..0f6a0cb5 100644 --- a/tool/main.cpp +++ b/tool/main.cpp @@ -49,7 +49,9 @@ using namespace std; #include "CommandFoeRead.h" #include "CommandFoeWrite.h" #include "CommandGraph.h" -#include "CommandIp.h" +#ifdef EC_EOE +# include "CommandIp.h" +#endif #include "CommandMaster.h" #include "CommandPdos.h" #include "CommandRegRead.h" @@ -291,7 +293,9 @@ int main(int argc, char **argv) commandList.push_back(new CommandFoeRead()); commandList.push_back(new CommandFoeWrite()); commandList.push_back(new CommandGraph()); +#ifdef EC_EOE commandList.push_back(new CommandIp()); +#endif commandList.push_back(new CommandMaster()); commandList.push_back(new CommandPdos()); commandList.push_back(new CommandRegRead());