Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
5b1743f
CEC source and sink changes
karuppaiyak Sep 4, 2025
55ceafa
added host.hpp
karuppaiyak Sep 4, 2025
f8c01b3
Feature/rdkemw 7169 (#245)
hgfell683 Sep 4, 2025
7a0d569
1.4.6 release changelog updates
actions-user Sep 4, 2025
bef0aa3
Merge tag '1.4.6' into develop
actions-user Sep 4, 2025
7c031cf
Merge branch 'release/1.4.6'
actions-user Sep 4, 2025
a0fa4dc
base interface template change
karuppaiyak Sep 9, 2025
eac3ee0
copilot warnings
karuppaiyak Sep 9, 2025
08b3562
review comments added
karuppaiyak Sep 9, 2025
e7f3075
moved device setting init to plugin init
karuppaiyak Sep 9, 2025
b334b82
RDKEMW-7712: Sync low latency for AVOutput initialization (#6338)
arjunbinu Aug 22, 2025
81cc8f5
Merge pull request #249 from rdkcentral/feature/RDKEMW-7712
utkarshece14 Sep 9, 2025
5979423
1.4.7 release changelog updates
actions-user Sep 9, 2025
2bf6395
Merge branch 'release/1.4.7'
actions-user Sep 9, 2025
1ea0522
Merge tag '1.4.7' into develop
actions-user Sep 9, 2025
ff6eeee
reverted changes in HdmiCecSource/HdmiCecSource.cpp
karuppaiyak Sep 15, 2025
922fb7f
reverted init failure
karuppaiyak Sep 15, 2025
3501b16
test1
karuppaiyak Sep 17, 2025
f2c5780
compilation fixed
karuppaiyak Sep 17, 2025
bc803aa
added exception handling
karuppaiyak Sep 17, 2025
0623a75
corrected reference
karuppaiyak Sep 18, 2025
e9cd34f
handled return value
karuppaiyak Sep 18, 2025
f8ea54c
unit test addition
karuppaiyak Sep 19, 2025
76a6dd1
removed tests-trigger changes
karuppaiyak Sep 19, 2025
6ae6bd0
L1 unit test for source
karuppaiyak Sep 19, 2025
73a1113
instance pb
karuppaiyak Sep 19, 2025
0c48f19
Cec Sink L1 test corrected
karuppaiyak Sep 22, 2025
97af88f
enabled cec sink l1 test
karuppaiyak Sep 22, 2025
8f16519
using old tf branch
karuppaiyak Sep 22, 2025
27b02c7
host setImpl Added
karuppaiyak Sep 23, 2025
2e3aada
hdmiinput setimpl added
karuppaiyak Sep 23, 2025
8b5c432
CEC source and sink changes
karuppaiyak Sep 4, 2025
8b0cc04
added host.hpp
karuppaiyak Sep 4, 2025
60c25bd
base interface template change
karuppaiyak Sep 9, 2025
ff83a02
copilot warnings
karuppaiyak Sep 9, 2025
da3518c
review comments added
karuppaiyak Sep 9, 2025
24d314b
moved device setting init to plugin init
karuppaiyak Sep 9, 2025
14f2003
reverted changes in HdmiCecSource/HdmiCecSource.cpp
karuppaiyak Sep 15, 2025
ebd3200
reverted init failure
karuppaiyak Sep 15, 2025
6993a8d
test1
karuppaiyak Sep 17, 2025
a22b587
compilation fixed
karuppaiyak Sep 17, 2025
51b2c7f
added exception handling
karuppaiyak Sep 17, 2025
a0ccdbb
corrected reference
karuppaiyak Sep 18, 2025
6eacd50
handled return value
karuppaiyak Sep 18, 2025
96b094d
unit test addition
karuppaiyak Sep 19, 2025
cc42754
removed tests-trigger changes
karuppaiyak Sep 19, 2025
a3c694f
L1 unit test for source
karuppaiyak Sep 19, 2025
abc1156
instance pb
karuppaiyak Sep 19, 2025
7415208
Cec Sink L1 test corrected
karuppaiyak Sep 22, 2025
72bfc2a
enabled cec sink l1 test
karuppaiyak Sep 22, 2025
f73190e
using old tf branch
karuppaiyak Sep 22, 2025
2515fdd
host setImpl Added
karuppaiyak Sep 23, 2025
91b669a
hdmiinput setimpl added
karuppaiyak Sep 23, 2025
6e18267
Revert L1-tests.yml
KaleeswaranGnanagurusamy Sep 23, 2025
11c0a7d
Merge branch 'feature/RDKEMW-6163-c1' of https://github.com/rdkcentra…
karuppaiyak Sep 24, 2025
408cdc5
fw api calls validations
karuppaiyak Sep 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
334 changes: 216 additions & 118 deletions HdmiCecSink/HdmiCecSink.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**

Check failure on line 1 in HdmiCecSink/HdmiCecSink.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'HdmiCecSink/HdmiCecSink.cpp' (Match: rdkcentral/rdkservices/2101, 3271 lines, url: https://github.com/rdkcentral/rdkservices/archive/sprint_2101.tar.gz, file: HdmiCecSink/HdmiCecSink.cpp)

Check failure on line 1 in HdmiCecSink/HdmiCecSink.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'HdmiCecSink/HdmiCecSink.cpp' (Match: rdkcentral/rdkservices/866, 3610 lines, url: https://github.com/rdkcentral/rdkservices/archive/AML_BSP_VERSION_866.tar.gz, file: HdmiCecSink/HdmiCecSink.cpp)

Check failure on line 1 in HdmiCecSink/HdmiCecSink.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'HdmiCecSink/HdmiCecSink.cpp' (Match: rdkcentral/rdkservices/1, 3681 lines, url: https://github.com/rdkcentral/rdkservices/archive/GRT_v1.tar.gz, file: HdmiCecSink/HdmiCecSink.cpp)
* If not stated otherwise in this file or this component's LICENSE
* file the following copyright and licenses apply:
*
Expand Down Expand Up @@ -692,132 +692,159 @@
}
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;
InitializeIARM();
m_sendKeyEventThreadExit = false;
m_sendKeyEventThread = std::thread(threadSendKeyEvent);
string msg = "";

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);
}
}

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)
try
{
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;
}
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();
}

