X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2FCECProcessor.cpp;h=8e1c1017ff722e434447ff8a8247602530cf0b98;hb=c71891a335d74d5f31dc96c2f5853384167a081b;hp=7a4e019d0b7fdfb2a48968f9ff185c54c82ce2f0;hpb=5477a250b595adb296ed42a88abab002981f4761;p=deb_libcec.git diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 7a4e019..8e1c101 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -150,14 +150,25 @@ bool CCECProcessor::OpenConnection(const char *strPort, uint16_t iBaudRate, uint CLibCEC::AddLog(CEC_LOG_ERROR, "could not open a connection"); /* try to ping the adapter */ - if ((bReturn = m_communication->PingAdapter()) == false) - CLibCEC::AddLog(CEC_LOG_ERROR, "the adapter does not respond correctly"); + int iPingTry(0); + bool bPingOk(false); + while (!bPingOk && iPingTry++ < CEC_PING_ADAPTER_TRIES) + { + if ((bPingOk = m_communication->PingAdapter()) == false) + { + CLibCEC::AddLog(CEC_LOG_ERROR, "the adapter did not respond correctly to a ping (try %d of %d)", iPingTry, CEC_PING_ADAPTER_TRIES); + Sleep(500); + } + } - uint16_t iFirmwareVersion = m_communication->GetFirmwareVersion(); - if ((bReturn = (iFirmwareVersion != CEC_FW_VERSION_UNKNOWN)) == false) - m_controller->AddLog(CEC_LOG_ERROR, "the adapter is running an unknown firmware version"); + if (bPingOk) + { + uint16_t iFirmwareVersion = m_communication->GetFirmwareVersion(); + if ((bReturn = (iFirmwareVersion != CEC_FW_VERSION_UNKNOWN)) == false) + m_controller->AddLog(CEC_LOG_ERROR, "the adapter is running an unknown firmware version"); - CLibCEC::AddLog(CEC_LOG_NOTICE, "CEC Adapter firmware version: %d", iFirmwareVersion); + CLibCEC::AddLog(CEC_LOG_NOTICE, "CEC Adapter firmware version: %d", iFirmwareVersion); + } return bReturn; } @@ -988,26 +999,6 @@ uint16_t CCECProcessor::GetPhysicalAddress(void) const return false; } -void CCECProcessor::SetCurrentButton(cec_user_control_code iButtonCode) -{ - m_controller->SetCurrentButton(iButtonCode); -} - -void CCECProcessor::AddCommand(const cec_command &command) -{ - m_controller->AddCommand(command); -} - -void CCECProcessor::AddKey(cec_keypress &key) -{ - m_controller->AddKey(key); -} - -void CCECProcessor::AddKey(void) -{ - m_controller->AddKey(); -} - bool CCECProcessor::SetAckMask(uint16_t iMask) { return m_communication->SetAckMask(iMask);