[package] collected: add modbus plugin.

This enables the modbus plugin of collectd and patches it so it works with the current version of libmodbus

Signed-off-by: Daniel Golle <daniel.golle@gmail.com>

git-svn-id: svn://svn.openwrt.org/openwrt/packages@26346 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
florian 2011-03-28 22:03:27 +00:00
parent 77e16b1ee5
commit b5f1d5b071
2 changed files with 30 additions and 0 deletions

View File

@ -84,6 +84,7 @@ COLLECTD_PLUGINS_SELECTED:= \
logfile \ logfile \
madwifi \ madwifi \
memory \ memory \
modbus \
mysql \ mysql \
netlink \ netlink \
network \ network \
@ -189,6 +190,11 @@ ifneq ($(CONFIG_PACKAGE_collectd-mod-netlink),)
CONFIGURE_ARGS+= --with-libnetlink="$(STAGING_DIR)/usr" CONFIGURE_ARGS+= --with-libnetlink="$(STAGING_DIR)/usr"
endif endif
# exception: mod-modbus needs libmodbus
ifneq ($(CONFIG_PACKAGE_collectd-mod-modbus),)
CONFIGURE_ARGS+= --with-libmodbus="$(STAGING_DIR)/usr"
endif
# exception: mod-onewire needs libow-capi # exception: mod-onewire needs libow-capi
ifneq ($(CONFIG_PACKAGE_collectd-mod-onewire),) ifneq ($(CONFIG_PACKAGE_collectd-mod-onewire),)
CONFIGURE_ARGS+= --with-libowcapi="$(STAGING_DIR)/usr" CONFIGURE_ARGS+= --with-libowcapi="$(STAGING_DIR)/usr"
@ -269,6 +275,7 @@ $(eval $(call BuildPlugin,logfile,log files output,logfile,))
$(eval $(call BuildPlugin,madwifi,MadWifi status input,madwifi,)) $(eval $(call BuildPlugin,madwifi,MadWifi status input,madwifi,))
$(eval $(call BuildPlugin,mysql,MySQL status input,mysql,+PACKAGE_collectd-mod-mysql:libmysqlclient)) $(eval $(call BuildPlugin,mysql,MySQL status input,mysql,+PACKAGE_collectd-mod-mysql:libmysqlclient))
$(eval $(call BuildPlugin,memory,physical memory usage input,memory,)) $(eval $(call BuildPlugin,memory,physical memory usage input,memory,))
$(eval $(call BuildPlugin,modbus,read variables through libmodbus,modbus,+PACKAGE_collectd-mod-modbus:libmodbus))
$(eval $(call BuildPlugin,netlink,netlink input,netlink,+PACKAGE_collectd-mod-netlink:ip @(!LINUX_2_4||BROKEN))) $(eval $(call BuildPlugin,netlink,netlink input,netlink,+PACKAGE_collectd-mod-netlink:ip @(!LINUX_2_4||BROKEN)))
$(eval $(call BuildPlugin,network,network input/output,network)) $(eval $(call BuildPlugin,network,network input/output,network))
$(eval $(call BuildPlugin,nginx,nginx status input,nginx,+PACKAGE_collectd-mod-nginx:libcurl)) $(eval $(call BuildPlugin,nginx,nginx status input,nginx,+PACKAGE_collectd-mod-nginx:libcurl))

View File

@ -0,0 +1,23 @@
--- a/src/modbus.c 2011-03-28 14:51:41.000000000 +0200
+++ b/src/modbus.c 2011-03-28 14:52:12.000000000 +0200
@@ -293,10 +293,8 @@
host->node, host->port);
modbus_init_tcp (&host->connection,
- /* host = */ host->node);
-#if 0
+ /* host = */ host->node,
/* port = */ host->port);
-#endif
status = modbus_connect (&host->connection);
if (status != 0)
@@ -366,7 +367,7 @@
{
status = read_holding_registers (&host->connection,
/* slave = */ slave->id, /* start_addr = */ data->register_base,
- /* num_registers = */ values_num, /* buffer = */ values);
+ /* num_registers = */ values_num, /* buffer = */ (uint16_t*)values);
if (status > 0)
break;