if (SetAckMask(m_logicalAddresses.AckMask()) &&
SetHDMIPort(m_iBaseDevice, m_iHDMIPort, true))
{
- m_controller->AddLog(CEC_LOG_ERROR, "processor thread started");
+ m_controller->AddLog(CEC_LOG_DEBUG, "processor thread started");
m_busScan = new CCECBusScan(this);
m_busScan->CreateThread(true);
return true;
void *CCECBusScan::Process(void)
{
CCECBusDevice *device(NULL);
- int iCount(0);
+ int iCount(50);
while (!IsStopped())
{
if (iCount == 0)
{
- for (unsigned int iPtr = 0; iPtr < 15 && !IsStopped(); iPtr++)
+ for (unsigned int iPtr = 0; iPtr <= 11 && !IsStopped(); iPtr++)
{
device = m_processor->m_busDevices[iPtr];
if (device && device->GetStatus(true) == CEC_DEVICE_STATUS_PRESENT)
cec_bus_device_status CCECBusDevice::GetStatus(bool bForcePoll /* = false */)
{
CLockObject lock(&m_writeMutex);
- if (m_deviceStatus == CEC_DEVICE_STATUS_UNKNOWN || bForcePoll)
+ if (m_deviceStatus != CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC &&
+ (m_deviceStatus == CEC_DEVICE_STATUS_UNKNOWN || bForcePoll))
{
lock.Leave();
bool bPollAcked(false);
if (dest == CECDEVICE_UNKNOWN)
dest = m_iLogicalAddress;
+ CCECBusDevice *destDevice = m_processor->m_busDevices[dest];
+ if (destDevice->m_deviceStatus == CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC)
+ return bReturn;
+
CStdString strLog;
strLog.Format("<< %s (%X) -> %s (%X): POLL", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest);
AddLog(CEC_LOG_NOTICE, strLog.c_str());
bReturn = m_handler->TransmitPoll(m_iLogicalAddress, dest);
AddLog(CEC_LOG_DEBUG, bReturn ? ">> POLL sent" : ">> POLL not sent");
+ CLockObject lock(&m_writeMutex);
if (bReturn)
{
- CLockObject lock(&m_writeMutex);
m_iLastActive = GetTimeMs();
+ destDevice->m_deviceStatus = CEC_DEVICE_STATUS_PRESENT;
}
+ else
+ destDevice->m_deviceStatus = CEC_DEVICE_STATUS_NOT_PRESENT;
return bReturn;
}
if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
{
+ m_busDevice->GetProcessor()->SetActiveSource(m_busDevice->GetProcessor()->GetLogicalAddresses().primary);
/* LG TVs only route keypresses when the deck status is set to 0x20 */
cec_logical_addresses addr = m_busDevice->GetProcessor()->GetLogicalAddresses();
for (uint8_t iPtr = 0; iPtr < 15; iPtr++)