X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2FCECProcessor.cpp;h=5423b4fd63e193cbc9112a3c17dbca8f67e1eb4b;hb=86869f8f9a16b311b78db1307813a0da61cfedfb;hp=96ef591443bc7d2a23267e3885e2237974a139cf;hpb=4bec9d79a5b66d6fe14b19c4e66509b03cc53e90;p=deb_libcec.git diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 96ef591..5423b4f 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(); @@ -1006,12 +1020,12 @@ bool CCECProcessor::SetAckMask(uint16_t iMask) bool CCECProcessor::TransmitKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait /* = true */) { - return m_busDevices[iDestination]->TransmitKeypress(key); + return m_busDevices[iDestination]->TransmitKeypress(key, bWait); } bool CCECProcessor::TransmitKeyRelease(cec_logical_address iDestination, bool bWait /* = true */) { - return m_busDevices[iDestination]->TransmitKeyRelease(); + return m_busDevices[iDestination]->TransmitKeyRelease(bWait); } const char *CCECProcessor::ToString(const cec_menu_state state)