X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2FCECProcessor.cpp;h=0c409eb6eee23073393373c1ce27d424946d4647;hb=4060d525db2e96103a134bf4383cc5a73db5703f;hp=cb4fe8101e31adb144515dab7009830ea71f3c0c;hpb=5dcf9f25c9b94a9c7a1892cce6e94857ae413a48;p=deb_libcec.git diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index cb4fe81..0c409eb 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -149,6 +149,18 @@ bool CCECProcessor::OpenConnection(const char *strPort, uint16_t iBaudRate, uint if ((bReturn = m_communication->Open(strPort, iBaudRate, iTimeoutMs)) == false) m_controller->AddLog(CEC_LOG_ERROR, "could not open a connection"); + /* try to ping the adapter */ + if ((bReturn = m_communication->PingAdapter()) == false) + m_controller->AddLog(CEC_LOG_ERROR, "the adapter does not respond correctly"); + + 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"); + + CStdString strLog; + strLog.Format("CEC Adapter firmware version: %d", iFirmwareVersion); + m_controller->AddLog(CEC_LOG_NOTICE, strLog); + return bReturn; } @@ -848,7 +860,7 @@ bool CCECProcessor::Transmit(const cec_command &data) bReturn = Transmit(output); /* set to "not present" on failed ack */ - if (output->IsError() && output->reply == MSGCODE_TRANSMIT_FAILED_ACK && + if (output->state == ADAPTER_MESSAGE_STATE_SENT_NOT_ACKED && output->Destination() != CECDEVICE_BROADCAST) m_busDevices[output->Destination()]->SetDeviceStatus(CEC_DEVICE_STATUS_NOT_PRESENT);