From 45b97de799b55a0e9a9a8498fc8e3671d1124f37 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Sun, 4 Dec 2011 21:21:57 +0100 Subject: [PATCH] cec: be a bit more verbose when initialising --- src/lib/CECProcessor.cpp | 14 ++++++++++---- src/lib/CECProcessor.h | 2 +- src/lib/implementations/SLCommandHandler.cpp | 7 ++++++- src/testclient/main.cpp | 1 + 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index dfdb737..8e761b1 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -154,14 +154,18 @@ bool CCECProcessor::Start(const char *strPort, uint16_t iBaudRate /* = 38400 */, if (SetAckMask(m_logicalAddresses.AckMask()) && SetHDMIPort(m_iBaseDevice, m_iHDMIPort, true)) { + m_controller->AddLog(CEC_LOG_ERROR, "processor thread started"); m_busScan = new CCECBusScan(this); m_busScan->CreateThread(true); return true; } + else + { + m_controller->AddLog(CEC_LOG_ERROR, "failed to initialise the processor"); + } } - else - m_controller->AddLog(CEC_LOG_ERROR, "could not create a processor thread"); + m_controller->AddLog(CEC_LOG_ERROR, "could not create a processor thread"); return false; } @@ -401,7 +405,7 @@ bool CCECProcessor::SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort, iPhysicalAddress += (uint16_t)(iPort * iPos); strLog.Format("checking physical address %4x", iPhysicalAddress); AddLog(CEC_LOG_DEBUG, strLog); - if (CheckPhysicalAddress(iPhysicalAddress)) + if (PhysicalAddressInUse(iPhysicalAddress)) { strLog.Format("physical address %4x is in use", iPhysicalAddress); AddLog(CEC_LOG_DEBUG, strLog); @@ -409,6 +413,8 @@ bool CCECProcessor::SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort, } else { + strLog.Format("physical address %4x is free", iPhysicalAddress); + AddLog(CEC_LOG_DEBUG, strLog); SetPhysicalAddress(iPhysicalAddress); bReturn = true; } @@ -417,7 +423,7 @@ bool CCECProcessor::SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort, return bReturn; } -bool CCECProcessor::CheckPhysicalAddress(uint16_t iPhysicalAddress) +bool CCECProcessor::PhysicalAddressInUse(uint16_t iPhysicalAddress) { for (unsigned int iPtr = 0; iPtr < 15; iPtr++) { diff --git a/src/lib/CECProcessor.h b/src/lib/CECProcessor.h index 82dc149..052dc99 100644 --- a/src/lib/CECProcessor.h +++ b/src/lib/CECProcessor.h @@ -126,7 +126,7 @@ namespace CEC private: void ScanCECBus(void); - bool CheckPhysicalAddress(uint16_t iPhysicalAddress); + bool PhysicalAddressInUse(uint16_t iPhysicalAddress); bool TryLogicalAddress(cec_logical_address address); bool FindLogicalAddressRecordingDevice(void); bool FindLogicalAddressTuner(void); diff --git a/src/lib/implementations/SLCommandHandler.cpp b/src/lib/implementations/SLCommandHandler.cpp index 197db43..76007cc 100644 --- a/src/lib/implementations/SLCommandHandler.cpp +++ b/src/lib/implementations/SLCommandHandler.cpp @@ -85,7 +85,8 @@ bool CSLCommandHandler::HandleVendorCommand(const cec_command &command) else if (command.parameters.size == 1 && command.parameters[0] == SL_COMMAND_REQUEST_VENDOR_ID) { - TransmitLGVendorId(m_busDevice->GetProcessor()->GetLogicalAddresses().primary, CECDEVICE_BROADCAST); +// if (command.destination != CECDEVICE_BROADCAST) +// m_busDevice->GetProcessor()->m_busDevices[m_busDevice->GetProcessor()->GetLogicalAddresses().primary]->TransmitPowerState(command.initiator); return true; } @@ -156,6 +157,10 @@ bool CSLCommandHandler::HandleCommand(const cec_command &command) m_bSkipNextVendorId = true; TransmitLGVendorId(m_busDevice->GetProcessor()->GetLogicalAddresses().primary, CECDEVICE_BROADCAST); } + else + { + m_bSkipNextVendorId = false; + } m_bSLEnabled = false; } bHandled = true; diff --git a/src/testclient/main.cpp b/src/testclient/main.cpp index 0ac1c71..9d40c39 100644 --- a/src/testclient/main.cpp +++ b/src/testclient/main.cpp @@ -997,6 +997,7 @@ int main (int argc, char *argv[]) if (!g_bSingleCommand) { + FlushLog(parser); cout << "cec device opened" << endl; parser->PowerOnDevices(CECDEVICE_TV); -- 2.34.1