From 2957b9ad0c2b964318b3216d063b2ba7610af45a Mon Sep 17 00:00:00 2001 From: CĂ©line Buret Date: Tue, 6 Jul 2010 12:16:46 +0200 Subject: cleo/{app/{libspid,mgrd,plc},devkit/{doc,plcd,tests}}: closes #1723 Re-organize PLC Daemon for SET_KEY feature (from demo-2010-07 branch). Impacts on libspid, other daemons (managerd) and applications (plc). - modify specifications to communicate between daemons and applications, - re-organize plcd module, - add an assert macro in plcd module, - rename plc application into spidapp, - add a new libspid feature to handle inter-process signals, - modify managerd according to new communication with plcd. Updates relative to review are included in this commit. --- cleopatre/application/managerd/src/managerd.c | 19 ++++++++++++++----- cleopatre/application/managerd/src/simple_connect.c | 16 ++++++++++++++++ 2 files changed, 30 insertions(+), 5 deletions(-) (limited to 'cleopatre/application/managerd') diff --git a/cleopatre/application/managerd/src/managerd.c b/cleopatre/application/managerd/src/managerd.c index 4944cf21b0..31ae831f34 100644 --- a/cleopatre/application/managerd/src/managerd.c +++ b/cleopatre/application/managerd/src/managerd.c @@ -74,13 +74,22 @@ static int managerd_process(struct managerd_ctx *ctx) //Select result = select(ctx->sock_br + 3, &readfds, NULL, NULL, &timeout); - //Select error - if(0 > result) + /* Select error */ + if (0 > result) { - syslog(LOG_WARNING, "select failed (%s)", strerror(errno)); - return -1; + /* look for interrupt */ + if (EINTR == errno) + { + /* reset errno */ + errno = 0; + /* process interrupt */ + } + else + { + syslog (LOG_WARNING, "select failed (%s)", strerror (errno)); + return -1; + } } - else if(0 == result) { //No reception coming, take time to manage simple connect diff --git a/cleopatre/application/managerd/src/simple_connect.c b/cleopatre/application/managerd/src/simple_connect.c index bcbec17ffc..485768304f 100644 --- a/cleopatre/application/managerd/src/simple_connect.c +++ b/cleopatre/application/managerd/src/simple_connect.c @@ -59,10 +59,26 @@ int simple_connect_event(struct managerd_ctx *ctx) if(SC_BUTTON_ON == ctx->sc_gpio.gpioval.val) { libspid_config_write_item(LIBSPID_HPAV_INFO_PATH, LIBSPID_HPAV_INFO_LABEL_SC_BUTTON, "yes"); + + /* plc daemon needs to be informed */ + if (LIBSPID_SUCCESS != libspid_system_file_update_warn (getpid(), + LIBSPID_HPAV_INFO_PATH)) + { + syslog (LOG_WARNING, "libspid system file update warn failed"); + return -1; + } } else { libspid_config_write_item(LIBSPID_HPAV_INFO_PATH, LIBSPID_HPAV_INFO_LABEL_SC_BUTTON, "no"); + + /* plc daemon needs to be informed */ + if (LIBSPID_SUCCESS != libspid_system_file_update_warn (getpid(), + LIBSPID_HPAV_INFO_PATH)) + { + syslog (LOG_WARNING, "libspid system file update warn failed"); + return -1; + } } //Store GPIO value for next passage -- cgit v1.2.3