From: Lars Op den Kamp Date: Thu, 11 Oct 2012 11:19:04 +0000 (+0200) Subject: fixed - don't keep waiting for an updated power status from the TV for Panasonic... X-Git-Tag: upstream/2.2.0~1^2~15^2^2~12 X-Git-Url: https://git.piment-noir.org/?p=deb_libcec.git;a=commitdiff_plain;h=5ce83fff6659472035d13843efd24c176b5e774f fixed - don't keep waiting for an updated power status from the TV for Panasonic, but request a status update once every 5 seconds, or we can possibly wait forever for the tv to send it --- diff --git a/src/lib/implementations/VLCommandHandler.cpp b/src/lib/implementations/VLCommandHandler.cpp index 00e062b..07f2f25 100644 --- a/src/lib/implementations/VLCommandHandler.cpp +++ b/src/lib/implementations/VLCommandHandler.cpp @@ -45,6 +45,8 @@ #define VL_POWERED_DOWN 0x01 #define VL_UNKNOWN1 0x06 +#define VL_REQUEST_POWER_STATUS_TIMEOUT 5000 + using namespace CEC; using namespace PLATFORM; @@ -62,7 +64,7 @@ CVLCommandHandler::CVLCommandHandler(CCECBusDevice *busDevice, CCECCommandHandler(busDevice, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending), m_iPowerUpEventReceived(0), m_bCapabilitiesSent(false), - m_bPowerStatusRequested(false) + m_iPowerStatusRequested(0) { m_vendorId = CEC_VENDOR_PANASONIC; } @@ -252,13 +254,14 @@ int CVLCommandHandler::HandleVendorCommand(const cec_command &command) bool CVLCommandHandler::TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */) { - m_bPowerStatusRequested = true; + m_iPowerStatusRequested = GetTimeMs(); return CCECCommandHandler::TransmitRequestPowerStatus(iInitiator, iDestination, bWaitForResponse); } bool CVLCommandHandler::SourceSwitchAllowed(void) { - if (!PowerUpEventReceived() && !m_bPowerStatusRequested) + int64_t now(GetTimeMs()); + if (!PowerUpEventReceived() && now - m_iPowerStatusRequested > VL_REQUEST_POWER_STATUS_TIMEOUT) 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 ae6b9f6..b878ca9 100644 --- a/src/lib/implementations/VLCommandHandler.h +++ b/src/lib/implementations/VLCommandHandler.h @@ -67,6 +67,6 @@ namespace CEC PLATFORM::CMutex m_mutex; uint64_t m_iPowerUpEventReceived; bool m_bCapabilitiesSent; - bool m_bPowerStatusRequested; + int64_t m_iPowerStatusRequested; }; };