diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cec.c | 3 | ||||
-rw-r--r-- | src/hdmi_service.c | 19 |
2 files changed, 20 insertions, 2 deletions
@@ -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) |