Removed the reading pause, added more details in the documentation.
authorNicolas JOURDEN <nicolas.jourden@laposte.net>
Thu, 3 Dec 2015 14:59:22 +0000 (15:59 +0100)
committerNicolas JOURDEN <nicolas.jourden@laposte.net>
Thu, 3 Dec 2015 14:59:22 +0000 (15:59 +0100)
src/collectd.conf.in
src/collectd.conf.pod
src/gps.c

index ebfc3ed..21cb111 100644 (file)
 #  Host "127.0.0.1"
 #  Port "2947"
 #  Timeout 0.015
-#  PauseRead    10
-#  PauseConnect 1
+#  PauseConnect 5
 #</Plugin>
 
 #<Plugin hddtemp>
index ef8256b..5193701 100644 (file)
@@ -2503,9 +2503,9 @@ instance "visible"). 0 means no GPS satellites are visible.
 
 =item B<dilution_of_precision>
 
-Vertical and horizontal dilution.
+Vertical and horizontal dilution (type instance "horizontal" or "vertical").
 It should be between 0 and 3.
-Look at the documentaiton of your GPS to know more.
+Look at the documentation of your GPS to know more.
 
 =back
 
@@ -2518,10 +2518,8 @@ Synopsis:
    Port "2947"
    # 15 ms timeout
    Timeout 0.015
-   # PauseRead of 5 sec. between readings:
-   PauseRead 5
-   # PauseConnect of 1 sec. between connection tentatives:
-   PauseConnect 1
+   # PauseConnect of 5 sec. between connection attempts.
+   PauseConnect 5
  </Plugin>
 
 Available configuration options:
@@ -2530,7 +2528,7 @@ Available configuration options:
 
 =item B<Host> I<Host>
 
-The host on which gpsd runs. Defaults to B<localhost>.
+The host on which gpsd daemon runs. Defaults to B<localhost>.
 
 =item B<Port> I<Port>
 
@@ -2540,13 +2538,17 @@ Port to connect to gpsd on the host machine. Defaults to B<2947>.
 
 Timeout in seconds (default 0.015 sec).
 
-=item B<PauseRead> I<Seconds>
+The GPS data stream is fetch by the plugin form the daemon.
+It waits for data to be available, if none arrives it times out 
+and loop for another reading.
+Mind to put a low value gpsd expects value in the micro-seconds area (500 us) since 
+the waiting function is blocking.
 
-Pause to apply between readings in seconds (default 1 sec).
+This only applies from gpsd release-2.95.
 
 =item B<PauseConnect> I<Seconds>
 
-Pause to apply between tentative of connection in seconds (default 1 sec).
+Pause to apply between attempts of connection to gpsd in seconds (default 5 sec).
 
 =back
 
index d0cec6c..82d4918 100644 (file)
--- a/src/gps.c
+++ b/src/gps.c
@@ -35,9 +35,8 @@
 #define CGPS_TRUE                  1
 #define CGPS_FALSE                 0
 #define CGPS_DEFAULT_HOST          "localhost"
-#define CGPS_DEFAULT_PORT          "2947"
+#define CGPS_DEFAULT_PORT          "2947" /* DEFAULT_GPSD_PORT */
 #define CGPS_DEFAULT_TIMEOUT       TIME_T_TO_CDTIME_T (0.015)
-#define CGPS_DEFAULT_PAUSE_READ    TIME_T_TO_CDTIME_T (1)
 #define CGPS_DEFAULT_PAUSE_CONNECT TIME_T_TO_CDTIME_T (5)
 #define CGPS_MAX_ERROR             100
 #define CGPS_CONFIG                "?WATCH={\"enable\":true,\"json\":true,\"nmea\":false}\r\n"
@@ -49,7 +48,6 @@ typedef struct {
   char *host;
   char *port;
   cdtime_t timeout;
-  cdtime_t pause_read;
   cdtime_t pause_connect;
 } cgps_config_t;
 
@@ -157,11 +155,6 @@ static void * cgps_thread (void * pData)
       if (!gps_waiting (&gpsd_conn))
 #endif
       {
-        if (cgps_thread_pause(cgps_config_data.pause_read) == CGPS_FALSE)
-        {
-          goto stop;
-        }
-
         continue;
       }
 
@@ -279,8 +272,6 @@ static int cgps_config (oconfig_item_t *ci)
       cf_util_get_service (child, &cgps_config_data.port);
     else if (strcasecmp ("Timeout", child->key) == 0)
       cf_util_get_cdtime (child, &cgps_config_data.timeout);
-    else if (strcasecmp ("Pauseread", child->key) == 0)
-      cf_util_get_cdtime (child, &cgps_config_data.pause_read);
     else if (strcasecmp ("PauseConnect", child->key) == 0)
       cf_util_get_cdtime (child, &cgps_config_data.pause_connect);
     else
@@ -303,11 +294,9 @@ static int cgps_init (void)
     return 0;
   }
 
-  DEBUG ("gps plugin: config{host: \"%s\", port: \"%s\", timeout: %.6f sec., \
-pause read: %.3f sec, pause connect: %.3f sec.}",
+  DEBUG ("gps plugin: config{host: \"%s\", port: \"%s\", timeout: %.6f sec., pause connect: %.3f sec.}",
          cgps_config_data.host, cgps_config_data.port,
          CDTIME_T_TO_DOUBLE (cgps_config_data.timeout),
-         CDTIME_T_TO_DOUBLE (cgps_config_data.pause_read),
          CDTIME_T_TO_DOUBLE (cgps_config_data.pause_connect));
 
   status = plugin_thread_create (&cgps_thread_id, NULL, cgps_thread, NULL);
@@ -354,7 +343,6 @@ void module_register (void)
   cgps_config_data.host = sstrdup (CGPS_DEFAULT_HOST);
   cgps_config_data.port = sstrdup (CGPS_DEFAULT_PORT);
   cgps_config_data.timeout = CGPS_DEFAULT_TIMEOUT;
-  cgps_config_data.pause_read = CGPS_DEFAULT_PAUSE_READ;
   cgps_config_data.pause_connect = CGPS_DEFAULT_PAUSE_CONNECT;
 
   plugin_register_complex_config ("gps", cgps_config);