repositories
/
deb_libcec.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cec: retry to get the firmware version when it failed. wait for active tranmission...
[deb_libcec.git]
/
src
/
lib
/
adapter
/
AdapterCommunication.cpp
diff --git
a/src/lib/adapter/AdapterCommunication.cpp
b/src/lib/adapter/AdapterCommunication.cpp
index 05ab9b836dd1f6c7ebea9744bcfb8fc7f238ada8..2bbcb0153ba0ec798fe76ff7ee0786abb3760f58 100644
(file)
--- a/
src/lib/adapter/AdapterCommunication.cpp
+++ b/
src/lib/adapter/AdapterCommunication.cpp
@@
-98,11
+98,15
@@
bool CAdapterCommunication::Open(const char *strPort, uint16_t iBaudRate /* = 38
return false;
}
return false;
}
- CLibCEC::AddLog(CEC_LOG_DEBUG, "connection opened");
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "connection opened
, clearing any previous input and waiting for active transmissions to end before starting
");
//clear any input bytes
//clear any input bytes
- uint8_t buff[1];
- while (m_port->Read(buff, 1, 5) == 1) {}
+ uint8_t buff[1024];
+ while (m_port->Read(buff, 1024, 100) > 0)
+ {
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "data received, clearing it");
+ Sleep(250);
+ }
if (CreateThread())
{
if (CreateThread())
{
@@
-300,7
+304,7
@@
uint16_t CAdapterCommunication::GetFirmwareVersion(void)
CCECAdapterMessage input;
if (!Read(input, CEC_DEFAULT_TRANSMIT_WAIT) || input.Message() != MSGCODE_FIRMWARE_VERSION || input.Size() != 3)
CCECAdapterMessage input;
if (!Read(input, CEC_DEFAULT_TRANSMIT_WAIT) || input.Message() != MSGCODE_FIRMWARE_VERSION || input.Size() != 3)
- CLibCEC::AddLog(CEC_LOG_ERROR, "no or invalid firmware version
"
);
+ CLibCEC::AddLog(CEC_LOG_ERROR, "no or invalid firmware version
(size = %d, message = %d)", input.Size(), input.Message()
);
else
{
m_iFirmwareVersion = (input[1] << 8 | input[2]);
else
{
m_iFirmwareVersion = (input[1] << 8 | input[2]);