summaryrefslogtreecommitdiff
path: root/polux/devkit/plcd/src/plcd_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'polux/devkit/plcd/src/plcd_main.c')
-rw-r--r--polux/devkit/plcd/src/plcd_main.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/polux/devkit/plcd/src/plcd_main.c b/polux/devkit/plcd/src/plcd_main.c
index 861c45fb06..efdfe53594 100644
--- a/polux/devkit/plcd/src/plcd_main.c
+++ b/polux/devkit/plcd/src/plcd_main.c
@@ -116,12 +116,16 @@ main (int argc, char **argv)
/* show PLCD version */
syslog (LOG_NOTICE, "PLC Daemon (%s) Running\n", PLCD_VERSION);
- plcd_register_to_plcdrv ();
-
- while (!exit_requested)
- pause ();
+ /* Terminate the daemon when no feature is enable. */
+ if (plcd_autoswitch_timer_is_enable ())
+ {
+ plcd_register_to_plcdrv ();
+ while (!exit_requested)
+ pause ();
+ plcd_unregister_to_plcdrv ();
+ }
- plcd_unregister_to_plcdrv ();
+ syslog (LOG_NOTICE, "PLC Daemon exiting\n");
plcd_autoswitch_timer_uninit ();
plcd_uninit ();