From: Bert Vermeulen Date: Mon, 5 Aug 2013 20:21:41 +0000 (+0200) Subject: sigrok: Change 'interval' option to 'MinimumInterval', and allow 0 X-Git-Tag: collectd-5.4.0~14^2~4 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1a31306f7634710d68d859b5a5d6218c350433c0;p=collectd.git sigrok: Change 'interval' option to 'MinimumInterval', and allow 0 A MinimumInterval of 0 means whatever the device sends gets dispatched to collectd. This is the default. --- diff --git a/src/sigrok.c b/src/sigrok.c index 001830d4..245a64c5 100644 --- a/src/sigrok.c +++ b/src/sigrok.c @@ -31,7 +31,7 @@ /* Minimum interval between dispatches coming from this plugin. The RRD * plugin, at least, complains when written to with sub-second intervals.*/ -#define DEFAULT_MIN_DISPATCH_INTERVAL TIME_T_TO_CDTIME_T(1) +#define DEFAULT_MIN_DISPATCH_INTERVAL TIME_T_TO_CDTIME_T(0) static pthread_t sr_thread; static int sr_thread_running = FALSE; @@ -94,7 +94,7 @@ static int sigrok_config_device(oconfig_item_t *ci) cf_util_get_string(item, &cfdev->conn); else if (!strcasecmp(item->key, "serialcomm")) cf_util_get_string(item, &cfdev->serialcomm); - else if (!strcasecmp(item->key, "interval")) + else if (!strcasecmp(item->key, "minimuminterval")) cf_util_get_cdtime(item, &cfdev->min_dispatch_interval); else WARNING("Invalid keyword '%s'.", item->key); @@ -183,7 +183,8 @@ static void sigrok_feed_callback(const struct sr_dev_inst *sdi, if (packet->type != SR_DF_ANALOG) return; - if (cdtime() - cfdev->last_dispatch < cfdev->min_dispatch_interval) + if (cfdev->min_dispatch_interval && \ + cdtime() - cfdev->last_dispatch < cfdev->min_dispatch_interval) return; /* Ignore all but the first sample on the first probe. */