From 7e312a79a25103c31deb617d663a18cf71cc950d Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Thu, 15 Nov 2012 15:02:52 +0100 Subject: [PATCH] display an alert message when another device uses the same physical address as libCEC uses, and reset libCEC's address to the default, 1.0.0.0 when this happens. bugzid: 831 --- include/cectypes.h | 3 ++- src/lib/CECClient.cpp | 2 +- src/lib/implementations/CECCommandHandler.cpp | 8 ++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/cectypes.h b/include/cectypes.h index cb51c7f..dfcebfe 100644 --- a/include/cectypes.h +++ b/include/cectypes.h @@ -1256,7 +1256,8 @@ typedef enum libcec_alert CEC_ALERT_SERVICE_DEVICE, CEC_ALERT_CONNECTION_LOST, CEC_ALERT_PERMISSION_ERROR, - CEC_ALERT_PORT_BUSY + CEC_ALERT_PORT_BUSY, + CEC_ALERT_PHYSICAL_ADDRESS_ERROR } libcec_alert; typedef enum libcec_parameter_type diff --git a/src/lib/CECClient.cpp b/src/lib/CECClient.cpp index dc4bbd8..9d814cd 100644 --- a/src/lib/CECClient.cpp +++ b/src/lib/CECClient.cpp @@ -208,7 +208,7 @@ bool CCECClient::SetHDMIPort(const cec_logical_address iBaseDevice, const uint8_ void CCECClient::ResetPhysicalAddress(void) { - SetPhysicalAddress(m_configuration); + SetPhysicalAddress(CEC_DEFAULT_PHYSICAL_ADDRESS); } void CCECClient::SetPhysicalAddress(const libcec_configuration &configuration) diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index 0e00e4c..27e692e 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -816,13 +816,17 @@ void CCECCommandHandler::SetPhysicalAddress(cec_logical_address iAddress, uint16 if (device) device->SetPhysicalAddress(iNewAddress); else - { LIB_CEC->AddLog(CEC_LOG_DEBUG, "device with logical address %X not found", iAddress); - } /* another device reported the same physical address as ours */ if (client) + { + libcec_parameter param; + param.paramType = CEC_PARAMETER_TYPE_STRING; + param.paramData = (void*)"Physical address in use by another device. Please verify your settings"; + client->Alert(CEC_ALERT_PHYSICAL_ADDRESS_ERROR, param); client->ResetPhysicalAddress(); + } } else { -- 2.34.1