From 514d31cbd3e2db676cdf66f719cbd6292d137d81 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Tue, 9 Oct 2018 23:10:21 +0200 Subject: [PATCH] libarmbox: hdmi_cec fix device Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/851163927ed7d8f959f3a4052f2f9a62736cd45e Author: TangoCash Date: 2018-10-09 (Tue, 09 Oct 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libarmbox/hdmi_cec.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/libarmbox/hdmi_cec.cpp b/libarmbox/hdmi_cec.cpp index a30e115..5d45bc9 100644 --- a/libarmbox/hdmi_cec.cpp +++ b/libarmbox/hdmi_cec.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -110,7 +111,7 @@ bool hdmi_cec::SetCECMode(VIDEO_HDMI_CEC_MODE _deviceType) if (hdmiFd == -1) { - hdmiFd = open(CEC_DEVICE, O_RDWR | O_NONBLOCK); + hdmiFd = open(CEC_DEVICE, O_RDWR | O_CLOEXEC); } if (hdmiFd >= 0) @@ -462,6 +463,8 @@ bool hdmi_cec::Stop() return false; running = false; + + OpenThreads::Thread::cancel(); if (hdmiFd >= 0) { @@ -474,9 +477,16 @@ bool hdmi_cec::Stop() void hdmi_cec::run() { - while (running && (hdmiFd >= 0)) + OpenThreads::Thread::setCancelModeAsynchronous(); + struct pollfd pfd; + + pfd.fd = hdmiFd; + pfd.events = (POLLIN | POLLPRI); + + while (running) { - Receive(); + if (poll(&pfd, 1, 0) > 0) + Receive(); } }