[PATCH] utils/collectd: fix modbus plugin
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 29 Apr 2011 14:51:02 +0000 (14:51 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Fri, 29 Apr 2011 14:51:02 +0000 (14:51 +0000)
This patch makes some small corrections to my previous patch enabling the modbus plugin of collectd.
Signed-off-by: Daniel Golle <daniel.golle@gmail.com>
SVN-Revision: 26782

utils/collectd/Makefile
utils/collectd/patches/300-fix-modbus.patch

index 2dcc6c4e8bab82136955d5a876d74f5798ac405c..e7502c9beef9a51fbe0b498af3d5adeaeb45ba13 100644 (file)
@@ -15,7 +15,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://collectd.org/files/
 PKG_MD5SUM:=85d9d8d0a1327782661e3c89800aa70e
 
 PKG_SOURCE_URL:=http://collectd.org/files/
 PKG_MD5SUM:=85d9d8d0a1327782661e3c89800aa70e
 
-PKG_FIXUP:=libtool
+PKG_FIXUP:=autoreconf
 PKG_REMOVE_FILES:=aclocal.m4 libltdl/aclocal.m4
 
 PKG_INSTALL:=1
 PKG_REMOVE_FILES:=aclocal.m4 libltdl/aclocal.m4
 
 PKG_INSTALL:=1
index b1c8861f222bba1591a9f58c94d4a322152cf6b5..b935728c35fb9fb14de7efa07666909b21236a3e 100644 (file)
@@ -1,6 +1,17 @@
---- 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 @@
+--- a/src/modbus.c
++++ b/src/modbus.c
+@@ -281,10 +281,8 @@ static int mb_init_connection (mb_host_t
+   modbus_set_debug (&host->connection, 1);
+-#if 0
+   /* We'll do the error handling ourselves. */
+   modbus_set_error_handling (&host->connection, NOP_ON_ERROR);
+-#endif
+   if ((host->port < 1) || (host->port > 65535))
+     host->port = MODBUS_TCP_DEFAULT_PORT;
+@@ -293,10 +291,8 @@ static int mb_init_connection (mb_host_t
        host->node, host->port);
  
    modbus_init_tcp (&host->connection,
        host->node, host->port);
  
    modbus_init_tcp (&host->connection,
  
    status = modbus_connect (&host->connection);
    if (status != 0)
  
    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;
+@@ -325,7 +321,7 @@ static int mb_init_connection (mb_host_t
+ static int mb_read_data (mb_host_t *host, mb_slave_t *slave, /* {{{ */
+     mb_data_t *data)
+ {
+-  int values[2];
++  uint16_t values[2];
+   int values_num;
+   const data_set_t *ds;
+   int status;