summaryrefslogtreecommitdiff
path: root/cleopatre/application/managerd/src/managerd.c
diff options
context:
space:
mode:
Diffstat (limited to 'cleopatre/application/managerd/src/managerd.c')
-rw-r--r--cleopatre/application/managerd/src/managerd.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/cleopatre/application/managerd/src/managerd.c b/cleopatre/application/managerd/src/managerd.c
index 31ae831f34..42bb6dfd78 100644
--- a/cleopatre/application/managerd/src/managerd.c
+++ b/cleopatre/application/managerd/src/managerd.c
@@ -2,12 +2,12 @@
* cleopatre/application/managerd/src/managerd.c
*
* (C) Copyright 2009 SPiDCOM Technologies
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -59,7 +59,7 @@ static int managerd_process(struct managerd_ctx *ctx)
while(1)
{
- fd_set readfds;
+ fd_set readfds, exceptfds;
struct timeval timeout;
int result;
@@ -67,12 +67,14 @@ static int managerd_process(struct managerd_ctx *ctx)
timeout.tv_sec = WAIT_TOUT;
timeout.tv_usec = 0;
FD_ZERO(&readfds);
+ FD_ZERO (&exceptfds);
FD_SET(ctx->sock_br, &readfds);
FD_SET(ctx->sock_lo, &readfds);
FD_SET (ctx->sock_mme, &readfds);
+ FD_SET (ctx->gpio_fd, &exceptfds);
//Select
- result = select(ctx->sock_br + 3, &readfds, NULL, NULL, &timeout);
+ result = select (ctx->gpio_fd + 1, &readfds, NULL, &exceptfds, &timeout);
/* Select error */
if (0 > result)
@@ -90,13 +92,9 @@ static int managerd_process(struct managerd_ctx *ctx)
return -1;
}
}
- else if(0 == result)
+ else if (0 == result)
{
- //No reception coming, take time to manage simple connect
- if(0 > simple_connect_event(ctx))
- break;
- else
- continue;
+ /* No reception coming */
}
else if (FD_ISSET (ctx->sock_br, &readfds)
|| FD_ISSET (ctx->sock_lo, &readfds))
@@ -137,6 +135,14 @@ static int managerd_process(struct managerd_ctx *ctx)
break;
}
}
+ else if (FD_ISSET (ctx->gpio_fd, &exceptfds))
+ {
+ /* Manage simple connect */
+ if (0 > simple_connect_event (ctx))
+ break;
+ else
+ continue;
+ }
}
//Freeing buffer