From fd415a2aaffa9c003fc03d5f049bf7bc16aa1b39 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Thu, 11 Oct 2012 12:51:29 +0200 Subject: [PATCH] don't send out commands to a device that is marked as not present or handled by libCEC --- src/lib/implementations/CECCommandHandler.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index 796f7ab..eafbc2d 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -1077,6 +1077,23 @@ bool CCECCommandHandler::Transmit(cec_command &command, bool bSuppressWait, bool return bReturn; } + // check whether the destination is not marked as not present or handled by libCEC + if (command.destination != CECDEVICE_BROADCAST && command.opcode_set) + { + CCECBusDevice* destinationDevice = m_processor->GetDevice(command.destination); + cec_bus_device_status status = destinationDevice ? destinationDevice->GetStatus() : CEC_DEVICE_STATUS_NOT_PRESENT; + if (status == CEC_DEVICE_STATUS_NOT_PRESENT) + { + LIB_CEC->AddLog(CEC_LOG_DEBUG, "not sending command '%s': destination device '%s' marked as not present", ToString(command.opcode),ToString(command.destination)); + return bReturn; + } + else if (status == CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC) + { + LIB_CEC->AddLog(CEC_LOG_DEBUG, "not sending command '%s': destination device '%s' marked as handled by libCEC", ToString(command.opcode),ToString(command.destination)); + return bReturn; + } + } + { uint8_t iTries(0), iMaxTries(!command.opcode_set ? 1 : m_iTransmitRetries + 1); while (!bReturn && ++iTries <= iMaxTries && !m_busDevice->IsUnsupportedFeature(command.opcode)) -- 2.34.1