From: Eric Sandeen Date: Wed, 28 Jan 2015 04:36:05 +0000 (-0600) Subject: modbus: rename register types once more X-Git-Tag: collectd-5.5.0~85 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e6553128adbed931c8ae36036d60e357868a9ec7;p=collectd.git modbus: rename register types once more 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 --- diff --git a/src/collectd.conf.in b/src/collectd.conf.in index 62cfb773..34cd24f8 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -627,8 +627,8 @@ # # # RegisterBase 1234 +# RegisterCmd ReadHolding # RegisterType float -# ModbusRegisterType holding # Type gauge # Instance "..." # diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index 85600664..356c6f5a 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -2890,7 +2890,7 @@ B RegisterBase 0 RegisterType float - ModbusRegisterType holding + RegisterCmd ReadHolding Type voltage Instance "input-1" @@ -2898,7 +2898,7 @@ B RegisterBase 2 RegisterType float - ModbusRegisterType holding + RegisterCmd ReadHolding Type voltage Instance "input-2" @@ -2906,7 +2906,7 @@ B RegisterBase 0 RegisterType Int16 - ModbusRegisterType holding + RegisterCmd ReadHolding Type temperature Instance "temp-1" @@ -2957,10 +2957,10 @@ Specifies what kind of data is returned by the device. If the type is B, B or B, two 16Ebit registers will be read and the data is combined into one value. Defaults to B. -=item B B|B +=item B B|B Specifies register type to be collected from device. Works only with libmodbus -2.9.2 or higher. Defaults to B. +2.9.2 or higher. Defaults to B. =item B I diff --git a/src/modbus.c b/src/modbus.c index 58919381..e24f2ec8 100644 --- a/src/modbus.c +++ b/src/modbus.c @@ -47,9 +47,9 @@ /* * * RegisterBase 1234 + * RegisterCmd ReadHolding * RegisterType float * Type gauge - * ModbusRegisterType holding * Instance "..." * * @@ -765,19 +765,19 @@ static int mb_config_add_data (oconfig_item_t *ci) /* {{{ */ 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 {