X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fonewire.c;h=1b7aee650b0ec5156103a5e268a041ad9d814418;hb=0fe1b2a1938c00413dc2cae4412c1de6674db006;hp=261457a1bb90cad631a236c8fc7014818b4f9c01;hpb=8f40e8dacad2bfcb9d659e12740aa3ebc15ada65;p=collectd.git diff --git a/src/onewire.c b/src/onewire.c index 261457a1..1b7aee65 100644 --- a/src/onewire.c +++ b/src/onewire.c @@ -44,7 +44,7 @@ typedef struct ow_family_features_s ow_family_features_t; /* see http://owfs.sourceforge.net/ow_table.html for a list of families */ static ow_family_features_t ow_family_features[] = { - { + { /* DS18S20 Precision Thermometer and DS1920 ibutton */ /* family = */ "10.", { { @@ -54,12 +54,56 @@ static ow_family_features_t ow_family_features[] = } }, /* features_num = */ 1 + }, + { /* DS1822 Econo Thermometer */ + /* family = */ "22.", + { + { + /* filename = */ "temperature", + /* type = */ "temperature", + /* type_instance = */ "" + } + }, + /* features_num = */ 1 + }, + { /* DS18B20 Programmable Resolution Thermometer */ + /* family = */ "28.", + { + { + /* filename = */ "temperature", + /* type = */ "temperature", + /* type_instance = */ "" + } + }, + /* features_num = */ 1 + }, + { /* DS2436 Volts/Temp */ + /* family = */ "1B.", + { + { + /* filename = */ "temperature", + /* type = */ "temperature", + /* type_instance = */ "" + } + }, + /* features_num = */ 1 + }, + { /* DS2438 Volts/Temp */ + /* family = */ "26.", + { + { + /* filename = */ "temperature", + /* type = */ "temperature", + /* type_instance = */ "" + } + }, + /* features_num = */ 1 } }; static int ow_family_features_num = STATIC_ARRAY_SIZE (ow_family_features); static char *device_g = NULL; -static int ow_interval = 0; +static cdtime_t ow_interval = 0; static const char *config_keys[] = { @@ -89,9 +133,7 @@ static int cow_load_config (const char *key, const char *value) else if (strcasecmp (key, "IgnoreSelected") == 0) { ignorelist_set_invert (sensor_list, 1); - if ((strcasecmp (value, "True") == 0) - || (strcasecmp (value, "Yes") == 0) - || (strcasecmp (value, "On") == 0)) + if (IS_TRUE (value)) ignorelist_set_invert (sensor_list, 0); } else if (strcasecmp (key, "Device") == 0) @@ -108,10 +150,10 @@ static int cow_load_config (const char *key, const char *value) } else if (strcasecmp ("Interval", key) == 0) { - int tmp; - tmp = atoi (value); - if (tmp > 0) - ow_interval = tmp; + double tmp; + tmp = atof (value); + if (tmp > 0.0) + ow_interval = DOUBLE_TO_CDTIME_T (tmp); else ERROR ("onewire plugin: Invalid `Interval' setting: %s", value); } @@ -308,12 +350,11 @@ static int cow_init (void) return (1); } - memset (&cb_interval, 0, sizeof (cb_interval)); - if (ow_interval > 0) - cb_interval.tv_sec = (time_t) ow_interval; + CDTIME_T_TO_TIMESPEC (ow_interval, &cb_interval); - plugin_register_complex_read ("onewire", cow_read, - &cb_interval, /* user data = */ NULL); + plugin_register_complex_read (/* group = */ NULL, "onewire", cow_read, + (ow_interval != 0) ? &cb_interval : NULL, + /* user data = */ NULL); plugin_register_shutdown ("onewire", cow_shutdown); return (0);