summaryrefslogtreecommitdiff
path: root/cleopatre
diff options
context:
space:
mode:
authorJulien Lacour2013-10-30 16:25:07 +0100
committerJulien Lacour2013-11-05 16:58:02 +0100
commit6eced8154010caa3caf58b89c921be3438b71289 (patch)
treeba9d94726d969c00c3df9d98a53dd059460e5f5e /cleopatre
parent482c9ec49877f8e7745d22042886e05b29d87239 (diff)
cleo/devkit/p1905: take care when push event comes from cmdu, closes #4257
When a PUSH BUTTON EVENT NOTIFICATION is sent, the process is different than a 'real' push button event. But hpav.info is modified anyway to inform plcd and managerd. And we don't want to start 'real' push button event process. So, this commit prevents that the hpav.info modification triggers the 'real' push button process if modification has been done because we received the PUSH BUTTON EVENT NOTIFICATION cmdu.
Diffstat (limited to 'cleopatre')
-rw-r--r--cleopatre/devkit/p1905_managerd/inc/p1905_managerd.h2
-rw-r--r--cleopatre/devkit/p1905_managerd/src/cmdu_message_parse.c1
-rw-r--r--cleopatre/devkit/p1905_managerd/src/p1905_push_button.c9
3 files changed, 12 insertions, 0 deletions
diff --git a/cleopatre/devkit/p1905_managerd/inc/p1905_managerd.h b/cleopatre/devkit/p1905_managerd/inc/p1905_managerd.h
index 4cc243b329..66b031109c 100644
--- a/cleopatre/devkit/p1905_managerd/inc/p1905_managerd.h
+++ b/cleopatre/devkit/p1905_managerd/inc/p1905_managerd.h
@@ -132,6 +132,8 @@ struct p1905_managerd_ctx {
/*push button use*/
union gpio_info sc_it;
push_button_param pbc_param;
+ int push_button_event_notify_by_msg;
+
unsigned short mid;
unsigned char need_relay;
diff --git a/cleopatre/devkit/p1905_managerd/src/cmdu_message_parse.c b/cleopatre/devkit/p1905_managerd/src/cmdu_message_parse.c
index 3d7eb5fa4a..8debdf6a1d 100644
--- a/cleopatre/devkit/p1905_managerd/src/cmdu_message_parse.c
+++ b/cleopatre/devkit/p1905_managerd/src/cmdu_message_parse.c
@@ -1730,6 +1730,7 @@ int parse_cmdu_message(struct p1905_managerd_ctx *ctx, unsigned char *buf,
break;
#endif
case P1905_PB_EVENT_NOTIFY:
+ syslog (LOG_NOTICE, "push button event notification\n");
if(ctx->pbc_param.is_sc)
{
ctx->need_relay = 1;
diff --git a/cleopatre/devkit/p1905_managerd/src/p1905_push_button.c b/cleopatre/devkit/p1905_managerd/src/p1905_push_button.c
index d33c43b9d5..ac23cfc9a1 100644
--- a/cleopatre/devkit/p1905_managerd/src/p1905_push_button.c
+++ b/cleopatre/devkit/p1905_managerd/src/p1905_push_button.c
@@ -55,6 +55,7 @@ int p1905_push_button_init(struct p1905_managerd_ctx *ctx)
}
ctx->pbc_param.is_sc = 0;
+ ctx->push_button_event_notify_by_msg = 0;
#ifdef SUPPORT_AP_REGISTRAR
ctx->pbc_param.wifi_info.no_need_start_pbc = 0;
@@ -88,6 +89,13 @@ int p1905_push_button_process(struct p1905_managerd_ctx *ctx)
unsigned char sta_num = 0;
#endif
+ if (ctx->push_button_event_notify_by_msg)
+ {
+ // Reset flag and do nothing.
+ // Process is done during notification parse.
+ ctx->push_button_event_notify_by_msg = 0;
+ return 0;
+ }
syslog (LOG_NOTICE, "push button process\n");
/*send 1905.1 push button event notification to eth port*/
ctx->mid ++;
@@ -162,6 +170,7 @@ int trigger_push_button_config_start(struct p1905_managerd_ctx *ctx)
syslog (LOG_WARNING, "libspid system file update warn failed");
return -1;
}
+ ctx->push_button_event_notify_by_msg = 1;
return 0;
}