Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 36 additions & 35 deletions ccec/src/Bus.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:

Check failure on line 3 in ccec/src/Bus.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'ccec/src/Bus.cpp' (Match: rdk/components/generic/hdmicec/rdk/components/generic/hdmicec/903ab78, 395 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/hdmicec/+archive/903ab7800e37e8f4895b48adf077127670f25710.tar.gz, file: ccec/src/Bus.cpp)

Check failure on line 3 in ccec/src/Bus.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'ccec/src/Bus.cpp' (Match: rdk/components/generic/hdmicec/rdk/components/generic/hdmicec/2010, 455 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/hdmicec/+archive/rdk-dev-2010.tar.gz, file: ccec/src/Bus.cpp)
*
* Copyright 2016 RDK Management
*
Expand Down Expand Up @@ -329,47 +329,48 @@
*/
void Bus::send(const CECFrame &frame, int timeout)
{
{AutoLock rlock_(rMutex), wlock_(wMutex);

if (timeout <= 0) {
if (!started) throw InvalidStateException();

try {
Driver::getInstance().write(frame);
CCEC_LOG( LOG_DEBUG, "Bus::send write done\r\n");
}
catch (Exception &e){
if( frame.length() > 1)
{
char buffer[128]={0};
snprintf(buffer, 128, "Bus::send exp caught [%s] ", e.what());
t2_event_s("HDMI_WARN_CEC_InvalidParamExcptn",buffer);
CCEC_LOG( LOG_EXP, "Bus::send exp caught [%s] \r\n", e.what());
if (timeout <= 0) {
{AutoLock rlock_(rMutex), wlock_(wMutex);
if (!started) throw InvalidStateException();
try {
Driver::getInstance().write(frame);
CCEC_LOG( LOG_DEBUG, "Bus::send write done\r\n");
}
catch (Exception &e){
if( frame.length() > 1)
{
char buffer[128]={0};
snprintf(buffer, 128, "Bus::send exp caught [%s] ", e.what());
t2_event_s("HDMI_WARN_CEC_InvalidParamExcptn",buffer);
CCEC_LOG( LOG_EXP, "Bus::send exp caught [%s] \r\n", e.what());
}
throw;
}
}
throw;
}
}
}
}

{AutoLock rlock_(rMutex), wlock_(wMutex);
if (timeout > 0) {
/* Retry in 250ms increment till timeout */
int retry = (timeout / 250);
do {
try {
if (!started) throw InvalidStateException();
send(frame, 0);
retry = 0;
}
catch (Exception &e){
if( frame.length() > 1) CCEC_LOG( LOG_EXP, "Bus::send exp caught [%s], retry [%d]\r\n", e.what(), retry);
if (retry == 0) {
throw;
}
usleep(250000);
}
} while (retry--);
}
usleep(1000);
{AutoLock rlock_(rMutex), wlock_(wMutex);
try {
if (!started) throw InvalidStateException();
send(frame, 0);
retry = 0;
}
catch (Exception &e){
if( frame.length() > 1) CCEC_LOG( LOG_EXP, "Bus::send exp caught [%s], retry [%d]\r\n", e.what(), retry);
if (retry == 0) {
throw;
}
}
}
if (retry) {
usleep(250000);
}
} while (retry--);
}
}

Expand Down
Loading