LOGINFO("initalize inputs \n");
if (0 == msg.length())
{
InitializePowerManager(service);
profileType = searchRdkProfile();

for (int i = 0; i < m_numofHdmiInput; i++){
HdmiPortMap hdmiPort((uint8_t)i);
LOGINFO(" Add to vector [%d] \n", i);
hdmiInputs.push_back(hdmiPort);
}
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();
#else
device::Host::getInstance().Register(baseInterface<device::Host::IHdmiInEvents>(), "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);
}
}

LOGINFO("Check the HDMI State \n");
#ifdef IO_HCEC_ENABLE_IARM
err = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
IARM_BUS_DSMGR_API_dsHdmiInGetNumberOfInputs,
(void *)&hdmiInput,
sizeof(hdmiInput));

CheckHdmiInState();
if (cecSettingEnabled)
{
try
{
CECEnable();
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");
Copy link
Preview

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Numebr" is misspelled and should be "Number".

Suggested change
LOGINFO("Not able to get Numebr of inputs so defaulting to 3 \n");
LOGINFO("Not able to get Number of inputs so defaulting to 3 \n");

Copilot uses AI. Check for mistakes.

m_numofHdmiInput = 3;
}
catch(...)
#else
m_numofHdmiInput = device::HdmiInput::getInstance().getNumberOfInputs();
#endif /* IO_HCEC_ENABLE_IARM */
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);
}

LOGINFO("Check the HDMI State \n");

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;

}

Expand Down Expand Up @@ -879,7 +906,23 @@
}

HdmiCecSink::_instance = nullptr;
DeinitializeIARM();
#ifdef IO_HCEC_ENABLE_IARM
DeinitializeIARM();
#else
device::Host::getInstance().UnRegister(baseInterface<device::Host::IHdmiInEvents>());
#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");
}

Expand Down Expand Up @@ -920,6 +963,7 @@
}
}

#ifdef IO_HCEC_ENABLE_IARM
void HdmiCecSink::dsHdmiEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
{
if(!HdmiCecSink::_instance)
Expand All @@ -934,6 +978,16 @@
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, isConnected);
}
#endif /* IO_HCEC_ENABLE_IARM */

void HdmiCecSink::onPowerModeChanged(const PowerState currentState, const PowerState newState)
{
Expand Down Expand Up @@ -2061,6 +2115,8 @@
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,
Expand All @@ -2081,7 +2137,21 @@
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));
Copy link
Preview

Copilot AI Sep 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The isPortConnected call could throw an exception if the port index is invalid or the HdmiInput instance is not properly initialized. Consider adding bounds checking and exception handling around this call.

Suggested change
hdmiInputs[i].update(device::HdmiInput::getInstance().isPortConnected(i));
bool isConnected = false;
try {
// If HdmiInput provides a method to get the number of ports, use it for bounds checking
int numPorts = device::HdmiInput::getInstance().getNumberOfPorts();
if (i >= 0 && i < numPorts) {
isConnected = device::HdmiInput::getInstance().isPortConnected(i);
} else {
LOGERR("Port index [%d] is out of range [0, %d)", i, numPorts);
}
} catch (const std::exception& ex) {
LOGERR("Exception in isPortConnected(%d): %s", i, ex.what());
} catch (...) {
LOGERR("Unknown exception in isPortConnected(%d)", i);
}
hdmiInputs[i].update(isConnected);

Copilot uses AI. Check for mistakes.


//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 {
Expand Down Expand Up @@ -3542,6 +3612,7 @@

}

#ifdef IO_HCEC_ENABLE_IARM
void HdmiCecSink::getHdmiArcPortID()
{
int err;
Expand All @@ -3566,6 +3637,33 @@
}
} 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
Copy link
Preview

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commented-out code with #if 0 suggests unfinished implementation. This hardcoded portId = 0 assignment bypasses the actual device API call and could lead to incorrect behavior in production. Either implement the proper API call or add a TODO comment explaining why this is temporarily disabled.

Suggested change
#if 0 //just to verify compilation
device::HdmiInput::getInstance().getHDMIARCPortId(&portId);
#else
portId = 0;
#endif
// TODO: Replace hardcoded portId assignment with actual device API call when available.
// device::HdmiInput::getInstance().getHDMIARCPortId(&portId);
portId = 0;

Copilot uses AI. Check for mistakes.

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()
{
Expand Down
Loading
Loading