summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bbafc01)
raw | patch | inline | side by side (parent: bbafc01)
author | Eric Sandeen <sandeen@sandeen.net> | |
Wed, 28 Jan 2015 04:36:05 +0000 (22:36 -0600) | ||
committer | Marc Fournier <marc.fournier@camptocamp.com> | |
Mon, 2 Feb 2015 11:16:42 +0000 (12:16 +0100) |
As I was looking over my config files again, ModbusRegisterType
kind of stuck out like a sore thumb.
Modbus does talk about "read holding" and "read input" as "commands";
perhaps renaming it as this patch does is more intuitive, so that all
of the Modbus register configurations start with Register.
I'm not wedded to it, but if you like it & agree, here you go.
Thanks,
-Eric
kind of stuck out like a sore thumb.
Modbus does talk about "read holding" and "read input" as "commands";
perhaps renaming it as this patch does is more intuitive, so that all
of the Modbus register configurations start with Register.
I'm not wedded to it, but if you like it & agree, here you go.
Thanks,
-Eric
src/collectd.conf.in | patch | blob | history | |
src/collectd.conf.pod | patch | blob | history | |
src/modbus.c | patch | blob | history |
diff --git a/src/collectd.conf.in b/src/collectd.conf.in
index 62cfb77352476d86b4b5d3c1266fc9c06c659d43..34cd24f8c35344cd60c9e3c8b19c85d7bf3bed21 100644 (file)
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
#<Plugin modbus>
# <Data "data_name">
# RegisterBase 1234
+# RegisterCmd ReadHolding
# RegisterType float
-# ModbusRegisterType holding
# Type gauge
# Instance "..."
# </Data>
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 8560066470814f616612d50ce5708b16704a2087..356c6f5a8759838d550e1c28e71b386bdc7e750f 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
<Data "voltage-input-1">
RegisterBase 0
RegisterType float
- ModbusRegisterType holding
+ RegisterCmd ReadHolding
Type voltage
Instance "input-1"
</Data>
<Data "voltage-input-2">
RegisterBase 2
RegisterType float
- ModbusRegisterType holding
+ RegisterCmd ReadHolding
Type voltage
Instance "input-2"
</Data>
<Data "supply-temperature-1">
RegisterBase 0
RegisterType Int16
- ModbusRegisterType holding
+ RegisterCmd ReadHolding
Type temperature
Instance "temp-1"
</Data>
@@ -2957,10 +2957,10 @@ Specifies what kind of data is returned by the device. If the type is B<Int32>,
B<Uint32> or B<Float>, two 16E<nbsp>bit registers will be read and the data is
combined into one value. Defaults to B<Uint16>.
-=item B<ModbusRegisterType> B<holding>|B<input>
+=item B<RegisterCmd> B<ReadHolding>|B<ReadInput>
Specifies register type to be collected from device. Works only with libmodbus
-2.9.2 or higher. Defaults to B<holding>.
+2.9.2 or higher. Defaults to B<ReadHolding>.
=item B<Type> I<Type>
diff --git a/src/modbus.c b/src/modbus.c
index 589193811c3a827514a9a5d008ea6c3be419cb8e..e24f2ec867eaff8704d5c4995b77dc2d695948c8 100644 (file)
--- a/src/modbus.c
+++ b/src/modbus.c
/*
* <Data "data_name">
* RegisterBase 1234
+ * RegisterCmd ReadHolding
* RegisterType float
* Type gauge
- * ModbusRegisterType holding
* Instance "..."
* </Data>
*
status = -1;
}
}
- else if (strcasecmp ("ModbusRegisterType", child->key) == 0)
+ else if (strcasecmp ("RegisterCmd", child->key) == 0)
{
#if LEGACY_LIBMODBUS
- ERROR("Modbus plugin: ModbusRegisterType parameter can not be used "
+ ERROR("Modbus plugin: RegisterCmd parameter can not be used "
"with your libmodbus version");
#else
char tmp[16];
status = cf_util_get_string_buffer (child, tmp, sizeof (tmp));
if (status != 0)
/* do nothing */;
- else if (strcasecmp ("holding", tmp) == 0)
+ else if (strcasecmp ("ReadHolding", tmp) == 0)
data.modbus_register_type = MREG_HOLDING;
- else if (strcasecmp ("input", tmp) == 0)
+ else if (strcasecmp ("ReadInput", tmp) == 0)
data.modbus_register_type = MREG_INPUT;
else
{