X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2FCECProcessor.cpp;h=ec0eb554d62a3e23ab1723bc2604f8c93693f59a;hb=842262d8050e918a64813f593c66a0f93ef73c5e;hp=8cc290cca4ca20c4270fe402892985b2916cddb2;hpb=e8a3a37b444db18ccac66c318e4cc5e6fe6588e4;p=deb_libcec.git diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 8cc290c..ec0eb55 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -157,7 +157,9 @@ bool CCECProcessor::Start(const char *strPort, uint16_t iBaudRate /* = 38400 */, if (SetHDMIPort(m_iBaseDevice, m_iHDMIPort, true)) { - SetMenuState(CEC_MENU_STATE_ACTIVATED); + /* init the default handler */ + if (m_busDevices[CECDEVICE_TV]->GetHandler()->GetVendorId() == CEC_VENDOR_UNKNOWN) + m_busDevices[CECDEVICE_TV]->GetHandler()->InitHandler(); m_controller->AddLog(CEC_LOG_DEBUG, "processor thread started"); m_busScan = new CCECBusScan(this); @@ -332,12 +334,15 @@ bool CCECProcessor::SetActiveSource(cec_device_type type /* = CEC_DEVICE_TYPE_RE } m_busDevices[addr]->SetActiveSource(); - bReturn = m_busDevices[addr]->TransmitActiveSource(); - - if (bReturn && (m_busDevices[addr]->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE || - m_busDevices[addr]->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE)) + if (m_busDevices[addr]->GetPhysicalAddress(false) != 0xFFFF) { - bReturn = ((CCECPlaybackDevice *)m_busDevices[addr])->TransmitDeckStatus(CECDEVICE_TV); + bReturn = m_busDevices[addr]->TransmitActiveSource(); + + if (bReturn && (m_busDevices[addr]->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE || + m_busDevices[addr]->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE)) + { + bReturn = ((CCECPlaybackDevice *)m_busDevices[addr])->TransmitDeckStatus(CECDEVICE_TV); + } } return bReturn; @@ -648,6 +653,15 @@ CCECBusDevice *CCECProcessor::GetDeviceByType(cec_device_type type) const return device; } +CCECBusDevice *CCECProcessor::GetPrimaryDevice(void) const +{ + CCECBusDevice *device(NULL); + cec_logical_address primary = m_logicalAddresses.primary; + if (primary != CECDEVICE_UNKNOWN) + device = m_busDevices[primary]; + return device; +} + cec_version CCECProcessor::GetDeviceCecVersion(cec_logical_address iAddress) { return m_busDevices[iAddress]->GetCecVersion(); @@ -1004,12 +1018,12 @@ bool CCECProcessor::SetAckMask(uint16_t iMask) return bReturn; } -bool CCECProcessor::TransmitKeypress(cec_logical_address iDestination, cec_user_control_code key) +bool CCECProcessor::TransmitKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait /* = true */) { return m_busDevices[iDestination]->TransmitKeypress(key); } -bool CCECProcessor::TransmitKeyRelease(cec_logical_address iDestination) +bool CCECProcessor::TransmitKeyRelease(cec_logical_address iDestination, bool bWait /* = true */) { return m_busDevices[iDestination]->TransmitKeyRelease(); }