repositories
/
deb_libcec.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cec: get the vendor id of the TV before allocating logical addresses, so we can deter...
[deb_libcec.git]
/
src
/
lib
/
CECProcessor.cpp
diff --git
a/src/lib/CECProcessor.cpp
b/src/lib/CECProcessor.cpp
index 11076ecb78d191dfabdb80341a0a124af90be085..034c7e660c56de66d1702781d5f636b3716a71fe 100644
(file)
--- a/
src/lib/CECProcessor.cpp
+++ b/
src/lib/CECProcessor.cpp
@@
-51,6
+51,7
@@
using namespace std;
using namespace PLATFORM;
#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000
using namespace PLATFORM;
#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000
+#define ACTIVE_SOURCE_CHECK_TIMEOUT 10000
#define ToString(x) CCECTypeUtils::ToString(x)
#define ToString(x) CCECTypeUtils::ToString(x)
@@
-147,9
+148,6
@@
bool CCECProcessor::OpenConnection(const char *strPort, uint16_t iBaudRate, uint
m_libcec->AddLog(CEC_LOG_NOTICE, "connection opened");
m_libcec->AddLog(CEC_LOG_NOTICE, "connection opened");
- // always start by setting the ackmask to 0, to clear previous values
- SetAckMask(0);
-
// mark as initialised
SetCECInitialised(true);
// mark as initialised
SetCECInitialised(true);
@@
-200,6
+198,19
@@
void CCECProcessor::ReplaceHandlers(void)
it->second->ReplaceHandler(true);
}
it->second->ReplaceHandler(true);
}
+void CCECProcessor::CheckPendingActiveSource(void)
+{
+ if (!CECInitialised())
+ return;
+
+ // check each device
+ for (CECDEVICEMAP::iterator it = m_busDevices->Begin(); it != m_busDevices->End(); it++)
+ {
+ if (it->second->GetHandler()->ActiveSourcePending())
+ it->second->ActivateSource();
+ }
+}
+
bool CCECProcessor::OnCommandReceived(const cec_command &command)
{
return m_inBuffer.Push(command);
bool CCECProcessor::OnCommandReceived(const cec_command &command)
{
return m_inBuffer.Push(command);
@@
-210,6
+221,7
@@
void *CCECProcessor::Process(void)
m_libcec->AddLog(CEC_LOG_DEBUG, "processor thread started");
cec_command command;
m_libcec->AddLog(CEC_LOG_DEBUG, "processor thread started");
cec_command command;
+ CTimeout activeSourceCheck(ACTIVE_SOURCE_CHECK_TIMEOUT);
// as long as we're not being stopped and the connection is open
while (!IsStopped() && m_communication->IsOpen())
// as long as we're not being stopped and the connection is open
while (!IsStopped() && m_communication->IsOpen())
@@
-225,6
+237,13
@@
void *CCECProcessor::Process(void)
// check if we need to replace handlers
ReplaceHandlers();
// check if we need to replace handlers
ReplaceHandlers();
+
+ // check whether we need to activate a source, if it failed before
+ if (activeSourceCheck.TimeLeft() == 0)
+ {
+ CheckPendingActiveSource();
+ activeSourceCheck.Init(ACTIVE_SOURCE_CHECK_TIMEOUT);
+ }
}
}
}
}
@@
-626,6
+645,9
@@
bool CCECProcessor::RegisterClient(CCECClient *client)
return false;
}
return false;
}
+ // ensure that we know the vendor id of the TV
+ GetTV()->GetVendorId(CECDEVICE_UNREGISTERED);
+
// unregister the client first if it's already been marked as registered
if (client->IsRegistered())
UnregisterClient(client);
// unregister the client first if it's already been marked as registered
if (client->IsRegistered())
UnregisterClient(client);
@@
-701,6
+723,14
@@
bool CCECProcessor::RegisterClient(CCECClient *client)
client->Alert(CEC_ALERT_SERVICE_DEVICE, param);
}
client->Alert(CEC_ALERT_SERVICE_DEVICE, param);
}
+ // ensure that the command handler for the TV is initialised
+ if (bReturn)
+ {
+ CCECCommandHandler *handler = GetTV()->GetHandler();
+ if (handler)
+ handler->InitHandler();
+ }
+
return bReturn;
}
return bReturn;
}