From: Lars Op den Kamp Date: Mon, 8 Oct 2012 16:14:05 +0000 (+0200) Subject: don't get caught in a loop in CVLCommandHandler when the source switch was not allowe... X-Git-Tag: upstream/2.2.0~1^2~17^2^2~2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=cf17686925e242ec3f1d1962414e53bad5ec2a00;p=deb_libcec.git don't get caught in a loop in CVLCommandHandler when the source switch was not allowed and no power status request was sent --- diff --git a/src/lib/implementations/VLCommandHandler.cpp b/src/lib/implementations/VLCommandHandler.cpp index a60f897..227d8a0 100644 --- a/src/lib/implementations/VLCommandHandler.cpp +++ b/src/lib/implementations/VLCommandHandler.cpp @@ -61,7 +61,8 @@ CVLCommandHandler::CVLCommandHandler(CCECBusDevice *busDevice, int64_t iActiveSourcePending /* = 0 */) : CCECCommandHandler(busDevice, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending), m_iPowerUpEventReceived(0), - m_bCapabilitiesSent(false) + m_bCapabilitiesSent(false), + m_bPowerStatusRequested(false) { m_vendorId = CEC_VENDOR_PANASONIC; } @@ -246,8 +247,17 @@ int CVLCommandHandler::HandleVendorCommand(const cec_command &command) return CEC_ABORT_REASON_INVALID_OPERAND; } +bool CVLCommandHandler::TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */) +{ + m_bPowerStatusRequested = true; + return CCECCommandHandler::TransmitRequestPowerStatus(iInitiator, iDestination, bWaitForResponse); +} + bool CVLCommandHandler::SourceSwitchAllowed(void) { + if (!PowerUpEventReceived() && !m_bPowerStatusRequested) + TransmitRequestPowerStatus(m_processor->GetPrimaryDevice()->GetLogicalAddress(), CECDEVICE_TV, false); + return PowerUpEventReceived(); } diff --git a/src/lib/implementations/VLCommandHandler.h b/src/lib/implementations/VLCommandHandler.h index 3ad80b4..ae6b9f6 100644 --- a/src/lib/implementations/VLCommandHandler.h +++ b/src/lib/implementations/VLCommandHandler.h @@ -55,6 +55,7 @@ namespace CEC bool PowerUpEventReceived(void); bool SupportsDeviceType(const cec_device_type type) const { return type != CEC_DEVICE_TYPE_RECORDING_DEVICE; }; cec_device_type GetReplacementDeviceType(const cec_device_type type) const { return type == CEC_DEVICE_TYPE_RECORDING_DEVICE ? CEC_DEVICE_TYPE_PLAYBACK_DEVICE : type; } + bool TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true); bool SourceSwitchAllowed(void); @@ -66,5 +67,6 @@ namespace CEC PLATFORM::CMutex m_mutex; uint64_t m_iPowerUpEventReceived; bool m_bCapabilitiesSent; + bool m_bPowerStatusRequested; }; };