From f8c01b325167f757ea97580dbcc69f2f79ee8800 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Thu, 4 Sep 2025 11:29:13 -0400 Subject: [PATCH 01/21] Feature/rdkemw 7169 (#245) * RDKEMW-7169 - Gtest Add missing empty files * RDKEMW-7169 - Gtest Add missing empty files * RDKEMW-7169 - Gtest Add missing empty files * RDKEMW-7169 - Gtest Add missing empty files * RDKEMW-7169 - Gtest Add missing empty files --------- Co-authored-by: Srikanth <107277821+srikanth-vv@users.noreply.github.com> --- build_dependencies.sh | 2 -- cov_build.sh | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/build_dependencies.sh b/build_dependencies.sh index d75c69d3..2ba9a85d 100644 --- a/build_dependencies.sh +++ b/build_dependencies.sh @@ -163,8 +163,6 @@ touch telemetry_busmessage_sender.h touch maintenanceMGR.h touch pkg.h touch edid-parser.hpp -touch drm.h -touch drm_mode.h touch secure_wrapper.h touch wpa_ctrl.h touch btmgr.h diff --git a/cov_build.sh b/cov_build.sh index bde2bce8..66632fce 100644 --- a/cov_build.sh +++ b/cov_build.sh @@ -37,6 +37,7 @@ cmake -G Ninja -S "$GITHUB_WORKSPACE" -B build/entservices-inputoutput \ -I ${GITHUB_WORKSPACE}/entservices-testframework/Tests/mocks \ -I ${GITHUB_WORKSPACE}/entservices-testframework/Tests/mocks/thunder \ -I ${GITHUB_WORKSPACE}/entservices-testframework/Tests/mocks/devicesettings \ +-I /usr/include/libdrm \ -include ${GITHUB_WORKSPACE}/entservices-testframework/Tests/mocks/devicesettings.h \ -include ${GITHUB_WORKSPACE}/entservices-testframework/Tests/mocks/Iarm.h \ -include ${GITHUB_WORKSPACE}/entservices-testframework/Tests/mocks/Rfc.h \ From 7a0d569f253b8a08926e959509e329159aa2d509 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 4 Sep 2025 15:29:46 +0000 Subject: [PATCH 02/21] 1.4.6 release changelog updates --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index db5bc7b0..d9bb2734 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,17 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [1.4.6](https://github.com/rdkcentral/entservices-inputoutput/compare/1.4.5...1.4.6) + +- Feature/rdkemw 7169 [`#245`](https://github.com/rdkcentral/entservices-inputoutput/pull/245) +- Merge tag '1.4.5' into develop [`7268514`](https://github.com/rdkcentral/entservices-inputoutput/commit/7268514652bf9f0cda3f3a6433a0f0720bf9d63c) + #### [1.4.5](https://github.com/rdkcentral/entservices-inputoutput/compare/1.4.4...1.4.5) +> 3 September 2025 + - RDKEMW-7169 - Gtest Add missing empty files [`#241`](https://github.com/rdkcentral/entservices-inputoutput/pull/241) +- 1.4.5 release changelog updates [`4354afa`](https://github.com/rdkcentral/entservices-inputoutput/commit/4354afac08c4671cbed356d81a2ed2f612139464) - Merge tag '1.4.4' into develop [`0fabfaf`](https://github.com/rdkcentral/entservices-inputoutput/commit/0fabfaf0816dda67077fd7fe59e074a962e644ef) #### [1.4.4](https://github.com/rdkcentral/entservices-inputoutput/compare/1.4.3...1.4.4) From b334b82725cb404c3b29f0c9f4eed123646f3c36 Mon Sep 17 00:00:00 2001 From: arjunbinu <51983664+arjunbinu@users.noreply.github.com> Date: Fri, 22 Aug 2025 13:02:25 +0100 Subject: [PATCH 03/21] RDKEMW-7712: Sync low latency for AVOutput initialization (#6338) --- AVOutput/AVOutputTVHelper.cpp | 7 +++++++ AVOutput/CHANGELOG.md | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/AVOutput/AVOutputTVHelper.cpp b/AVOutput/AVOutputTVHelper.cpp index 6fbcbab0..5c5e5b3e 100644 --- a/AVOutput/AVOutputTVHelper.cpp +++ b/AVOutput/AVOutputTVHelper.cpp @@ -1209,6 +1209,13 @@ namespace Plugin { LOGERR("Backlight Sync to cache Failed !!!\n"); } + if( !updateAVoutputTVParam("sync","LowLatencyState",info,PQ_PARAM_LOWLATENCY_STATE,level) ) { + LOGINFO("LowLatencyState Successfully Synced to Drive Cache\n"); + } + else { + LOGERR("LowLatencyState Sync to cache Failed !!!\n"); + } + syncCMSParams(); //sync CMS syncWBParams(); diff --git a/AVOutput/CHANGELOG.md b/AVOutput/CHANGELOG.md index cf722532..7daed548 100644 --- a/AVOutput/CHANGELOG.md +++ b/AVOutput/CHANGELOG.md @@ -14,6 +14,11 @@ All notable changes to this RDK Service will be documented in this file. * Changes in CHANGELOG should be updated when commits are added to the main or release branches. There should be one CHANGELOG entry per JIRA Ticket. This is not enforced on sprint branches since there could be multiple changes for the same JIRA ticket during development. +<<<<<<< HEAD +## [1.1.4] - 2025-09-08 +### Fixed +- Sync low latency for AVOutput initialization + ## [1.1.3] - 2025-08-08 ### Fixed - Fixed getDolbyVisionMode() for non DV content From 597942340c4b1ab704fe1220b956803aa10cb60f Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 9 Sep 2025 16:02:42 +0000 Subject: [PATCH 04/21] 1.4.7 release changelog updates --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9bb2734..867461dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,17 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [1.4.7](https://github.com/rdkcentral/entservices-inputoutput/compare/1.4.6...1.4.7) + +- RDKEMW-7712: Sync low latency for AVOutput initialization (#6338) [`#249`](https://github.com/rdkcentral/entservices-inputoutput/pull/249) +- Merge tag '1.4.6' into develop [`bef0aa3`](https://github.com/rdkcentral/entservices-inputoutput/commit/bef0aa3bf2638d0223008f10babecde595d850df) + #### [1.4.6](https://github.com/rdkcentral/entservices-inputoutput/compare/1.4.5...1.4.6) +> 4 September 2025 + - Feature/rdkemw 7169 [`#245`](https://github.com/rdkcentral/entservices-inputoutput/pull/245) +- 1.4.6 release changelog updates [`7a0d569`](https://github.com/rdkcentral/entservices-inputoutput/commit/7a0d569f253b8a08926e959509e329159aa2d509) - Merge tag '1.4.5' into develop [`7268514`](https://github.com/rdkcentral/entservices-inputoutput/commit/7268514652bf9f0cda3f3a6433a0f0720bf9d63c) #### [1.4.5](https://github.com/rdkcentral/entservices-inputoutput/compare/1.4.4...1.4.5) From 919f2dedd8decc0f9aca75439d68d78067552c62 Mon Sep 17 00:00:00 2001 From: karuppaiya kaliyaperumal Date: Thu, 4 Sep 2025 17:38:40 +0530 Subject: [PATCH 05/21] CEC source and sink changes --- HdmiCecSink/HdmiCecSink.cpp | 22 +++++++++++++- HdmiCecSink/HdmiCecSink.h | 3 +- HdmiCecSource/HdmiCecSourceImplementation.cpp | 30 +++++++++++++++++++ HdmiCecSource/HdmiCecSourceImplementation.h | 5 +++- 4 files changed, 57 insertions(+), 3 deletions(-) diff --git a/HdmiCecSink/HdmiCecSink.cpp b/HdmiCecSink/HdmiCecSink.cpp index a1ac6a75..45d3afbd 100644 --- a/HdmiCecSink/HdmiCecSink.cpp +++ b/HdmiCecSink/HdmiCecSink.cpp @@ -753,7 +753,11 @@ namespace WPEFramework int err; dsHdmiInGetNumberOfInputsParam_t hdmiInput; +#ifdef IO_HCEC_ENABLE_IARM InitializeIARM(); +#else + device::Host::getInstance().Register(this, "WPE[HdmiCecSink]"); +#endif /* IO_HCEC_ENABLE_IARM */ m_sendKeyEventThreadExit = false; m_sendKeyEventThread = std::thread(threadSendKeyEvent); @@ -879,7 +883,12 @@ namespace WPEFramework } HdmiCecSink::_instance = nullptr; - DeinitializeIARM(); +#ifdef IO_HCEC_ENABLE_IARM + DeinitializeIARM(); +#else + device::Host::getInstance().UnRegister(this); +#endif /* IO_HCEC_ENABLE_IARM */ + LOGWARN(" HdmiCecSink Deinitialize() Done"); } @@ -920,6 +929,7 @@ namespace WPEFramework } } +#ifdef IO_HCEC_ENABLE_IARM void HdmiCecSink::dsHdmiEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len) { if(!HdmiCecSink::_instance) @@ -934,6 +944,16 @@ namespace WPEFramework HdmiCecSink::_instance->onHdmiHotPlug(portId,isHdmiConnected); } } +#else + void HdmiCecSink::OnHdmiInEventHotPlug(dsHdmiInPort_t port, bool isConnected) + { + if(!HdmiCecSink::_instance) + return; + + LOGINFO("Received IARM_BUS_DSMGR_EVENT_HDMI_IN_HOTPLUG event port: %d isConnected: %d \r\n", port, isConnected); + HdmiCecSink::_instance->onHdmiHotPlug((int) port, (int) isConnected); + } +#endif /* IO_HCEC_ENABLE_IARM */ void HdmiCecSink::onPowerModeChanged(const PowerState currentState, const PowerState newState) { diff --git a/HdmiCecSink/HdmiCecSink.h b/HdmiCecSink/HdmiCecSink.h index 2bc6d7c6..20761536 100644 --- a/HdmiCecSink/HdmiCecSink.h +++ b/HdmiCecSink/HdmiCecSink.h @@ -482,7 +482,7 @@ namespace WPEFramework { // As the registration/unregistration of notifications is realized by the class PluginHost::JSONRPC, // this class exposes a public method called, Notify(), using this methods, all subscribed clients // will receive a JSONRPC message as a notification, in case this method is called. - class HdmiCecSink : public PluginHost::IPlugin, public PluginHost::JSONRPC { + class HdmiCecSink : public PluginHost::IPlugin, public PluginHost::JSONRPC, device::Host::IHdmiInEvents { enum { POLL_THREAD_STATE_NONE, @@ -530,6 +530,7 @@ namespace WPEFramework { virtual const string Initialize(PluginHost::IShell* shell) override; virtual void Deinitialize(PluginHost::IShell* service) override; virtual string Information() const override { return {}; } + virtual void OnHdmiInEventHotPlug(dsHdmiInPort_t port, bool isConnected) override; static HdmiCecSink* _instance; CECDeviceParams deviceList[16]; std::vector hdmiInputs; diff --git a/HdmiCecSource/HdmiCecSourceImplementation.cpp b/HdmiCecSource/HdmiCecSourceImplementation.cpp index 4a4e3e64..e933a0c2 100644 --- a/HdmiCecSource/HdmiCecSourceImplementation.cpp +++ b/HdmiCecSource/HdmiCecSourceImplementation.cpp @@ -390,7 +390,12 @@ namespace WPEFramework } _registeredEventHandlers = false; +#ifdef IO_HCEC_ENABLE_IARM DeinitializeIARM(); +#else + device::Host::getInstance().UnRegister(this); +#endif /* IO_HCEC_ENABLE_IARM */ + } Core::hresult HdmiCecSourceImplementation::Configure(PluginHost::IShell* service) @@ -409,7 +414,9 @@ namespace WPEFramework logicalAddress = 0xFF; //CEC plugin functionalities will only work if CECmgr is available. If plugin Initialize failure upper layer will call dtor directly. +#ifdef IO_HCEC_ENABLE_IARM InitializeIARM(); +#endif /* IO_HCEC_ENABLE_IARM */ InitializePowerManager(service); // load persistence setting @@ -418,6 +425,11 @@ namespace WPEFramework { //TODO(MROLLINS) this is probably per process so we either need to be running in our own process or be carefull no other plugin is calling it device::Manager::Initialize(); + +#ifndef IO_HCEC_ENABLE_IARM + device::Host::getInstance().Register(this, "WPE[HdmiCecSource]"); +#endif /* IO_HCEC_ENABLE_IARM */ + std::string strVideoPort = device::Host::getInstance().getDefaultVideoPortName(); device::VideoOutputPort vPort = device::Host::getInstance().getVideoOutputPort(strVideoPort.c_str()); if (vPort.isDisplayConnected()) @@ -759,6 +771,7 @@ namespace WPEFramework LOGINFO("Exit threadHotPlugEventHandler \r\n"); } +#ifdef IO_HCEC_ENABLE_IARM void HdmiCecSourceImplementation::dsHdmiEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len) { if(!HdmiCecSourceImplementation::_instance || !_instance->cecEnableStatus) @@ -779,7 +792,24 @@ namespace WPEFramework } } } +#else + void HdmiCecSourceImplementation::OnDisplayHDMIHotPlug(dsDisplayEvent_t displayEvent) + { + LOGINFO("OnDisplayHDMIHotPlug : displayEvent = %d ", displayEvent); + if(!HdmiCecSourceImplementation::_instance || !_instance->cecEnableStatus) + { + LOGINFO("Return from dsHdmiEventHandler due HdmiCecSourceImplementation::_instance:%p cecEnableStatus:%d \r\n", HdmiCecSourceImplementation::_instance, _instance->cecEnableStatus); + return; + } + + int hdmi_hotplug_event = (int) displayEvent; + LOGINFO("Received IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG event data:%d \r\n", hdmi_hotplug_event); + std::thread worker(threadHotPlugEventHandler,hdmi_hotplug_event); + worker.detach(); + + } +#endif /* IO_HCEC_ENABLE_IARM */ void HdmiCecSourceImplementation::onPowerModeChanged(const PowerState currentState, const PowerState newState) { if(!HdmiCecSourceImplementation::_instance) diff --git a/HdmiCecSource/HdmiCecSourceImplementation.h b/HdmiCecSource/HdmiCecSourceImplementation.h index 4a0abbd7..e8c4ea2e 100644 --- a/HdmiCecSource/HdmiCecSourceImplementation.h +++ b/HdmiCecSource/HdmiCecSourceImplementation.h @@ -42,6 +42,8 @@ #include #include "PowerManagerInterface.h" #include +#include "host.hpp" + using namespace WPEFramework; using PowerState = WPEFramework::Exchange::IPowerManager::PowerState; @@ -170,7 +172,7 @@ namespace WPEFramework { // As the registration/unregistration of notifications is realized by the class PluginHost::JSONRPC, // this class exposes a public method called, Notify(), using this methods, all subscribed clients // will receive a JSONRPC message as a notification, in case this method is called. - class HdmiCecSourceImplementation : public Exchange::IHdmiCecSource { + class HdmiCecSourceImplementation : public Exchange::IHdmiCecSource, device::Host::IDisplayDeviceEvents { enum { VOLUME_UP = 0x41, VOLUME_DOWN = 0x42, @@ -196,6 +198,7 @@ namespace WPEFramework { public: HdmiCecSourceImplementation(); virtual ~HdmiCecSourceImplementation(); + virtual void OnDisplayHDMIHotPlug(dsDisplayEvent_t displayEvent) override; void onPowerModeChanged(const PowerState currentState, const PowerState newState); void registerEventHandlers(); static HdmiCecSourceImplementation* _instance; From 4d59de80faec1629ae45d87523fbc0025d111fb3 Mon Sep 17 00:00:00 2001 From: karuppaiya kaliyaperumal Date: Thu, 4 Sep 2025 17:44:05 +0530 Subject: [PATCH 06/21] added host.hpp --- HdmiCecSink/HdmiCecSink.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/HdmiCecSink/HdmiCecSink.h b/HdmiCecSink/HdmiCecSink.h index 20761536..3db2f4fe 100644 --- a/HdmiCecSink/HdmiCecSink.h +++ b/HdmiCecSink/HdmiCecSink.h @@ -41,6 +41,8 @@ #include "UtilsLogging.h" #include #include "PowerManagerInterface.h" +#include "host.hpp" + using namespace WPEFramework; using PowerState = WPEFramework::Exchange::IPowerManager::PowerState; From 54daae7d80630f3d3ba5f76589a0f045e2ea6e24 Mon Sep 17 00:00:00 2001 From: karuppaiya kaliyaperumal Date: Tue, 9 Sep 2025 15:32:39 +0530 Subject: [PATCH 07/21] base interface template change --- HdmiCecSink/HdmiCecSink.cpp | 70 ++++++++++++++++++- HdmiCecSink/HdmiCecSink.h | 9 ++- HdmiCecSource/HdmiCecSourceImplementation.cpp | 4 +- HdmiCecSource/HdmiCecSourceImplementation.h | 9 ++- 4 files changed, 85 insertions(+), 7 deletions(-) diff --git a/HdmiCecSink/HdmiCecSink.cpp b/HdmiCecSink/HdmiCecSink.cpp index 45d3afbd..a54c0c63 100644 --- a/HdmiCecSink/HdmiCecSink.cpp +++ b/HdmiCecSink/HdmiCecSink.cpp @@ -756,7 +756,7 @@ namespace WPEFramework #ifdef IO_HCEC_ENABLE_IARM InitializeIARM(); #else - device::Host::getInstance().Register(this, "WPE[HdmiCecSink]"); + device::Host::getInstance().Register(baseInterface(), "WPE[HdmiCecSink]"); #endif /* IO_HCEC_ENABLE_IARM */ m_sendKeyEventThreadExit = false; m_sendKeyEventThread = std::thread(threadSendKeyEvent); @@ -783,6 +783,7 @@ namespace WPEFramework } } +#ifdef IO_HCEC_ENABLE_IARM err = IARM_Bus_Call(IARM_BUS_DSMGR_NAME, IARM_BUS_DSMGR_API_dsHdmiInGetNumberOfInputs, (void *)&hdmiInput, @@ -796,7 +797,9 @@ namespace WPEFramework LOGINFO("Not able to get Numebr of inputs so defaulting to 3 \n"); m_numofHdmiInput = 3; } - +#else + m_numofHdmiInput = device::HdmiInput::getInstance().getNumberOfInputs(); +#endif /* IO_HCEC_ENABLE_IARM */ LOGINFO("initalize inputs \n"); for (int i = 0; i < m_numofHdmiInput; i++){ @@ -886,7 +889,7 @@ namespace WPEFramework #ifdef IO_HCEC_ENABLE_IARM DeinitializeIARM(); #else - device::Host::getInstance().UnRegister(this); + device::Host::getInstance().UnRegister(baseInterface()); #endif /* IO_HCEC_ENABLE_IARM */ LOGWARN(" HdmiCecSink Deinitialize() Done"); @@ -2081,6 +2084,8 @@ namespace WPEFramework int err; bool isAnyPortConnected = false; +#ifdef IO_HCEC_ENABLE_IARM + dsHdmiInGetStatusParam_t params; err = IARM_Bus_Call(IARM_BUS_DSMGR_NAME, IARM_BUS_DSMGR_API_dsHdmiInGetStatus, @@ -2101,7 +2106,21 @@ namespace WPEFramework hdmiInputs[i].update(params.status.isPortConnected[i]); } } +#else + + for( int i = 0; i < m_numofHdmiInput; i++ ) + { + //LOGINFO("update Port Status [%d] \n", i); + hdmiInputs[i].update(device::HdmiInput::getInstance().isPortConnected(i)); + + //LOGINFO("Is HDMI In Port [%d] connected [%d] \n",i, params.status.isPortConnected[i]); + if ( hdmiInputs[i].m_isConnected ) + { + isAnyPortConnected = true; + } + } +#endif /* IO_HCEC_ENABLE_IARM */ if ( isAnyPortConnected ) { m_isHdmiInConnected = true; } else { @@ -3562,6 +3581,7 @@ namespace WPEFramework } +#ifdef IO_HCEC_ENABLE_IARM void HdmiCecSink::getHdmiArcPortID() { int err; @@ -3586,6 +3606,50 @@ namespace WPEFramework } } while(retryCount++ <= 6); } +#else + +#ifdef TBD_IN_DS_CLIENT + void HdmiInput::getHDMIARCPortId(int *portId) + { + if(NULL != portId) + { + dsError_t error = dsERR_GENERAL; + error = dsGetHDMIARCPortId(portId); + if(dsERR_NONE != error) + { + *portId = -1; + } + } + } +#endif /* TBD_IN_DS_CLIENT */ + + void HdmiCecSink::getHdmiArcPortID() + { + int portId; + unsigned int retryCount = 1; + do { + usleep(50000); // Sleep for 50ms before retrying + portId = -1; +#ifdef TBD_IN_DS_CLIENT + device::HdmiInput::getInstance().getHDMIARCPortId(&portId); +#else + portId = 0; // just for compilation & testing +#endif /* TBD_IN_DS_CLIENT */ + if (-1 != portId) + { + LOGINFO("HDMI ARC port ID HdmiArcPortID[%d] on retry count[%d]", portId, retryCount); + HdmiArcPortID = portId; + break; + } + else + { + LOGWARN("getHDMIARCPortId failed for retry count[%d]", retryCount); + } + } while(retryCount++ <= 6); + } + +#endif /* IO_HCEC_ENABLE_IARM */ + void HdmiCecSink::getCecVersion() { diff --git a/HdmiCecSink/HdmiCecSink.h b/HdmiCecSink/HdmiCecSink.h index 3db2f4fe..fff9ba1d 100644 --- a/HdmiCecSink/HdmiCecSink.h +++ b/HdmiCecSink/HdmiCecSink.h @@ -484,7 +484,7 @@ namespace WPEFramework { // As the registration/unregistration of notifications is realized by the class PluginHost::JSONRPC, // this class exposes a public method called, Notify(), using this methods, all subscribed clients // will receive a JSONRPC message as a notification, in case this method is called. - class HdmiCecSink : public PluginHost::IPlugin, public PluginHost::JSONRPC, device::Host::IHdmiInEvents { + class HdmiCecSink : public PluginHost::IPlugin, public PluginHost::JSONRPC, public device::Host::IHdmiInEvents { enum { POLL_THREAD_STATE_NONE, @@ -589,6 +589,13 @@ namespace WPEFramework { END_INTERFACE_MAP private: + template + T* baseInterface() + { + static_assert(std::is_base_of(), "base type mismatch"); + return static_cast(this); + } + class PowerManagerNotification : public Exchange::IPowerManager::IModeChangedNotification { private: PowerManagerNotification(const PowerManagerNotification&) = delete; diff --git a/HdmiCecSource/HdmiCecSourceImplementation.cpp b/HdmiCecSource/HdmiCecSourceImplementation.cpp index e933a0c2..47a64b6b 100644 --- a/HdmiCecSource/HdmiCecSourceImplementation.cpp +++ b/HdmiCecSource/HdmiCecSourceImplementation.cpp @@ -393,7 +393,7 @@ namespace WPEFramework #ifdef IO_HCEC_ENABLE_IARM DeinitializeIARM(); #else - device::Host::getInstance().UnRegister(this); + device::Host::getInstance().UnRegister(baseInterface()); #endif /* IO_HCEC_ENABLE_IARM */ } @@ -427,7 +427,7 @@ namespace WPEFramework device::Manager::Initialize(); #ifndef IO_HCEC_ENABLE_IARM - device::Host::getInstance().Register(this, "WPE[HdmiCecSource]"); + device::Host::getInstance().Register(baseInterface(), "WPE[HdmiCecSource]"); #endif /* IO_HCEC_ENABLE_IARM */ std::string strVideoPort = device::Host::getInstance().getDefaultVideoPortName(); diff --git a/HdmiCecSource/HdmiCecSourceImplementation.h b/HdmiCecSource/HdmiCecSourceImplementation.h index e8c4ea2e..3f7ff6a4 100644 --- a/HdmiCecSource/HdmiCecSourceImplementation.h +++ b/HdmiCecSource/HdmiCecSourceImplementation.h @@ -172,7 +172,7 @@ namespace WPEFramework { // As the registration/unregistration of notifications is realized by the class PluginHost::JSONRPC, // this class exposes a public method called, Notify(), using this methods, all subscribed clients // will receive a JSONRPC message as a notification, in case this method is called. - class HdmiCecSourceImplementation : public Exchange::IHdmiCecSource, device::Host::IDisplayDeviceEvents { + class HdmiCecSourceImplementation : public Exchange::IHdmiCecSource, public device::Host::IDisplayDeviceEvents { enum { VOLUME_UP = 0x41, VOLUME_DOWN = 0x42, @@ -229,6 +229,13 @@ namespace WPEFramework { private: + template + T* baseInterface() + { + static_assert(std::is_base_of(), "base type mismatch"); + return static_cast(this); + } + class PowerManagerNotification : public Exchange::IPowerManager::IModeChangedNotification { private: PowerManagerNotification(const PowerManagerNotification&) = delete; From 8a169f80682fb826d78137a387f47ab3a27ac612 Mon Sep 17 00:00:00 2001 From: karuppaiya kaliyaperumal Date: Tue, 9 Sep 2025 15:55:20 +0530 Subject: [PATCH 08/21] copilot warnings --- HdmiCecSink/HdmiCecSink.cpp | 2 +- HdmiCecSource/HdmiCecSourceImplementation.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/HdmiCecSink/HdmiCecSink.cpp b/HdmiCecSink/HdmiCecSink.cpp index a54c0c63..63b406ae 100644 --- a/HdmiCecSink/HdmiCecSink.cpp +++ b/HdmiCecSink/HdmiCecSink.cpp @@ -954,7 +954,7 @@ namespace WPEFramework return; LOGINFO("Received IARM_BUS_DSMGR_EVENT_HDMI_IN_HOTPLUG event port: %d isConnected: %d \r\n", port, isConnected); - HdmiCecSink::_instance->onHdmiHotPlug((int) port, (int) isConnected); + HdmiCecSink::_instance->onHdmiHotPlug((int) port, isConnected); } #endif /* IO_HCEC_ENABLE_IARM */ diff --git a/HdmiCecSource/HdmiCecSourceImplementation.cpp b/HdmiCecSource/HdmiCecSourceImplementation.cpp index 47a64b6b..a29014ae 100644 --- a/HdmiCecSource/HdmiCecSourceImplementation.cpp +++ b/HdmiCecSource/HdmiCecSourceImplementation.cpp @@ -795,11 +795,11 @@ namespace WPEFramework #else void HdmiCecSourceImplementation::OnDisplayHDMIHotPlug(dsDisplayEvent_t displayEvent) { - LOGINFO("OnDisplayHDMIHotPlug : displayEvent = %d ", displayEvent); + LOGINFO("HdmiCecSourceImplementation::OnDisplayHDMIHotPlug : displayEvent = %d ", displayEvent); if(!HdmiCecSourceImplementation::_instance || !_instance->cecEnableStatus) { - LOGINFO("Return from dsHdmiEventHandler due HdmiCecSourceImplementation::_instance:%p cecEnableStatus:%d \r\n", HdmiCecSourceImplementation::_instance, _instance->cecEnableStatus); + LOGINFO("HdmiCecSourceImplementation::OnDisplayHDMIHotPlug failed _instance:%p cecEnableStatus:%d \r\n", HdmiCecSourceImplementation::_instance, _instance->cecEnableStatus); return; } From 2965ff4d7d82e99f6036ca1af3c65c9f8eb60486 Mon Sep 17 00:00:00 2001 From: karuppaiya kaliyaperumal Date: Tue, 9 Sep 2025 17:28:04 +0530 Subject: [PATCH 09/21] review comments added --- HdmiCecSink/HdmiCecSink.cpp | 294 +++++++++++++++++++----------------- 1 file changed, 154 insertions(+), 140 deletions(-) diff --git a/HdmiCecSink/HdmiCecSink.cpp b/HdmiCecSink/HdmiCecSink.cpp index 63b406ae..db6480f7 100644 --- a/HdmiCecSink/HdmiCecSink.cpp +++ b/HdmiCecSink/HdmiCecSink.cpp @@ -692,139 +692,159 @@ namespace WPEFramework } const std::string HdmiCecSink::Initialize(PluginHost::IShell *service) { - InitializePowerManager(service); - profileType = searchRdkProfile(); - - if (profileType == STB || profileType == NOT_FOUND) - { - LOGINFO("Invalid profile type for TV \n"); - return (std::string("Not supported")); - } - - HdmiCecSink::_instance = this; - smConnection=NULL; - cecEnableStatus = false; - HdmiCecSink::_instance->m_numberOfDevices = 0; - m_logicalAddressAllocated = LogicalAddress::UNREGISTERED; - m_currentActiveSource = -1; - m_isHdmiInConnected = false; - hdmiCecAudioDeviceConnected = false; - m_isAudioStatusInfoUpdated = false; - m_audioStatusRequestedCount = 0; - m_audioStatusReceived = false; - m_audioStatusTimerStarted = false; - m_audioDevicePowerStatusRequested = false; - m_pollNextState = POLL_THREAD_STATE_NONE; - m_pollThreadState = POLL_THREAD_STATE_NONE; - m_video_latency = DEFAULT_VIDEO_LATENCY; - m_latency_flags = DEFAULT_LATENCY_FLAGS ; - m_audio_output_delay = DEFAULT_AUDIO_OUTPUT_DELAY; - - Register(HDMICECSINK_METHOD_SET_ENABLED, &HdmiCecSink::setEnabledWrapper, this); - Register(HDMICECSINK_METHOD_GET_ENABLED, &HdmiCecSink::getEnabledWrapper, this); - Register(HDMICECSINK_METHOD_SET_OSD_NAME, &HdmiCecSink::setOSDNameWrapper, this); - Register(HDMICECSINK_METHOD_GET_OSD_NAME, &HdmiCecSink::getOSDNameWrapper, this); - Register(HDMICECSINK_METHOD_SET_VENDOR_ID, &HdmiCecSink::setVendorIdWrapper, this); - Register(HDMICECSINK_METHOD_GET_VENDOR_ID, &HdmiCecSink::getVendorIdWrapper, this); - Register(HDMICECSINK_METHOD_PRINT_DEVICE_LIST, &HdmiCecSink::printDeviceListWrapper, this); - Register(HDMICECSINK_METHOD_SET_ACTIVE_PATH, &HdmiCecSink::setActivePathWrapper, this); - Register(HDMICECSINK_METHOD_SET_ROUTING_CHANGE, &HdmiCecSink::setRoutingChangeWrapper, this); - Register(HDMICECSINK_METHOD_GET_DEVICE_LIST, &HdmiCecSink::getDeviceListWrapper, this); - Register(HDMICECSINK_METHOD_GET_ACTIVE_SOURCE, &HdmiCecSink::getActiveSourceWrapper, this); - Register(HDMICECSINK_METHOD_SET_ACTIVE_SOURCE, &HdmiCecSink::setActiveSourceWrapper, this); - Register(HDMICECSINK_METHOD_GET_ACTIVE_ROUTE, &HdmiCecSink::getActiveRouteWrapper, this); - Register(HDMICECSINK_METHOD_REQUEST_ACTIVE_SOURCE, &HdmiCecSink::requestActiveSourceWrapper, this); - Register(HDMICECSINK_METHOD_SETUP_ARC, &HdmiCecSink::setArcEnableDisableWrapper, this); - Register(HDMICECSINK_METHOD_SET_MENU_LANGUAGE, &HdmiCecSink::setMenuLanguageWrapper, this); - Register(HDMICECSINK_METHOD_REQUEST_SHORT_AUDIO_DESCRIPTOR, &HdmiCecSink::requestShortAudioDescriptorWrapper, this); - Register(HDMICECSINK_METHOD_SEND_STANDBY_MESSAGE, &HdmiCecSink::sendStandbyMessageWrapper, this); - Register(HDMICECSINK_METHOD_SEND_AUDIO_DEVICE_POWER_ON, &HdmiCecSink::sendAudioDevicePowerOnMsgWrapper, this); - Register(HDMICECSINK_METHOD_SEND_KEY_PRESS,&HdmiCecSink::sendRemoteKeyPressWrapper,this); - Register(HDMICECSINK_METHOD_SEND_USER_CONTROL_PRESSED,&HdmiCecSink::sendUserControlPressedWrapper,this); - Register(HDMICECSINK_METHOD_SEND_USER_CONTROL_RELEASED,&HdmiCecSink::sendUserControlReleasedWrapper,this); - Register(HDMICECSINK_METHOD_SEND_GIVE_AUDIO_STATUS,&HdmiCecSink::sendGiveAudioStatusWrapper,this); - Register(HDMICECSINK_METHOD_GET_AUDIO_DEVICE_CONNECTED_STATUS,&HdmiCecSink::getAudioDeviceConnectedStatusWrapper,this); - Register(HDMICECSINK_METHOD_REQUEST_AUDIO_DEVICE_POWER_STATUS,&HdmiCecSink::requestAudioDevicePowerStatusWrapper,this); - Register(HDMICECSINK_METHOD_SET_LATENCY_INFO, &HdmiCecSink::setLatencyInfoWrapper, this); - logicalAddressDeviceType = "None"; - logicalAddress = 0xFF; - // load persistence setting - loadSettings(); - - int err; - dsHdmiInGetNumberOfInputsParam_t hdmiInput; + string msg = ""; + + try + { + device::Manager::Initialize(); + LOGINFO("device::Manager::Initialize success"); + } + catch(const device::Exception& err) + { + LOGINFO("device::Manager::Initialize failed"); + msg = "HdmiCecSink plugin Initialize failed"; + LOG_DEVICE_EXCEPTION0(); + } + + if (0 == msg.length()) + { + InitializePowerManager(service); + profileType = searchRdkProfile(); + + if (profileType == STB || profileType == NOT_FOUND) + { + LOGINFO("Invalid profile type for TV \n"); + msg = "Not supported"; + return msg; + } + + HdmiCecSink::_instance = this; + smConnection=NULL; + cecEnableStatus = false; + HdmiCecSink::_instance->m_numberOfDevices = 0; + m_logicalAddressAllocated = LogicalAddress::UNREGISTERED; + m_currentActiveSource = -1; + m_isHdmiInConnected = false; + hdmiCecAudioDeviceConnected = false; + m_isAudioStatusInfoUpdated = false; + m_audioStatusRequestedCount = 0; + m_audioStatusReceived = false; + m_audioStatusTimerStarted = false; + m_audioDevicePowerStatusRequested = false; + m_pollNextState = POLL_THREAD_STATE_NONE; + m_pollThreadState = POLL_THREAD_STATE_NONE; + m_video_latency = DEFAULT_VIDEO_LATENCY; + m_latency_flags = DEFAULT_LATENCY_FLAGS ; + m_audio_output_delay = DEFAULT_AUDIO_OUTPUT_DELAY; + + Register(HDMICECSINK_METHOD_SET_ENABLED, &HdmiCecSink::setEnabledWrapper, this); + Register(HDMICECSINK_METHOD_GET_ENABLED, &HdmiCecSink::getEnabledWrapper, this); + Register(HDMICECSINK_METHOD_SET_OSD_NAME, &HdmiCecSink::setOSDNameWrapper, this); + Register(HDMICECSINK_METHOD_GET_OSD_NAME, &HdmiCecSink::getOSDNameWrapper, this); + Register(HDMICECSINK_METHOD_SET_VENDOR_ID, &HdmiCecSink::setVendorIdWrapper, this); + Register(HDMICECSINK_METHOD_GET_VENDOR_ID, &HdmiCecSink::getVendorIdWrapper, this); + Register(HDMICECSINK_METHOD_PRINT_DEVICE_LIST, &HdmiCecSink::printDeviceListWrapper, this); + Register(HDMICECSINK_METHOD_SET_ACTIVE_PATH, &HdmiCecSink::setActivePathWrapper, this); + Register(HDMICECSINK_METHOD_SET_ROUTING_CHANGE, &HdmiCecSink::setRoutingChangeWrapper, this); + Register(HDMICECSINK_METHOD_GET_DEVICE_LIST, &HdmiCecSink::getDeviceListWrapper, this); + Register(HDMICECSINK_METHOD_GET_ACTIVE_SOURCE, &HdmiCecSink::getActiveSourceWrapper, this); + Register(HDMICECSINK_METHOD_SET_ACTIVE_SOURCE, &HdmiCecSink::setActiveSourceWrapper, this); + Register(HDMICECSINK_METHOD_GET_ACTIVE_ROUTE, &HdmiCecSink::getActiveRouteWrapper, this); + Register(HDMICECSINK_METHOD_REQUEST_ACTIVE_SOURCE, &HdmiCecSink::requestActiveSourceWrapper, this); + Register(HDMICECSINK_METHOD_SETUP_ARC, &HdmiCecSink::setArcEnableDisableWrapper, this); + Register(HDMICECSINK_METHOD_SET_MENU_LANGUAGE, &HdmiCecSink::setMenuLanguageWrapper, this); + Register(HDMICECSINK_METHOD_REQUEST_SHORT_AUDIO_DESCRIPTOR, &HdmiCecSink::requestShortAudioDescriptorWrapper, this); + Register(HDMICECSINK_METHOD_SEND_STANDBY_MESSAGE, &HdmiCecSink::sendStandbyMessageWrapper, this); + Register(HDMICECSINK_METHOD_SEND_AUDIO_DEVICE_POWER_ON, &HdmiCecSink::sendAudioDevicePowerOnMsgWrapper, this); + Register(HDMICECSINK_METHOD_SEND_KEY_PRESS,&HdmiCecSink::sendRemoteKeyPressWrapper,this); + Register(HDMICECSINK_METHOD_SEND_USER_CONTROL_PRESSED,&HdmiCecSink::sendUserControlPressedWrapper,this); + Register(HDMICECSINK_METHOD_SEND_USER_CONTROL_RELEASED,&HdmiCecSink::sendUserControlReleasedWrapper,this); + Register(HDMICECSINK_METHOD_SEND_GIVE_AUDIO_STATUS,&HdmiCecSink::sendGiveAudioStatusWrapper,this); + Register(HDMICECSINK_METHOD_GET_AUDIO_DEVICE_CONNECTED_STATUS,&HdmiCecSink::getAudioDeviceConnectedStatusWrapper,this); + Register(HDMICECSINK_METHOD_REQUEST_AUDIO_DEVICE_POWER_STATUS,&HdmiCecSink::requestAudioDevicePowerStatusWrapper,this); + Register(HDMICECSINK_METHOD_SET_LATENCY_INFO, &HdmiCecSink::setLatencyInfoWrapper, this); + logicalAddressDeviceType = "None"; + logicalAddress = 0xFF; + // load persistence setting + loadSettings(); + + int err; + dsHdmiInGetNumberOfInputsParam_t hdmiInput; #ifdef IO_HCEC_ENABLE_IARM - InitializeIARM(); + InitializeIARM(); #else - device::Host::getInstance().Register(baseInterface(), "WPE[HdmiCecSink]"); + device::Host::getInstance().Register(baseInterface(), "WPE[HdmiCecSink]"); #endif /* IO_HCEC_ENABLE_IARM */ - m_sendKeyEventThreadExit = false; - m_sendKeyEventThread = std::thread(threadSendKeyEvent); - - m_currentArcRoutingState = ARC_STATE_ARC_TERMINATED; - m_semSignaltoArcRoutingThread.acquire(); - m_arcRoutingThread = std::thread(threadArcRouting); - - m_audioStatusDetectionTimer.connect( std::bind( &HdmiCecSink::audioStatusTimerFunction, this ) ); - m_audioStatusDetectionTimer.setSingleShot(true); - m_arcStartStopTimer.connect( std::bind( &HdmiCecSink::arcStartStopTimerFunction, this ) ); - m_arcStartStopTimer.setSingleShot(true); - // get power state: - Core::hresult res = Core::ERROR_GENERAL; - PowerState pwrStateCur = WPEFramework::Exchange::IPowerManager::POWER_STATE_UNKNOWN; - PowerState pwrStatePrev = WPEFramework::Exchange::IPowerManager::POWER_STATE_UNKNOWN; - - ASSERT (_powerManagerPlugin); - if (_powerManagerPlugin) { - res = _powerManagerPlugin->GetPowerState(pwrStateCur, pwrStatePrev); - if (Core::ERROR_NONE == res) { - powerState = (pwrStateCur == WPEFramework::Exchange::IPowerManager::POWER_STATE_ON) ? DEVICE_POWER_STATE_ON : DEVICE_POWER_STATE_OFF; - LOGINFO("Current state is PowerManagerPlugin: (%d) powerState :%d \n", pwrStateCur, powerState); - } - } + m_sendKeyEventThreadExit = false; + m_sendKeyEventThread = std::thread(threadSendKeyEvent); + + m_currentArcRoutingState = ARC_STATE_ARC_TERMINATED; + m_semSignaltoArcRoutingThread.acquire(); + m_arcRoutingThread = std::thread(threadArcRouting); + + m_audioStatusDetectionTimer.connect( std::bind( &HdmiCecSink::audioStatusTimerFunction, this ) ); + m_audioStatusDetectionTimer.setSingleShot(true); + m_arcStartStopTimer.connect( std::bind( &HdmiCecSink::arcStartStopTimerFunction, this ) ); + m_arcStartStopTimer.setSingleShot(true); + // get power state: + Core::hresult res = Core::ERROR_GENERAL; + PowerState pwrStateCur = WPEFramework::Exchange::IPowerManager::POWER_STATE_UNKNOWN; + PowerState pwrStatePrev = WPEFramework::Exchange::IPowerManager::POWER_STATE_UNKNOWN; + + ASSERT (_powerManagerPlugin); + if (_powerManagerPlugin) { + res = _powerManagerPlugin->GetPowerState(pwrStateCur, pwrStatePrev); + if (Core::ERROR_NONE == res) { + powerState = (pwrStateCur == WPEFramework::Exchange::IPowerManager::POWER_STATE_ON) ? DEVICE_POWER_STATE_ON : DEVICE_POWER_STATE_OFF; + LOGINFO("Current state is PowerManagerPlugin: (%d) powerState :%d \n", pwrStateCur, powerState); + } + } #ifdef IO_HCEC_ENABLE_IARM - err = IARM_Bus_Call(IARM_BUS_DSMGR_NAME, - IARM_BUS_DSMGR_API_dsHdmiInGetNumberOfInputs, - (void *)&hdmiInput, - sizeof(hdmiInput)); + err = IARM_Bus_Call(IARM_BUS_DSMGR_NAME, + IARM_BUS_DSMGR_API_dsHdmiInGetNumberOfInputs, + (void *)&hdmiInput, + sizeof(hdmiInput)); - if (err == IARM_RESULT_SUCCESS && hdmiInput.result == dsERR_NONE) - { - LOGINFO("Number of Inputs [%d] \n", hdmiInput.numHdmiInputs ); - m_numofHdmiInput = hdmiInput.numHdmiInputs; - }else{ - LOGINFO("Not able to get Numebr of inputs so defaulting to 3 \n"); - m_numofHdmiInput = 3; - } + if (err == IARM_RESULT_SUCCESS && hdmiInput.result == dsERR_NONE) + { + LOGINFO("Number of Inputs [%d] \n", hdmiInput.numHdmiInputs ); + m_numofHdmiInput = hdmiInput.numHdmiInputs; + }else{ + LOGINFO("Not able to get Numebr of inputs so defaulting to 3 \n"); + m_numofHdmiInput = 3; + } #else - m_numofHdmiInput = device::HdmiInput::getInstance().getNumberOfInputs(); + m_numofHdmiInput = device::HdmiInput::getInstance().getNumberOfInputs(); #endif /* IO_HCEC_ENABLE_IARM */ - LOGINFO("initalize inputs \n"); + LOGINFO("initalize inputs \n"); - for (int i = 0; i < m_numofHdmiInput; i++){ - HdmiPortMap hdmiPort((uint8_t)i); - LOGINFO(" Add to vector [%d] \n", i); - hdmiInputs.push_back(hdmiPort); - } + for (int i = 0; i < m_numofHdmiInput; i++){ + HdmiPortMap hdmiPort((uint8_t)i); + LOGINFO(" Add to vector [%d] \n", i); + hdmiInputs.push_back(hdmiPort); + } - LOGINFO("Check the HDMI State \n"); + LOGINFO("Check the HDMI State \n"); - CheckHdmiInState(); - if (cecSettingEnabled) - { - try - { - CECEnable(); - } - catch(...) + CheckHdmiInState(); + if (cecSettingEnabled) { - LOGWARN("Exception while enabling CEC settings .\r\n"); + try + { + CECEnable(); + } + catch(...) + { + LOGWARN("Exception while enabling CEC settings .\r\n"); + msg = "Exception while enabling CEC settings"; + } } - } - getCecVersion(); - LOGINFO(" HdmiCecSink plugin Initialize completed \n"); - return (std::string()); + getCecVersion(); + } + + LOGINFO(" HdmiCecSink plugin Initialize completed \n"); + return msg; } @@ -892,6 +912,17 @@ namespace WPEFramework device::Host::getInstance().UnRegister(baseInterface()); #endif /* IO_HCEC_ENABLE_IARM */ + try + { + device::Manager::DeInitialize(); + LOGINFO("device::Manager::DeInitialize success"); + } + catch(const device::Exception& err) + { + LOGINFO("device::Manager::DeInitialize failed"); + LOG_DEVICE_EXCEPTION0(); + } + LOGWARN(" HdmiCecSink Deinitialize() Done"); } @@ -3607,22 +3638,6 @@ namespace WPEFramework } while(retryCount++ <= 6); } #else - -#ifdef TBD_IN_DS_CLIENT - void HdmiInput::getHDMIARCPortId(int *portId) - { - if(NULL != portId) - { - dsError_t error = dsERR_GENERAL; - error = dsGetHDMIARCPortId(portId); - if(dsERR_NONE != error) - { - *portId = -1; - } - } - } -#endif /* TBD_IN_DS_CLIENT */ - void HdmiCecSink::getHdmiArcPortID() { int portId; @@ -3630,11 +3645,11 @@ namespace WPEFramework do { usleep(50000); // Sleep for 50ms before retrying portId = -1; -#ifdef TBD_IN_DS_CLIENT +#if 0 //just to verify compilation device::HdmiInput::getInstance().getHDMIARCPortId(&portId); #else - portId = 0; // just for compilation & testing -#endif /* TBD_IN_DS_CLIENT */ + portId = 0; +#endif if (-1 != portId) { LOGINFO("HDMI ARC port ID HdmiArcPortID[%d] on retry count[%d]", portId, retryCount); @@ -3647,7 +3662,6 @@ namespace WPEFramework } } while(retryCount++ <= 6); } - #endif /* IO_HCEC_ENABLE_IARM */ From b45107cfc8bf77e4abf9a82e31c3a6067907f6f2 Mon Sep 17 00:00:00 2001 From: karuppaiya kaliyaperumal Date: Tue, 9 Sep 2025 17:57:49 +0530 Subject: [PATCH 10/21] moved device setting init to plugin init --- HdmiCecSink/HdmiCecSink.cpp | 8 +-- HdmiCecSource/HdmiCecSource.cpp | 66 +++++++++++++------ HdmiCecSource/HdmiCecSourceImplementation.cpp | 2 +- 3 files changed, 51 insertions(+), 25 deletions(-) diff --git a/HdmiCecSink/HdmiCecSink.cpp b/HdmiCecSink/HdmiCecSink.cpp index db6480f7..a2d3515d 100644 --- a/HdmiCecSink/HdmiCecSink.cpp +++ b/HdmiCecSink/HdmiCecSink.cpp @@ -697,11 +697,11 @@ namespace WPEFramework try { device::Manager::Initialize(); - LOGINFO("device::Manager::Initialize success"); + LOGINFO("HdmiCecSink plugin device::Manager::Initialize success"); } catch(const device::Exception& err) { - LOGINFO("device::Manager::Initialize failed"); + LOGINFO("HdmiCecSink plugin device::Manager::Initialize failed"); msg = "HdmiCecSink plugin Initialize failed"; LOG_DEVICE_EXCEPTION0(); } @@ -915,11 +915,11 @@ namespace WPEFramework try { device::Manager::DeInitialize(); - LOGINFO("device::Manager::DeInitialize success"); + LOGINFO("HdmiCecSink plugin device::Manager::DeInitialize success"); } catch(const device::Exception& err) { - LOGINFO("device::Manager::DeInitialize failed"); + LOGINFO("HdmiCecSink plugin device::Manager::DeInitialize failed"); LOG_DEVICE_EXCEPTION0(); } diff --git a/HdmiCecSource/HdmiCecSource.cpp b/HdmiCecSource/HdmiCecSource.cpp index e00fba1d..c8aea1d3 100644 --- a/HdmiCecSource/HdmiCecSource.cpp +++ b/HdmiCecSource/HdmiCecSource.cpp @@ -70,29 +70,43 @@ namespace WPEFramework ASSERT(nullptr == _hdmiCecSource); ASSERT(0 == _connectionId); + try + { + device::Manager::Initialize(); + LOGINFO("HdmiCecSource plugin device::Manager::Initialize success"); + } + catch(const device::Exception& err) + { + LOGINFO("HdmiCecSource plugin device::Manager::Initialize failed"); + msg = "HdmiCecSource plugin Initialize failed"; + LOG_DEVICE_EXCEPTION0(); + } - _service = service; - _service->AddRef(); - _service->Register(&_notification); - _hdmiCecSource = _service->Root(_connectionId, 5000, _T("HdmiCecSourceImplementation")); + if (0 == msg.length()) + { + _service = service; + _service->AddRef(); + _service->Register(&_notification); + _hdmiCecSource = _service->Root(_connectionId, 5000, _T("HdmiCecSourceImplementation")); - if(nullptr != _hdmiCecSource) - { - _hdmiCecSource->Configure(service); - _hdmiCecSource->Register(&_notification); - Exchange::JHdmiCecSource::Register(*this, _hdmiCecSource); - LOGINFO("HdmiCecSource plugin is available. Successfully activated HdmiCecSource Plugin"); - } - else - { - msg = "HdmiCecSource plugin is not available"; - LOGINFO("HdmiCecSource plugin is not available. Failed to activate HdmiCecSource Plugin"); - } + if(nullptr != _hdmiCecSource) + { + _hdmiCecSource->Configure(service); + _hdmiCecSource->Register(&_notification); + Exchange::JHdmiCecSource::Register(*this, _hdmiCecSource); + LOGINFO("HdmiCecSource plugin is available. Successfully activated HdmiCecSource Plugin"); + } + else + { + msg = "HdmiCecSource plugin is not available"; + LOGINFO("HdmiCecSource plugin is not available. Failed to activate HdmiCecSource Plugin"); + } - if (0 != msg.length()) - { - Deinitialize(service); - } + if (0 != msg.length()) + { + Deinitialize(service); + } + } // On success return empty, to indicate there is no error text. return msg; @@ -153,6 +167,18 @@ namespace WPEFramework _service->Unregister(&_notification); _service->Release(); _service = nullptr; + + try + { + device::Manager::DeInitialize(); + LOGINFO("HdmiCecSource plugin device::Manager::DeInitialize success"); + } + catch(const device::Exception& err) + { + LOGINFO("HdmiCecSource plugin device::Manager::DeInitialize failed"); + LOG_DEVICE_EXCEPTION0(); + } + LOGINFO("HdmiCecSource plugin is deactivated. Successfully deactivated HdmiCecSource Plugin"); } diff --git a/HdmiCecSource/HdmiCecSourceImplementation.cpp b/HdmiCecSource/HdmiCecSourceImplementation.cpp index a29014ae..fd047b82 100644 --- a/HdmiCecSource/HdmiCecSourceImplementation.cpp +++ b/HdmiCecSource/HdmiCecSourceImplementation.cpp @@ -424,7 +424,7 @@ namespace WPEFramework try { //TODO(MROLLINS) this is probably per process so we either need to be running in our own process or be carefull no other plugin is calling it - device::Manager::Initialize(); + //device::Manager::Initialize(); #ifndef IO_HCEC_ENABLE_IARM device::Host::getInstance().Register(baseInterface(), "WPE[HdmiCecSource]"); From 86069993b8c006ac68e7bceda32b44f7cd332e79 Mon Sep 17 00:00:00 2001 From: karuppaiya kaliyaperumal Date: Mon, 15 Sep 2025 14:28:52 +0530 Subject: [PATCH 11/21] reverted changes in HdmiCecSource/HdmiCecSource.cpp --- HdmiCecSource/HdmiCecSource.cpp | 66 ++++++++++----------------------- 1 file changed, 20 insertions(+), 46 deletions(-) diff --git a/HdmiCecSource/HdmiCecSource.cpp b/HdmiCecSource/HdmiCecSource.cpp index c8aea1d3..e00fba1d 100644 --- a/HdmiCecSource/HdmiCecSource.cpp +++ b/HdmiCecSource/HdmiCecSource.cpp @@ -70,43 +70,29 @@ namespace WPEFramework ASSERT(nullptr == _hdmiCecSource); ASSERT(0 == _connectionId); - try - { - device::Manager::Initialize(); - LOGINFO("HdmiCecSource plugin device::Manager::Initialize success"); - } - catch(const device::Exception& err) - { - LOGINFO("HdmiCecSource plugin device::Manager::Initialize failed"); - msg = "HdmiCecSource plugin Initialize failed"; - LOG_DEVICE_EXCEPTION0(); - } - if (0 == msg.length()) - { - _service = service; - _service->AddRef(); - _service->Register(&_notification); - _hdmiCecSource = _service->Root(_connectionId, 5000, _T("HdmiCecSourceImplementation")); + _service = service; + _service->AddRef(); + _service->Register(&_notification); + _hdmiCecSource = _service->Root(_connectionId, 5000, _T("HdmiCecSourceImplementation")); - if(nullptr != _hdmiCecSource) - { - _hdmiCecSource->Configure(service); - _hdmiCecSource->Register(&_notification); - Exchange::JHdmiCecSource::Register(*this, _hdmiCecSource); - LOGINFO("HdmiCecSource plugin is available. Successfully activated HdmiCecSource Plugin"); - } - else - { - msg = "HdmiCecSource plugin is not available"; - LOGINFO("HdmiCecSource plugin is not available. Failed to activate HdmiCecSource Plugin"); - } + if(nullptr != _hdmiCecSource) + { + _hdmiCecSource->Configure(service); + _hdmiCecSource->Register(&_notification); + Exchange::JHdmiCecSource::Register(*this, _hdmiCecSource); + LOGINFO("HdmiCecSource plugin is available. Successfully activated HdmiCecSource Plugin"); + } + else + { + msg = "HdmiCecSource plugin is not available"; + LOGINFO("HdmiCecSource plugin is not available. Failed to activate HdmiCecSource Plugin"); + } - if (0 != msg.length()) - { - Deinitialize(service); - } - } + if (0 != msg.length()) + { + Deinitialize(service); + } // On success return empty, to indicate there is no error text. return msg; @@ -167,18 +153,6 @@ namespace WPEFramework _service->Unregister(&_notification); _service->Release(); _service = nullptr; - - try - { - device::Manager::DeInitialize(); - LOGINFO("HdmiCecSource plugin device::Manager::DeInitialize success"); - } - catch(const device::Exception& err) - { - LOGINFO("HdmiCecSource plugin device::Manager::DeInitialize failed"); - LOG_DEVICE_EXCEPTION0(); - } - LOGINFO("HdmiCecSource plugin is deactivated. Successfully deactivated HdmiCecSource Plugin"); } From 1ba78d14a7b6088e1bbc5dc183858df438a62baf Mon Sep 17 00:00:00 2001 From: karuppaiya kaliyaperumal Date: Mon, 15 Sep 2025 15:09:29 +0530 Subject: [PATCH 12/21] reverted init failure --- HdmiCecSink/HdmiCecSink.cpp | 7 ++----- HdmiCecSource/HdmiCecSourceImplementation.cpp | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/HdmiCecSink/HdmiCecSink.cpp b/HdmiCecSink/HdmiCecSink.cpp index a2d3515d..156bf5f4 100644 --- a/HdmiCecSink/HdmiCecSink.cpp +++ b/HdmiCecSink/HdmiCecSink.cpp @@ -702,7 +702,6 @@ namespace WPEFramework catch(const device::Exception& err) { LOGINFO("HdmiCecSink plugin device::Manager::Initialize failed"); - msg = "HdmiCecSink plugin Initialize failed"; LOG_DEVICE_EXCEPTION0(); } @@ -714,8 +713,7 @@ namespace WPEFramework if (profileType == STB || profileType == NOT_FOUND) { LOGINFO("Invalid profile type for TV \n"); - msg = "Not supported"; - return msg; + return (std::string("Not supported")); } HdmiCecSink::_instance = this; @@ -837,14 +835,13 @@ namespace WPEFramework catch(...) { LOGWARN("Exception while enabling CEC settings .\r\n"); - msg = "Exception while enabling CEC settings"; } } getCecVersion(); } LOGINFO(" HdmiCecSink plugin Initialize completed \n"); - return msg; + return (std::string()); } diff --git a/HdmiCecSource/HdmiCecSourceImplementation.cpp b/HdmiCecSource/HdmiCecSourceImplementation.cpp index fd047b82..a29014ae 100644 --- a/HdmiCecSource/HdmiCecSourceImplementation.cpp +++ b/HdmiCecSource/HdmiCecSourceImplementation.cpp @@ -424,7 +424,7 @@ namespace WPEFramework try { //TODO(MROLLINS) this is probably per process so we either need to be running in our own process or be carefull no other plugin is calling it - //device::Manager::Initialize(); + device::Manager::Initialize(); #ifndef IO_HCEC_ENABLE_IARM device::Host::getInstance().Register(baseInterface(), "WPE[HdmiCecSource]"); From 1bcbf2b61522c13c890ad6b9a2f131d01e5bb9ed Mon Sep 17 00:00:00 2001 From: bp-kkaliy489 Date: Wed, 17 Sep 2025 07:29:51 +0000 Subject: [PATCH 13/21] test1 --- HdmiCecSource/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HdmiCecSource/CMakeLists.txt b/HdmiCecSource/CMakeLists.txt index 6a60b721..b88bce54 100644 --- a/HdmiCecSource/CMakeLists.txt +++ b/HdmiCecSource/CMakeLists.txt @@ -13,7 +13,7 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and -# limitations under the License. +# limitations under the License.. set(PLUGIN_NAME HdmiCecSource) set(MODULE_NAME ${NAMESPACE}${PLUGIN_NAME}) From cfc3f0c674dd5e4b21812daf4550f78fef4b4408 Mon Sep 17 00:00:00 2001 From: bp-kkaliy489 Date: Wed, 17 Sep 2025 07:38:21 +0000 Subject: [PATCH 14/21] compilation fixed --- HdmiCecSink/HdmiCecSink.cpp | 174 +++--------------- HdmiCecSource/CMakeLists.txt | 2 +- HdmiCecSource/HdmiCecSourceImplementation.cpp | 53 +----- 3 files changed, 31 insertions(+), 198 deletions(-) diff --git a/HdmiCecSink/HdmiCecSink.cpp b/HdmiCecSink/HdmiCecSink.cpp index 156bf5f4..5a3ebc9b 100644 --- a/HdmiCecSink/HdmiCecSink.cpp +++ b/HdmiCecSink/HdmiCecSink.cpp @@ -25,7 +25,6 @@ #include "host.hpp" #include "UtilsgetRFCConfig.h" -#include "dsMgr.h" #include "dsRpc.h" #include "dsDisplay.h" #include "videoOutputPort.hpp" @@ -36,6 +35,8 @@ #include "UtilsJsonRpc.h" #include "UtilssyncPersistFile.h" #include "UtilsSearchRDKProfile.h" +#include "exception.hpp" +#include "hdmiIn.hpp" #define HDMICECSINK_METHOD_SET_ENABLED "setEnabled" #define HDMICECSINK_METHOD_GET_ENABLED "getEnabled" @@ -765,14 +766,7 @@ namespace WPEFramework logicalAddress = 0xFF; // load persistence setting loadSettings(); - - int err; - dsHdmiInGetNumberOfInputsParam_t hdmiInput; -#ifdef IO_HCEC_ENABLE_IARM - InitializeIARM(); -#else - device::Host::getInstance().Register(baseInterface(), "WPE[HdmiCecSink]"); -#endif /* IO_HCEC_ENABLE_IARM */ + device::Host::getInstance().Register(baseInterface(), "WPE::CecSink"); m_sendKeyEventThreadExit = false; m_sendKeyEventThread = std::thread(threadSendKeyEvent); @@ -798,23 +792,8 @@ namespace WPEFramework } } -#ifdef IO_HCEC_ENABLE_IARM - err = IARM_Bus_Call(IARM_BUS_DSMGR_NAME, - IARM_BUS_DSMGR_API_dsHdmiInGetNumberOfInputs, - (void *)&hdmiInput, - sizeof(hdmiInput)); - - if (err == IARM_RESULT_SUCCESS && hdmiInput.result == dsERR_NONE) - { - LOGINFO("Number of Inputs [%d] \n", hdmiInput.numHdmiInputs ); - m_numofHdmiInput = hdmiInput.numHdmiInputs; - }else{ - LOGINFO("Not able to get Numebr of inputs so defaulting to 3 \n"); - m_numofHdmiInput = 3; - } -#else m_numofHdmiInput = device::HdmiInput::getInstance().getNumberOfInputs(); -#endif /* IO_HCEC_ENABLE_IARM */ + LOGINFO("initalize inputs \n"); for (int i = 0; i < m_numofHdmiInput; i++){ @@ -903,11 +882,7 @@ namespace WPEFramework } HdmiCecSink::_instance = nullptr; -#ifdef IO_HCEC_ENABLE_IARM - DeinitializeIARM(); -#else - device::Host::getInstance().UnRegister(baseInterface()); -#endif /* IO_HCEC_ENABLE_IARM */ + device::Host::getInstance().UnRegister(baseInterface()); try { @@ -923,24 +898,6 @@ namespace WPEFramework LOGWARN(" HdmiCecSink Deinitialize() Done"); } - const void HdmiCecSink::InitializeIARM() - { - if (Utils::IARM::init()) - { - IARM_Result_t res; - IARM_CHECK( IARM_Bus_RegisterEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_HDMI_IN_HOTPLUG, dsHdmiEventHandler) ); - } - } - - void HdmiCecSink::DeinitializeIARM() - { - if (Utils::IARM::isConnected()) - { - IARM_Result_t res; - IARM_CHECK( IARM_Bus_RemoveEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_HDMI_IN_HOTPLUG, dsHdmiEventHandler) ); - } - } - void HdmiCecSink::InitializePowerManager(PluginHost::IShell *service) { _powerManagerPlugin = PowerManagerInterfaceBuilder(_T("org.rdk.PowerManager")) @@ -960,31 +917,14 @@ namespace WPEFramework } } -#ifdef IO_HCEC_ENABLE_IARM - void HdmiCecSink::dsHdmiEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len) - { - if(!HdmiCecSink::_instance) - return; - - if (IARM_BUS_DSMGR_EVENT_HDMI_IN_HOTPLUG == eventId) - { - IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data; - bool isHdmiConnected = eventData->data.hdmi_in_connect.isPortConnected; - dsHdmiInPort_t portId = eventData->data.hdmi_in_connect.port; - LOGINFO("Received IARM_BUS_DSMGR_EVENT_HDMI_IN_HOTPLUG event port: %d data:%d \r\n",portId, isHdmiConnected); - HdmiCecSink::_instance->onHdmiHotPlug(portId,isHdmiConnected); - } - } -#else void HdmiCecSink::OnHdmiInEventHotPlug(dsHdmiInPort_t port, bool isConnected) { if(!HdmiCecSink::_instance) return; - LOGINFO("Received IARM_BUS_DSMGR_EVENT_HDMI_IN_HOTPLUG event port: %d isConnected: %d \r\n", port, isConnected); + LOGINFO("Received HdmiCecSink::OnHdmiInEventHotPlug event port: %d isConnected: %d \r\n", port, isConnected); HdmiCecSink::_instance->onHdmiHotPlug((int) port, isConnected); } -#endif /* IO_HCEC_ENABLE_IARM */ void HdmiCecSink::onPowerModeChanged(const PowerState currentState, const PowerState newState) { @@ -2109,46 +2049,20 @@ namespace WPEFramework void HdmiCecSink::CheckHdmiInState() { - int err; bool isAnyPortConnected = false; -#ifdef IO_HCEC_ENABLE_IARM - - dsHdmiInGetStatusParam_t params; - err = IARM_Bus_Call(IARM_BUS_DSMGR_NAME, - IARM_BUS_DSMGR_API_dsHdmiInGetStatus, - (void *)¶ms, - sizeof(params)); - - if(err == IARM_RESULT_SUCCESS && params.result == dsERR_NONE ) - { - for( int i = 0; i < m_numofHdmiInput; i++ ) - { - LOGINFO("Is HDMI In Port [%d] connected [%d] \n",i, params.status.isPortConnected[i]); - if ( params.status.isPortConnected[i] ) - { - isAnyPortConnected = true; - } - - LOGINFO("update Port Status [%d] \n", i); - hdmiInputs[i].update(params.status.isPortConnected[i]); - } - } -#else - for( int i = 0; i < m_numofHdmiInput; i++ ) { - //LOGINFO("update Port Status [%d] \n", i); + LOGINFO("update Port Status [%d] \n", i); hdmiInputs[i].update(device::HdmiInput::getInstance().isPortConnected(i)); - //LOGINFO("Is HDMI In Port [%d] connected [%d] \n",i, params.status.isPortConnected[i]); + LOGINFO("Is HDMI In Port [%d] connected [%d] \n",i, hdmiInputs[i].m_isConnected); if ( hdmiInputs[i].m_isConnected ) { isAnyPortConnected = true; } } -#endif /* IO_HCEC_ENABLE_IARM */ if ( isAnyPortConnected ) { m_isHdmiInConnected = true; } else { @@ -3609,58 +3523,26 @@ namespace WPEFramework } -#ifdef IO_HCEC_ENABLE_IARM - void HdmiCecSink::getHdmiArcPortID() - { - int err; - dsGetHDMIARCPortIdParam_t param; - unsigned int retryCount = 1; - do { - usleep(50000); // Sleep for 50ms before retrying - param.portId = -1; // Initialize to an invalid port ID - err = IARM_Bus_Call(IARM_BUS_DSMGR_NAME, - (char *)IARM_BUS_DSMGR_API_dsGetHDMIARCPortId, - (void *)¶m, - sizeof(param)); - if (IARM_RESULT_SUCCESS == err) - { - LOGINFO("HDMI ARC port ID HdmiArcPortID[%d] on retry count[%d]", param.portId, retryCount); - HdmiArcPortID = param.portId; - break; - } - else - { - LOGWARN("IARM_Bus_Call failed with error[%d], retry count[%d]", err, retryCount); - } - } while(retryCount++ <= 6); - } -#else - void HdmiCecSink::getHdmiArcPortID() - { - int portId; - unsigned int retryCount = 1; - do { - usleep(50000); // Sleep for 50ms before retrying - portId = -1; -#if 0 //just to verify compilation - device::HdmiInput::getInstance().getHDMIARCPortId(&portId); -#else - portId = 0; -#endif - if (-1 != portId) - { - LOGINFO("HDMI ARC port ID HdmiArcPortID[%d] on retry count[%d]", portId, retryCount); - HdmiArcPortID = portId; - break; - } - else - { - LOGWARN("getHDMIARCPortId failed for retry count[%d]", retryCount); - } - } while(retryCount++ <= 6); - } -#endif /* IO_HCEC_ENABLE_IARM */ - + void HdmiCecSink::getHdmiArcPortID() + { + int portId; + unsigned int retryCount = 1; + do { + usleep(50000); // Sleep for 50ms before retrying + portId = -1; + device::HdmiInput::getInstance().getHDMIARCPortId(&portId); + if (-1 != portId) + { + LOGINFO("HDMI ARC port ID HdmiArcPortID[%d] on retry count[%d]", portId, retryCount); + HdmiArcPortID = portId; + break; + } + else + { + LOGWARN("getHDMIARCPortId failed for retry count[%d]", retryCount); + } + } while(retryCount++ <= 6); + } void HdmiCecSink::getCecVersion() { diff --git a/HdmiCecSource/CMakeLists.txt b/HdmiCecSource/CMakeLists.txt index b88bce54..6a60b721 100644 --- a/HdmiCecSource/CMakeLists.txt +++ b/HdmiCecSource/CMakeLists.txt @@ -13,7 +13,7 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and -# limitations under the License.. +# limitations under the License. set(PLUGIN_NAME HdmiCecSource) set(MODULE_NAME ${NAMESPACE}${PLUGIN_NAME}) diff --git a/HdmiCecSource/HdmiCecSourceImplementation.cpp b/HdmiCecSource/HdmiCecSourceImplementation.cpp index a29014ae..09f0e957 100644 --- a/HdmiCecSource/HdmiCecSourceImplementation.cpp +++ b/HdmiCecSource/HdmiCecSourceImplementation.cpp @@ -25,7 +25,6 @@ #include "ccec/MessageEncoder.hpp" #include "host.hpp" -#include "dsMgr.h" #include "dsDisplay.h" #include "videoOutputPort.hpp" #include "manager.hpp" @@ -389,13 +388,7 @@ namespace WPEFramework _powerManagerPlugin.Reset(); } _registeredEventHandlers = false; - -#ifdef IO_HCEC_ENABLE_IARM - DeinitializeIARM(); -#else device::Host::getInstance().UnRegister(baseInterface()); -#endif /* IO_HCEC_ENABLE_IARM */ - } Core::hresult HdmiCecSourceImplementation::Configure(PluginHost::IShell* service) @@ -414,9 +407,6 @@ namespace WPEFramework logicalAddress = 0xFF; //CEC plugin functionalities will only work if CECmgr is available. If plugin Initialize failure upper layer will call dtor directly. -#ifdef IO_HCEC_ENABLE_IARM - InitializeIARM(); -#endif /* IO_HCEC_ENABLE_IARM */ InitializePowerManager(service); // load persistence setting @@ -425,10 +415,7 @@ namespace WPEFramework { //TODO(MROLLINS) this is probably per process so we either need to be running in our own process or be carefull no other plugin is calling it device::Manager::Initialize(); - -#ifndef IO_HCEC_ENABLE_IARM - device::Host::getInstance().Register(baseInterface(), "WPE[HdmiCecSource]"); -#endif /* IO_HCEC_ENABLE_IARM */ + device::Host::getInstance().Register(baseInterface(), "WPE::CecSource"); std::string strVideoPort = device::Host::getInstance().getDefaultVideoPortName(); device::VideoOutputPort vPort = device::Host::getInstance().getVideoOutputPort(strVideoPort.c_str()); @@ -743,20 +730,6 @@ namespace WPEFramework registerEventHandlers(); } - const void HdmiCecSourceImplementation::InitializeIARM() - { - IARM_Result_t res; - IARM_CHECK( IARM_Bus_RegisterEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG, dsHdmiEventHandler) ); - } - - void HdmiCecSourceImplementation::DeinitializeIARM() - { - if (Utils::IARM::isConnected()) - { - IARM_Result_t res; - IARM_CHECK( IARM_Bus_RemoveEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG,dsHdmiEventHandler) ); - } - } void HdmiCecSourceImplementation::threadHotPlugEventHandler(int data) { LOGINFO("entry threadHotPlugEventHandler \r\n"); @@ -771,28 +744,6 @@ namespace WPEFramework LOGINFO("Exit threadHotPlugEventHandler \r\n"); } -#ifdef IO_HCEC_ENABLE_IARM - void HdmiCecSourceImplementation::dsHdmiEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len) - { - if(!HdmiCecSourceImplementation::_instance || !_instance->cecEnableStatus) - { - LOGINFO("Return from dsHdmiEventHandler due HdmiCecSourceImplementation::_instance:%p cecEnableStatus:%d \r\n", HdmiCecSourceImplementation::_instance, _instance->cecEnableStatus); - return; - } - - if (owner && !strcmp(owner, IARM_BUS_DSMGR_NAME) && (IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG == eventId)) - { - IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data; - if(eventData) - { - int hdmi_hotplug_event = eventData->data.hdmi_hpd.event; - LOGINFO("Received IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG event data:%d \r\n", hdmi_hotplug_event); - std::thread worker(threadHotPlugEventHandler,hdmi_hotplug_event); - worker.detach(); - } - } - } -#else void HdmiCecSourceImplementation::OnDisplayHDMIHotPlug(dsDisplayEvent_t displayEvent) { LOGINFO("HdmiCecSourceImplementation::OnDisplayHDMIHotPlug : displayEvent = %d ", displayEvent); @@ -809,7 +760,7 @@ namespace WPEFramework worker.detach(); } -#endif /* IO_HCEC_ENABLE_IARM */ + void HdmiCecSourceImplementation::onPowerModeChanged(const PowerState currentState, const PowerState newState) { if(!HdmiCecSourceImplementation::_instance) From ff9fcdb796835e92302f72ce24d897b516c52f2d Mon Sep 17 00:00:00 2001 From: bp-kkaliy489 Date: Wed, 17 Sep 2025 14:29:20 +0000 Subject: [PATCH 15/21] added exception handling --- HdmiCecSink/HdmiCecSink.cpp | 133 +++++++++++++++++++----------------- 1 file changed, 71 insertions(+), 62 deletions(-) diff --git a/HdmiCecSink/HdmiCecSink.cpp b/HdmiCecSink/HdmiCecSink.cpp index 5a3ebc9b..760f0b83 100644 --- a/HdmiCecSink/HdmiCecSink.cpp +++ b/HdmiCecSink/HdmiCecSink.cpp @@ -25,7 +25,6 @@ #include "host.hpp" #include "UtilsgetRFCConfig.h" -#include "dsRpc.h" #include "dsDisplay.h" #include "videoOutputPort.hpp" #include "manager.hpp" @@ -792,7 +791,17 @@ namespace WPEFramework } } - m_numofHdmiInput = device::HdmiInput::getInstance().getNumberOfInputs(); + try + { + m_numofHdmiInput = device::HdmiInput::getInstance().getNumberOfInputs(); + LOGINFO("HdmiCecSink plugin m_numofHdmiInput %d", m_numofHdmiInput); + } + catch(const device::Exception& err) + { + LOGINFO("HdmiCecSink plugin device::HdmiInput::getInstance().getNumberOfInputs failed"); + m_numofHdmiInput = 3; + LOG_DEVICE_EXCEPTION0(); + } LOGINFO("initalize inputs \n"); @@ -826,76 +835,76 @@ namespace WPEFramework void HdmiCecSink::Deinitialize(PluginHost::IShell* /* service */) { - if(_powerManagerPlugin) - { - _powerManagerPlugin->Unregister(_pwrMgrNotification.baseInterface()); - _powerManagerPlugin.Reset(); - } - _registeredEventHandlers = false; + if(_powerManagerPlugin) + { + _powerManagerPlugin->Unregister(_pwrMgrNotification.baseInterface()); + _powerManagerPlugin.Reset(); + } + _registeredEventHandlers = false; - profileType = searchRdkProfile(); + profileType = searchRdkProfile(); - if (profileType == STB || profileType == NOT_FOUND) - { - LOGINFO("Invalid profile type for TV \n"); - return ; - } + if (profileType == STB || profileType == NOT_FOUND) + { + LOGINFO("Invalid profile type for TV \n"); + return ; + } - CECDisable(); - m_currentArcRoutingState = ARC_STATE_ARC_EXIT; + CECDisable(); + m_currentArcRoutingState = ARC_STATE_ARC_EXIT; - m_semSignaltoArcRoutingThread.release(); + m_semSignaltoArcRoutingThread.release(); - try - { - if (m_arcRoutingThread.joinable()) - m_arcRoutingThread.join(); - } - catch(const std::system_error& e) - { - LOGERR("system_error exception in thread join %s", e.what()); - } - catch(const std::exception& e) - { - LOGERR("exception in thread join %s", e.what()); - } + try + { + if (m_arcRoutingThread.joinable()) + m_arcRoutingThread.join(); + } + catch(const std::system_error& e) + { + LOGERR("system_error exception in thread join %s", e.what()); + } + catch(const std::exception& e) + { + LOGERR("exception in thread join %s", e.what()); + } - { - m_sendKeyEventThreadExit = true; - std::unique_lock lk(m_sendKeyEventMutex); - m_sendKeyEventThreadRun = true; - m_sendKeyCV.notify_one(); - } + { + m_sendKeyEventThreadExit = true; + std::unique_lock lk(m_sendKeyEventMutex); + m_sendKeyEventThreadRun = true; + m_sendKeyCV.notify_one(); + } - try - { - if (m_sendKeyEventThread.joinable()) - m_sendKeyEventThread.join(); - } - catch(const std::system_error& e) - { - LOGERR("system_error exception in thread join %s", e.what()); - } - catch(const std::exception& e) - { - LOGERR("exception in thread join %s", e.what()); - } + try + { + if (m_sendKeyEventThread.joinable()) + m_sendKeyEventThread.join(); + } + catch(const std::system_error& e) + { + LOGERR("system_error exception in thread join %s", e.what()); + } + catch(const std::exception& e) + { + LOGERR("exception in thread join %s", e.what()); + } - HdmiCecSink::_instance = nullptr; - device::Host::getInstance().UnRegister(baseInterface()); + HdmiCecSink::_instance = nullptr; + device::Host::getInstance().UnRegister(baseInterface()); - try - { - device::Manager::DeInitialize(); - LOGINFO("HdmiCecSink plugin device::Manager::DeInitialize success"); - } - catch(const device::Exception& err) - { - LOGINFO("HdmiCecSink plugin device::Manager::DeInitialize failed"); - LOG_DEVICE_EXCEPTION0(); - } + try + { + device::Manager::DeInitialize(); + LOGINFO("HdmiCecSink plugin device::Manager::DeInitialize success"); + } + catch(const device::Exception& err) + { + LOGINFO("HdmiCecSink plugin device::Manager::DeInitialize failed"); + LOG_DEVICE_EXCEPTION0(); + } - LOGWARN(" HdmiCecSink Deinitialize() Done"); + LOGWARN(" HdmiCecSink Deinitialize() Done"); } void HdmiCecSink::InitializePowerManager(PluginHost::IShell *service) From dee3405a0491214731cb20249af0bb6928aefeb6 Mon Sep 17 00:00:00 2001 From: bp-kkaliy489 Date: Thu, 18 Sep 2025 08:24:46 +0000 Subject: [PATCH 16/21] corrected reference --- HdmiCecSink/HdmiCecSink.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HdmiCecSink/HdmiCecSink.cpp b/HdmiCecSink/HdmiCecSink.cpp index 760f0b83..6ab12f8b 100644 --- a/HdmiCecSink/HdmiCecSink.cpp +++ b/HdmiCecSink/HdmiCecSink.cpp @@ -3539,7 +3539,7 @@ namespace WPEFramework do { usleep(50000); // Sleep for 50ms before retrying portId = -1; - device::HdmiInput::getInstance().getHDMIARCPortId(&portId); + device::HdmiInput::getInstance().getHDMIARCPortId(portId); if (-1 != portId) { LOGINFO("HDMI ARC port ID HdmiArcPortID[%d] on retry count[%d]", portId, retryCount); From 39b9eef0f8c418edfd6c8c9b64ff22b472496ad8 Mon Sep 17 00:00:00 2001 From: bp-kkaliy489 Date: Thu, 18 Sep 2025 09:55:44 +0000 Subject: [PATCH 17/21] handled return value --- HdmiCecSink/HdmiCecSink.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/HdmiCecSink/HdmiCecSink.cpp b/HdmiCecSink/HdmiCecSink.cpp index 6ab12f8b..931b107d 100644 --- a/HdmiCecSink/HdmiCecSink.cpp +++ b/HdmiCecSink/HdmiCecSink.cpp @@ -36,6 +36,7 @@ #include "UtilsSearchRDKProfile.h" #include "exception.hpp" #include "hdmiIn.hpp" +#include "dsError.h" #define HDMICECSINK_METHOD_SET_ENABLED "setEnabled" #define HDMICECSINK_METHOD_GET_ENABLED "getEnabled" @@ -3539,8 +3540,8 @@ namespace WPEFramework do { usleep(50000); // Sleep for 50ms before retrying portId = -1; - device::HdmiInput::getInstance().getHDMIARCPortId(portId); - if (-1 != portId) + dsError_t error = device::HdmiInput::getInstance().getHDMIARCPortId(portId); + if (dsERR_NONE == error) { LOGINFO("HDMI ARC port ID HdmiArcPortID[%d] on retry count[%d]", portId, retryCount); HdmiArcPortID = portId; From f41b6f4b2accd8f320bad92bc752561ec38298a5 Mon Sep 17 00:00:00 2001 From: karuppaiya kaliyaperumal Date: Fri, 19 Sep 2025 16:56:10 +0530 Subject: [PATCH 18/21] unit test addition --- .github/workflows/L1-tests.yml | 8 ++++---- .github/workflows/tests-trigger.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/L1-tests.yml b/.github/workflows/L1-tests.yml index cc031231..f1ea20d5 100755 --- a/.github/workflows/L1-tests.yml +++ b/.github/workflows/L1-tests.yml @@ -123,7 +123,7 @@ jobs: with: repository: rdkcentral/entservices-testframework path: entservices-testframework - ref: develop + ref: ds_manager_mocks token: ${{ secrets.RDKCM_RDKE }} - name: Checkout entservices-inputoutput @@ -460,10 +460,10 @@ jobs: -DDS_FOUND=ON -DHAS_FRONT_PANEL=ON -DRDK_SERVICES_L1_TEST=ON - -DPLUGIN_AVINPUT=ON - -DPLUGIN_HDCPPROFILE=ON + -DPLUGIN_AVINPUT=OFF + -DPLUGIN_HDCPPROFILE=OFF -DPLUGIN_HDMICECSOURCE=ON - -DPLUGIN_HDMICECSINK=ON + -DPLUGIN_HDMICECSINK=OFF -DUSE_THUNDER_R4=ON -DHIDE_NON_EXTERNAL_SYMBOLS=OFF && diff --git a/.github/workflows/tests-trigger.yml b/.github/workflows/tests-trigger.yml index bb3de6af..dadd7fbc 100755 --- a/.github/workflows/tests-trigger.yml +++ b/.github/workflows/tests-trigger.yml @@ -4,7 +4,7 @@ name: main-workflow on: push: - branches: [ main, develop, 'sprint/**', 'release/**' ] + branches: [ main, develop, 'sprint/**', 'release/**', feature/RDKEMW-6163-c1 ] pull_request: branches: [ main, develop, 'sprint/**', 'release/**' ] From 1e0b57c5f9f4057a444220e7e8154547167d0192 Mon Sep 17 00:00:00 2001 From: karuppaiya kaliyaperumal Date: Fri, 19 Sep 2025 16:59:17 +0530 Subject: [PATCH 19/21] removed tests-trigger changes --- .github/workflows/tests-trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-trigger.yml b/.github/workflows/tests-trigger.yml index dadd7fbc..bb3de6af 100755 --- a/.github/workflows/tests-trigger.yml +++ b/.github/workflows/tests-trigger.yml @@ -4,7 +4,7 @@ name: main-workflow on: push: - branches: [ main, develop, 'sprint/**', 'release/**', feature/RDKEMW-6163-c1 ] + branches: [ main, develop, 'sprint/**', 'release/**' ] pull_request: branches: [ main, develop, 'sprint/**', 'release/**' ] From 579732268e3c7196671f68255f5cb6a869e4abd2 Mon Sep 17 00:00:00 2001 From: karuppaiya kaliyaperumal Date: Fri, 19 Sep 2025 18:11:51 +0530 Subject: [PATCH 20/21] L1 unit test for source --- .github/workflows/L1-tests.yml | 2 +- Tests/L1Tests/tests/test_HdmiCecSource.cpp | 33 +++------------------- 2 files changed, 5 insertions(+), 30 deletions(-) diff --git a/.github/workflows/L1-tests.yml b/.github/workflows/L1-tests.yml index f1ea20d5..d0866540 100755 --- a/.github/workflows/L1-tests.yml +++ b/.github/workflows/L1-tests.yml @@ -123,7 +123,7 @@ jobs: with: repository: rdkcentral/entservices-testframework path: entservices-testframework - ref: ds_manager_mocks + ref: feature/RDKEMW-6167-PR token: ${{ secrets.RDKCM_RDKE }} - name: Checkout entservices-inputoutput diff --git a/Tests/L1Tests/tests/test_HdmiCecSource.cpp b/Tests/L1Tests/tests/test_HdmiCecSource.cpp index 3ae56adb..0aa5e6e7 100755 --- a/Tests/L1Tests/tests/test_HdmiCecSource.cpp +++ b/Tests/L1Tests/tests/test_HdmiCecSource.cpp @@ -342,29 +342,9 @@ class HdmiCecSourceTest : public ::testing::Test { .WillByDefault(::testing::Return()); ON_CALL(*p_connectionImplMock, addFrameListener(::testing::_)) .WillByDefault(::testing::Return()); - ON_CALL(*p_iarmBusImplMock, IARM_Bus_RegisterEventHandler(::testing::_, ::testing::_, ::testing::_)) - .WillByDefault(::testing::Invoke( - [&](const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler) { - if ((string(IARM_BUS_CECMGR_NAME) == string(ownerName)) && (eventId == IARM_BUS_CECMGR_EVENT_DAEMON_INITIALIZED)) { - EXPECT_TRUE(handler != nullptr); - cecMgrEventHandler = handler; - } - if ((string(IARM_BUS_CECMGR_NAME) == string(ownerName)) && (eventId == IARM_BUS_CECMGR_EVENT_STATUS_UPDATED)) { - EXPECT_TRUE(handler != nullptr); - cecMgrEventHandler = handler; - } - if ((string(IARM_BUS_DSMGR_NAME) == string(ownerName)) && (eventId == IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG)) { - EXPECT_TRUE(handler != nullptr); - dsHdmiEventHandler = handler; - } - if ((string(IARM_BUS_PWRMGR_NAME) == string(ownerName)) && (eventId == IARM_BUS_PWRMGR_EVENT_MODECHANGED)) { - EXPECT_TRUE(handler != nullptr); - pwrMgrEventHandler = handler; - } - - return IARM_RESULT_SUCCESS; - })); - + EXPECT_CALL(*p_managerImplMock, Initialize()) + .Times(::testing::AnyNumber()) + .WillRepeatedly(::testing::Return()); } virtual ~HdmiCecSourceTest() override { @@ -1408,18 +1388,13 @@ TEST_F(HdmiCecSourceInitializedEventTest, hdmiEventHandler) iCounter ++; } - ASSERT_TRUE(dsHdmiEventHandler != nullptr); EXPECT_CALL(*p_hostImplMock, getDefaultVideoPortName()) .Times(1) .WillOnce(::testing::Return("TEST")); - - IARM_Bus_DSMgr_EventData_t eventData; - eventData.data.hdmi_hpd.event = 0; - EVENT_SUBSCRIBE(0, _T("onHdmiHotPlug"), _T("client.events.onHdmiHotPlug"), message); - dsHdmiEventHandler(IARM_BUS_DSMGR_NAME, IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG, &eventData , 0); + plugin->OnDisplayHDMIHotPlug(dsDISPLAY_EVENT_CONNECTED); EVENT_UNSUBSCRIBE(0, _T("onHdmiHotPlug"), _T("client.events.onHdmiHotPlug"), message); } From 0951d077ad38870f00aac8a9f7a506fac8ad613f Mon Sep 17 00:00:00 2001 From: karuppaiya kaliyaperumal Date: Fri, 19 Sep 2025 18:31:01 +0530 Subject: [PATCH 21/21] instance pb --- Tests/L1Tests/tests/test_HdmiCecSource.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/L1Tests/tests/test_HdmiCecSource.cpp b/Tests/L1Tests/tests/test_HdmiCecSource.cpp index 0aa5e6e7..abd9ba87 100755 --- a/Tests/L1Tests/tests/test_HdmiCecSource.cpp +++ b/Tests/L1Tests/tests/test_HdmiCecSource.cpp @@ -1394,7 +1394,8 @@ TEST_F(HdmiCecSourceInitializedEventTest, hdmiEventHandler) EVENT_SUBSCRIBE(0, _T("onHdmiHotPlug"), _T("client.events.onHdmiHotPlug"), message); - plugin->OnDisplayHDMIHotPlug(dsDISPLAY_EVENT_CONNECTED); + //plugin->OnDisplayHDMIHotPlug(dsDISPLAY_EVENT_CONNECTED); + Plugin::HdmiCecSourceImplementation::_instance->OnDisplayHDMIHotPlug(dsDISPLAY_EVENT_CONNECTED); EVENT_UNSUBSCRIBE(0, _T("onHdmiHotPlug"), _T("client.events.onHdmiHotPlug"), message); }