X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fdevices%2FCECBusDevice.cpp;h=794829ae3ab51ec84e23ed83275ebbde0f5116bd;hb=842262d8050e918a64813f593c66a0f93ef73c5e;hp=1793cc4c5af3431a42b07836908f85eee7b8ec55;hpb=fe6f8e370bff46ba50defc31698f369763c68455;p=deb_libcec.git diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 1793cc4..794829a 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -84,6 +84,9 @@ bool CCECBusDevice::HandleCommand(const cec_command &command) { CLockObject lock(&m_writeMutex); m_iLastActive = GetTimeMs(); + + if (m_deviceStatus != CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC) + m_deviceStatus = CEC_DEVICE_STATUS_PRESENT; } /* handle the command */ @@ -431,19 +434,24 @@ void CCECBusDevice::SetMenuState(const cec_menu_state state) } } -void CCECBusDevice::SetInactiveDevice(void) +void CCECBusDevice::SetInactiveSource(void) { - CLockObject lock(&m_writeMutex); - m_bActiveSource = false; + { + CLockObject lock(&m_writeMutex); + m_bActiveSource = false; + } + + if (MyLogicalAddressContains(m_iLogicalAddress)) + SetPowerStatus(CEC_POWER_STATUS_STANDBY); } -void CCECBusDevice::SetActiveDevice(void) +void CCECBusDevice::SetActiveSource(void) { CLockObject lock(&m_writeMutex); for (int iPtr = 0; iPtr < 16; iPtr++) if (iPtr != m_iLogicalAddress) - m_processor->m_busDevices[iPtr]->SetInactiveDevice(); + m_processor->m_busDevices[iPtr]->SetInactiveSource(); m_bActiveSource = true; m_powerStatus = CEC_POWER_STATUS_ON; @@ -580,7 +588,7 @@ bool CCECBusDevice::SetVendorId(uint64_t iVendorId, bool bInitHandler /* = true } } - if (bVendorChanged && bInitHandler) + if (bVendorChanged && bInitHandler && m_handler->GetVendorId() != CEC_VENDOR_UNKNOWN) m_handler->InitHandler(); CStdString strLog; @@ -780,13 +788,13 @@ bool CCECBusDevice::TransmitVendorID(cec_logical_address dest, bool bSendAbort / } } -bool CCECBusDevice::TransmitKeypress(cec_user_control_code key) +bool CCECBusDevice::TransmitKeypress(cec_user_control_code key, bool bWait /* = true */) { - return m_handler->TransmitKeypress(m_processor->GetLogicalAddress(), m_iLogicalAddress, key); + return m_handler->TransmitKeypress(m_processor->GetLogicalAddress(), m_iLogicalAddress, key, bWait); } -bool CCECBusDevice::TransmitKeyRelease(void) +bool CCECBusDevice::TransmitKeyRelease(bool bWait /* = true */) { - return m_handler->TransmitKeyRelease(m_processor->GetLogicalAddress(), m_iLogicalAddress); + return m_handler->TransmitKeyRelease(m_processor->GetLogicalAddress(), m_iLogicalAddress, bWait); } //@}