From: Lars Op den Kamp Date: Thu, 11 Oct 2012 10:51:29 +0000 (+0200) Subject: don't send out commands to a device that is marked as not present or handled by libCEC X-Git-Tag: upstream/2.2.0~1^2~15^2^2~15 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=fd415a2aaffa9c003fc03d5f049bf7bc16aa1b39;p=deb_libcec.git don't send out commands to a device that is marked as not present or handled by libCEC --- 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))