summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPer Persson <per.xb.persson@stericsson.com>2011-09-21 14:02:43 +0200
committerJimmy RUBIN <jimmy.rubin@stericsson.com>2011-09-22 16:18:26 +0200
commit2466bb68976d078cc36ccddd98e2e3f1e55147b8 (patch)
tree1df37beb52342097c20665ec840028479238a020
parentabd83cca1d0f7f58d85eadc037d67fdf00860385 (diff)
HDMIservice: Improve error handling
CEC received message with invalid length is handled. Plug and unplug is filtered to avoid duplicate events. ST-Ericsson ID: 363062 ST-Ericsson FOSS-OUT ID: STETL-FOSS-OUT-10177 Change-Id: I989fab8e6b5504a5c4652aaac4f36d18fe8faa37 Signed-off-by: Per Persson <per.xb.persson@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/31658 Reviewed-by: QATOOLS Reviewed-by: QABUILD Reviewed-by: QATEST Reviewed-by: Jimmy RUBIN <jimmy.rubin@stericsson.com> Reviewed-by: Robert FEKETE <robert.fekete@stericsson.com>
-rw-r--r--src/cec.c3
-rw-r--r--src/hdmi_service.c19
2 files changed, 20 insertions, 2 deletions
diff --git a/src/cec.c b/src/cec.c
index 30c95d8..4b6acf5 100644
--- a/src/cec.c
+++ b/src/cec.c
@@ -155,6 +155,9 @@ int cecrx(void)
cecsize = read(cecreadfd, buf, sizeof(buf));
close(cecreadfd);
+ if (cecsize < 0)
+ return -1;
+
for (cnt = 0; cnt < cecsize; cnt++)
LOGHDMILIB2("cecrx[%d]:%x", cnt, buf[cnt]);
diff --git a/src/hdmi_service.c b/src/hdmi_service.c
index ac10fee..fd2b174 100644
--- a/src/hdmi_service.c
+++ b/src/hdmi_service.c
@@ -340,9 +340,15 @@ static int hdmiplugged_handle(int *basic_audio_support)
struct edid_latency edid_latency = {-1, -1, -1, -1};
int res;
int ret = 0;
+ enum hdmi_plug_state plug_state;
LOGHDMILIB("%s", "HDMIEVENT_HDMIPLUGGED");
+ if ((plugstate_get(&plug_state) == 0) && (plug_state == HDMI_PLUGGED)) {
+ LOGHDMILIB("%s", "Already plugged, ignore");
+ return -1;
+ }
+
plugstate_set(HDMI_PLUGGED);
*basic_audio_support = 0;
video_formats_clear();
@@ -466,7 +472,16 @@ hdmiplugged_handle_end:
static int hdmiunplugged_handle(void)
{
+ enum hdmi_plug_state plug_state;
+
LOGHDMILIB("%s", "HDMIEVENT_HDMIUNPLUGGED");
+
+ if ((plugstate_get(&plug_state) == 0) &&
+ (plug_state == HDMI_UNPLUGGED)) {
+ LOGHDMILIB("%s", "Already unplugged, ignore");
+ return -1;
+ }
+
plugstate_set(HDMI_UNPLUGGED);
/* Allow early suspend */
@@ -870,8 +885,8 @@ static void thread_main_fn(void *arg)
video_supported);
}
} else if (events & HDMIEVENT_HDMIUNPLUGGED) {
- hdmiunplugged_handle();
- plugevent_send(HDMI_UNPLUGGED_EV, 0, 0, NULL);
+ if (hdmiunplugged_handle() == 0)
+ plugevent_send(HDMI_UNPLUGGED_EV, 0, 0, NULL);
}
if (events & HDMIEVENT_CEC)