X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fdevices%2FCECBusDevice.cpp;h=0cd28d56ae0aa47fe6bc0c7b0b5327d18f50dc16;hb=5734016c1b1e932c19a85bb671211c4967399f8c;hp=c6881621d577ba03d7423ffd692bf887fbb35983;hpb=60725dd58525d51a1588938b4b16573d05ad772b;p=deb_libcec.git diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index c688162..0cd28d5 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -47,7 +47,7 @@ using namespace PLATFORM; CCECBusDevice::CCECBusDevice(CCECProcessor *processor, cec_logical_address iLogicalAddress, uint16_t iPhysicalAddress) : m_type (CEC_DEVICE_TYPE_RESERVED), m_iPhysicalAddress (iPhysicalAddress), - m_iStreamPath (0), + m_iStreamPath (0xFFFF), m_iLogicalAddress (iLogicalAddress), m_powerStatus (CEC_POWER_STATUS_UNKNOWN), m_processor (processor), @@ -170,6 +170,21 @@ cec_version CCECBusDevice::GetCecVersion(bool bUpdate /* = false */) return m_cecVersion; } +bool CCECBusDevice::RequestActiveSource(bool bWaitForResponse /* = true */) +{ + bool bReturn(false); + + if (MyLogicalAddressContains(m_iLogicalAddress)) + { + MarkBusy(); + CLibCEC::AddLog(CEC_LOG_NOTICE, "<< requesting active source"); + + bReturn = m_handler->TransmitRequestActiveSource(GetMyLogicalAddress(), bWaitForResponse); + MarkReady(); + } + return bReturn; +} + bool CCECBusDevice::RequestCecVersion(bool bWaitForResponse /* = true */) { bool bReturn(false); @@ -540,6 +555,8 @@ void CCECBusDevice::SetActiveSource(void) CLockObject lock(m_mutex); if (!m_bActiveSource) CLibCEC::AddLog(CEC_LOG_DEBUG, "making %s (%x) the active source", GetLogicalAddressName(), m_iLogicalAddress); + else + CLibCEC::AddLog(CEC_LOG_DEBUG, "%s (%x) was already marked as active source", GetLogicalAddressName(), m_iLogicalAddress); for (int iPtr = 0; iPtr < 16; iPtr++) if (iPtr != m_iLogicalAddress) @@ -574,7 +591,7 @@ void CCECBusDevice::ResetDeviceStatus(void) SetVendorId (CEC_VENDOR_UNKNOWN); SetMenuState (CEC_MENU_STATE_ACTIVATED); SetCecVersion (CEC_VERSION_UNKNOWN); - SetStreamPath (0); + SetStreamPath (0xFFFF); SetOSDName (ToString(m_iLogicalAddress)); SetInactiveSource(); m_iLastActive = 0; @@ -600,7 +617,7 @@ void CCECBusDevice::SetDeviceStatus(const cec_bus_device_status newStatus) SetVendorId (CEC_VENDOR_UNKNOWN); SetMenuState (CEC_MENU_STATE_ACTIVATED); SetCecVersion (CEC_VERSION_1_3A); - SetStreamPath (0); + SetStreamPath (0xFFFF); SetInactiveSource(); m_iLastActive = 0; m_deviceStatus = newStatus; @@ -635,7 +652,7 @@ void CCECBusDevice::SetPhysicalAddress(uint16_t iNewAddress) } } -void CCECBusDevice::SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress /* = 0 */) +void CCECBusDevice::SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress /* = 0xFFFF */) { CLockObject lock(m_mutex); if (iNewAddress != m_iStreamPath) @@ -657,8 +674,6 @@ void CCECBusDevice::SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress /* if (device) device->SetInactiveSource(); } - - SetPowerStatus(CEC_POWER_STATUS_ON); } void CCECBusDevice::SetPowerStatus(const cec_power_status powerStatus)