diff --git a/src/modbus.c b/src/modbus.c
index 97b98b7c96c9f32feeda38122ab1c5970cd55b23..d538fb3f717774bbc36b6c2eb7b7e1ff0919bc85 100644 (file)
--- a/src/modbus.c
+++ b/src/modbus.c
if (host == NULL)
return (EINVAL);
if (host == NULL)
return (EINVAL);
+#if COLLECT_DEBUG
modbus_set_debug (&host->connection, 1);
modbus_set_debug (&host->connection, 1);
+#endif
/* We'll do the error handling ourselves. */
modbus_set_error_handling (&host->connection, NOP_ON_ERROR);
/* We'll do the error handling ourselves. */
modbus_set_error_handling (&host->connection, NOP_ON_ERROR);
}
}
}
}
+#if COLLECT_DEBUG
modbus_set_debug (host->connection, 1);
modbus_set_debug (host->connection, 1);
+#endif
/* We'll do the error handling ourselves. */
modbus_set_error_recovery (host->connection, 0);
/* We'll do the error handling ourselves. */
modbus_set_error_recovery (host->connection, 0);
if (ds->ds_num != 1)
{
if (ds->ds_num != 1)
{
- ERROR ("Modbus plugin: The type \"%s\" has %i data sources. "
+ ERROR ("Modbus plugin: The type \"%s\" has %zu data sources. "
"I can only handle data sets with only one data source.",
data->type, ds->ds_num);
return (-1);
"I can only handle data sets with only one data source.",
data->type, ds->ds_num);
return (-1);
{
user_data_t ud;
char name[1024];
{
user_data_t ud;
char name[1024];
- struct timespec interval = { 0, 0 };
ud.data = host;
ud.free_func = host_free;
ssnprintf (name, sizeof (name), "modbus-%s", host->host);
ud.data = host;
ud.free_func = host_free;
ssnprintf (name, sizeof (name), "modbus-%s", host->host);
- CDTIME_T_TO_TIMESPEC (host->interval, &interval);
-
plugin_register_complex_read (/* group = */ NULL, name,
/* callback = */ mb_read,
plugin_register_complex_read (/* group = */ NULL, name,
/* callback = */ mb_read,
- /* interval = */ (host->interval > 0) ? &interval : NULL,
+ /* interval = */ host->interval,
&ud);
}
else
&ud);
}
else