X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fadapter%2FUSBCECAdapterCommunication.cpp;h=e9d4d9333e399430a008b72ccf779bc3d3117f86;hb=884f239fe81ebd0489bdee277de6b719c1495557;hp=ab26d84550f30f010113f12a0228cc55cb330219;hpb=56e53c14cf072c449743fa36f2f80318cd64bfc3;p=deb_libcec.git diff --git a/src/lib/adapter/USBCECAdapterCommunication.cpp b/src/lib/adapter/USBCECAdapterCommunication.cpp index ab26d84..e9d4d93 100644 --- a/src/lib/adapter/USBCECAdapterCommunication.cpp +++ b/src/lib/adapter/USBCECAdapterCommunication.cpp @@ -229,8 +229,7 @@ void *CUSBCECAdapterCommunication::Process(void) { { CLockObject lock(m_mutex); - ReadFromDevice(5); - bCommandReceived = m_callback && Read(command, 0) && m_bInitialised; + bCommandReceived = m_callback && Read(command, 50) && m_bInitialised; } /* push the next command to the callback method if there is one */ @@ -326,9 +325,10 @@ bool CUSBCECAdapterCommunication::Read(cec_command &command, uint32_t iTimeout) return false; } -bool CUSBCECAdapterCommunication::Read(CCECAdapterMessage &msg, uint32_t iTimeout) +bool CUSBCECAdapterCommunication::Read(CCECAdapterMessage &msg, uint32_t iTimeout, size_t iLen) { CLockObject lock(m_mutex); + ReadFromDevice(iTimeout, iLen); msg.Clear(); CCECAdapterMessage *buf(NULL); @@ -778,9 +778,8 @@ bool CUSBCECAdapterCommunication::WaitForAck(CCECAdapterMessage &message) while (!bTransmitSucceeded && !bError && iNow < iTargetTime) { - ReadFromDevice(50); CCECAdapterMessage msg; - if (!Read(msg, 0)) + if (!Read(msg, 50)) { iNow = GetTimeMs(); continue; @@ -1008,9 +1007,8 @@ cec_datapacket CUSBCECAdapterCommunication::GetSetting(cec_adapter_messagecode m return retVal; } - ReadFromDevice(CEC_DEFAULT_TRANSMIT_WAIT, iResponseLength + 3 /* start + msgcode + iResponseLength + end */); CCECAdapterMessage input; - if (Read(input, 0)) + if (Read(input, CEC_DEFAULT_TRANSMIT_WAIT, iResponseLength + 3 /* start + msgcode + iResponseLength + end */)) { if (input.Message() != msgCode) CLibCEC::AddLog(CEC_LOG_ERROR, "invalid response to %s received (%s)", CCECAdapterMessage::ToString(msgCode), CCECAdapterMessage::ToString(input.Message()));