#define CEC_DEFAULT_TRANSMIT_TIMEOUT 1000
#define CEC_DEFAULT_TRANSMIT_WAIT 2000
#define CEC_DEFAULT_TRANSMIT_RETRIES 1
+#define CEC_PING_ADAPTER_TRIES 5
#define CEC_MIN_LIB_VERSION 1
#define CEC_LIB_VERSION_MAJOR 1
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);
+ }
+ }
- if (bReturn)
+ if (bPingOk)
{
uint16_t iFirmwareVersion = m_communication->GetFirmwareVersion();
if ((bReturn = (iFirmwareVersion != CEC_FW_VERSION_UNKNOWN)) == false)